mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-16 15:59:24 +02:00
codetools: fixed parsing var n:t platform=1
git-svn-id: branches/fixes_1_2@44272 -
This commit is contained in:
parent
b776bdcc70
commit
34e5390e0e
@ -49,6 +49,7 @@ type
|
||||
cafEdgedBracketOpen, cafEdgedBracketClose,
|
||||
cafWord, cafEnd
|
||||
);
|
||||
TCommonAtomFlags = set of TCommonAtomFlag;
|
||||
|
||||
const
|
||||
AllCommonAtomWords = [cafWord, cafEnd];
|
||||
|
@ -219,7 +219,7 @@ type
|
||||
function ReadWithStatement(ExceptionOnError, CreateNodes: boolean): boolean;
|
||||
function ReadOnStatement(ExceptionOnError, CreateNodes: boolean): boolean;
|
||||
procedure ReadVariableType;
|
||||
procedure ReadHintModifiers;
|
||||
procedure ReadHintModifiers(const AllowedAtomsBehind: TCommonAtomFlags = [cafSemicolon]);
|
||||
function ReadTilTypeOfProperty(PropertyNode: TCodeTreeNode): boolean;
|
||||
function ReadTilGetterOfProperty(PropertyNode: TCodeTreeNode): boolean;
|
||||
procedure ReadGUID;
|
||||
@ -3288,7 +3288,12 @@ begin
|
||||
ReadConstant(true,false,[]);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
// optional: hint modifier
|
||||
ReadHintModifiers([cafSemicolon,cafEqual]);
|
||||
|
||||
if (ParentNode.Desc=ctnVarSection) then begin
|
||||
// optional: initial value
|
||||
if CurPos.Flag=cafEqual then
|
||||
if ParentNode.Parent.Desc in AllCodeSections+[ctnProcedure] then begin
|
||||
@ -3296,9 +3301,6 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
// optional: hint modifier
|
||||
ReadHintModifiers;
|
||||
|
||||
HasSemicolon:=false;
|
||||
if CurPos.Flag=cafSemicolon then begin
|
||||
// read ;
|
||||
@ -3376,8 +3378,9 @@ begin
|
||||
EndChildNode;
|
||||
end;
|
||||
|
||||
procedure TPascalParserTool.ReadHintModifiers;
|
||||
// after reading cursor is at next atom
|
||||
procedure TPascalParserTool.ReadHintModifiers(
|
||||
const AllowedAtomsBehind: TCommonAtomFlags);
|
||||
// after reading the cursor is at next atom, e.g. the semicolon
|
||||
|
||||
function IsModifier: boolean;
|
||||
var
|
||||
@ -3417,7 +3420,7 @@ begin
|
||||
ReadConstant(true,false,[]);
|
||||
CurNode.EndPos:=CurPos.StartPos;
|
||||
end;
|
||||
if not (CurPos.Flag in [cafSemicolon,cafRoundBracketClose]) then
|
||||
if not (CurPos.Flag in AllowedAtomsBehind) then
|
||||
SaveRaiseCharExpectedButAtomFound(';');
|
||||
EndChildNode;
|
||||
if CurPos.Flag<>cafSemicolon then
|
||||
@ -4588,7 +4591,8 @@ function TPascalParserTool.KeyWordFuncTypeDefault: boolean;
|
||||
Low(integer)..High(integer)
|
||||
'a'..'z'
|
||||
}
|
||||
var SubRangeOperatorFound: boolean;
|
||||
var
|
||||
SubRangeOperatorFound: boolean;
|
||||
|
||||
procedure ReadTillTypeEnd;
|
||||
begin
|
||||
@ -4699,7 +4703,6 @@ begin
|
||||
SaveRaiseException(ctsInvalidType);
|
||||
end;
|
||||
end;
|
||||
ReadHintModifiers;
|
||||
EndChildNode;
|
||||
Result:=true;
|
||||
end;
|
||||
@ -4877,7 +4880,7 @@ begin
|
||||
{$IFDEF VerboseRecordCase}
|
||||
debugln(['TPascalParserTool.KeyWordFuncTypeRecordCase Hint modifier: "',GetAtom,'"']);
|
||||
{$ENDIF}
|
||||
ReadHintModifiers;
|
||||
ReadHintModifiers([cafSemicolon,cafRoundBracketClose]);
|
||||
CurNode.EndPos:=CurPos.EndPos;
|
||||
EndChildNode; // close variable definition
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user