iphonelazext: added unescaping of PBX properties values during parsing.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4426 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
parent
76d93becf9
commit
d59b9250ff
@ -157,6 +157,8 @@ procedure ParseAString(const test: string);
|
||||
function PBXParserSkipLevel(p: TPBXParser): Boolean;
|
||||
function PBXRawWriteValue(const v: string): string;
|
||||
|
||||
function Unescape(const s: string): string;
|
||||
|
||||
implementation
|
||||
|
||||
type
|
||||
@ -173,6 +175,44 @@ const
|
||||
ToEscape = ['"',#13,#9,#10,'\'];
|
||||
// commas are not
|
||||
|
||||
function Unescape(const s: string): string;
|
||||
var
|
||||
i : Integer;
|
||||
j : Integer;
|
||||
cnt : Integer;
|
||||
begin
|
||||
if s='' then begin
|
||||
Result:='';
|
||||
Exit;
|
||||
end;
|
||||
SetLength(Result, length(s));
|
||||
cnt := length(s);
|
||||
i:=1;
|
||||
j:=1;
|
||||
while i<=cnt do begin
|
||||
if s[i]='\' then begin
|
||||
inc(i);
|
||||
if i<=cnt then begin
|
||||
case s[i] of
|
||||
'r': Result[j]:=#10;
|
||||
'n': Result[j]:=#13;
|
||||
't': Result[j]:=#9;
|
||||
'0': Result[j]:=#0;
|
||||
else
|
||||
Result[j]:=s[i];
|
||||
end;
|
||||
inc(j);
|
||||
inc(i);
|
||||
end;
|
||||
end else begin
|
||||
Result[j]:=s[i];
|
||||
inc(j);
|
||||
inc(i);
|
||||
end;
|
||||
end;
|
||||
Result:=Copy(Result, 1, j-1);
|
||||
end;
|
||||
|
||||
function PBXRawWriteValue(const v: string): string;
|
||||
var
|
||||
i : Integer;
|
||||
@ -602,6 +642,7 @@ begin
|
||||
inc(idx);
|
||||
end;
|
||||
until donestr;
|
||||
FCurTokenString:=Unescape(FCurTokenString);
|
||||
inc(idx);
|
||||
end;
|
||||
'=': begin
|
||||
|
Loading…
Reference in New Issue
Block a user