iphonelazext: fix pbx file reading to process escaped quote characters. Registered PBXShellScriptBuildPhase for reading

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4425 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
skalogryz
2016-01-16 06:16:32 +00:00
parent 6b71585e4e
commit 76d93becf9
3 changed files with 25 additions and 4 deletions

View File

@@ -374,7 +374,7 @@ begin
tk:=p.FetchNextEntity; tk:=p.FetchNextEntity;
refs:=TList.Create; refs:=TList.Create;
try try
while tk<>etCloseObject do begin while not (tk in [etError, etCloseObject]) do begin
if tk=etOpenObject then begin if tk=etOpenObject then begin
id:=p.Name; id:=p.Name;
cmt:=p.LastComment; cmt:=p.LastComment;
@@ -388,8 +388,9 @@ begin
obj._id:=id; obj._id:=id;
PBXReadClass(p, obj, refs); PBXReadClass(p, obj, refs);
objs.Add(id, obj); objs.Add(id, obj);
end else end else begin
PBXParserSkipLevel(p); PBXParserSkipLevel(p);
end;
end else end else
PBXParserSkipLevel(p); PBXParserSkipLevel(p);
@@ -422,6 +423,7 @@ var
root : string; root : string;
objs : TObjHashList; objs : TObjHashList;
rt : TObject; rt : TObject;
i : Integer;
begin begin
Result:=false; Result:=false;
AFileInfo.archiveVersion:=''; AFileInfo.archiveVersion:='';
@@ -440,7 +442,7 @@ begin
tk:=p.FetchNextEntity; tk:=p.FetchNextEntity;
while tk <> etEOF do begin while not (tk in [etEOF,etError]) do begin
if tk = etValue then begin if tk = etValue then begin
if p.Name='archiveVersion' then AFileInfo.archiveVersion:=p.Value if p.Name='archiveVersion' then AFileInfo.archiveVersion:=p.Value
else if p.Name='objectVersion' then AFileInfo.objectVersion:=p.Value else if p.Name='objectVersion' then AFileInfo.objectVersion:=p.Value
@@ -451,6 +453,13 @@ begin
tk:=p.FetchNextEntity; tk:=p.FetchNextEntity;
end; end;
if tk=etError then begin
{for i:=0 to objs.Count-1 do
TObject(objs[i]).Free;}
Result:=false;
Exit;
end;
rt:=objs.Find(root); rt:=objs.Find(root);
if Assigned(rt) and (rt is PBXObject) then if Assigned(rt) and (rt is PBXObject) then

View File

@@ -557,6 +557,8 @@ begin
end; end;
function TPBXScanner.DoFetchToken: TPBXToken; function TPBXScanner.DoFetchToken: TPBXToken;
var
donestr: Boolean;
begin begin
if idx>length(buf) then begin if idx>length(buf) then begin
Result:=tkEOF; Result:=tkEOF;
@@ -590,7 +592,16 @@ begin
'"': begin '"': begin
inc(idx); inc(idx);
Result:=tkIdentifier; Result:=tkIdentifier;
FCurTokenString:=ScanTo(buf, idx, ['"']); donestr:=false;
FCurTokenString:='';
repeat
FCurTokenString:=FCurTokenString+ScanTo(buf, idx, ['"']);
donestr:=(buf[idx-1]<>'\');
if not donestr then begin
FCurTokenString:=FCurTokenString+'"';
inc(idx);
end;
until donestr;
inc(idx); inc(idx);
end; end;
'=': begin '=': begin

View File

@@ -709,6 +709,7 @@ initialization
PBXRegisterClass(PBXVariantGroup); PBXRegisterClass(PBXVariantGroup);
PBXRegisterClass(XCBuildConfiguration); PBXRegisterClass(XCBuildConfiguration);
PBXRegisterClass(XCConfigurationList); PBXRegisterClass(XCConfigurationList);
PBXRegisterClass(PBXShellScriptBuildPhase);
end. end.