codetools: fixed parsing array without of

git-svn-id: trunk@35412 -
This commit is contained in:
mattias 2012-02-17 09:58:18 +00:00
parent 202cd36b0a
commit a44a227419

View File

@ -1446,11 +1446,12 @@ begin
CurNode.Desc:=ctnOpenArrayType; CurNode.Desc:=ctnOpenArrayType;
end; end;
if not Extract then ReadNextAtom else ExtractNextAtom(copying,Attr); if not Extract then ReadNextAtom else ExtractNextAtom(copying,Attr);
if not UpAtomIs('OF') then if not UpAtomIs('OF') then begin
if ExceptionOnError then if ExceptionOnError then
RaiseStringExpectedButAtomFound('"of"') RaiseStringExpectedButAtomFound('"of"')
else else
exit; exit;
end;
if not Extract then ReadNextAtom else ExtractNextAtom(copying,Attr); if not Extract then ReadNextAtom else ExtractNextAtom(copying,Attr);
if UpAtomIs('CONST') then begin if UpAtomIs('CONST') then begin
if (phpCreateNodes in Attr) then begin if (phpCreateNodes in Attr) then begin
@ -4151,6 +4152,7 @@ function TPascalParserTool.KeyWordFuncTypeArray: boolean;
array of ... array of ...
array[SubRange] of ... array[SubRange] of ...
array[SubRange,SubRange,...] of ... array[SubRange,SubRange,...] of ...
array[Subrange]; // without "of" means array of byte
} }
begin begin
CreateChildNode; CreateChildNode;
@ -4172,6 +4174,13 @@ begin
RaiseCharExpectedButAtomFound(']'); RaiseCharExpectedButAtomFound(']');
until false; until false;
ReadNextAtom; ReadNextAtom;
if CurPos.Flag in [cafSemicolon,cafRoundBracketClose,cafEdgedBracketClose]
then begin
// array[] without "of" means array[] of byte
CurNode.EndPos:=CurPos.StartPos;
EndChildNode; // close array
exit(true);
end;
end; end;
if not UpAtomIs('OF') then if not UpAtomIs('OF') then
RaiseStringExpectedButAtomFound('"of"'); RaiseStringExpectedButAtomFound('"of"');