mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-11 19:16:16 +02:00
codetools: fixed parsing var n:t platform=1
git-svn-id: trunk@44271 -
This commit is contained in:
parent
fd8f2c1da7
commit
b641e949dc
@ -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;
|
||||
@ -3290,7 +3290,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
|
||||
@ -3298,9 +3303,6 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
// optional: hint modifier
|
||||
ReadHintModifiers;
|
||||
|
||||
HasSemicolon:=false;
|
||||
if CurPos.Flag=cafSemicolon then begin
|
||||
// read ;
|
||||
@ -3378,8 +3380,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
|
||||
@ -3419,7 +3422,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
|
||||
@ -4590,7 +4593,8 @@ function TPascalParserTool.KeyWordFuncTypeDefault: boolean;
|
||||
Low(integer)..High(integer)
|
||||
'a'..'z'
|
||||
}
|
||||
var SubRangeOperatorFound: boolean;
|
||||
var
|
||||
SubRangeOperatorFound: boolean;
|
||||
|
||||
procedure ReadTillTypeEnd;
|
||||
begin
|
||||
@ -4701,7 +4705,6 @@ begin
|
||||
SaveRaiseException(ctsInvalidType);
|
||||
end;
|
||||
end;
|
||||
ReadHintModifiers;
|
||||
EndChildNode;
|
||||
Result:=true;
|
||||
end;
|
||||
@ -4879,7 +4882,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