mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-22 04:39:27 +02:00
codetools: fixed parsing multiple hint modifiers
git-svn-id: trunk@42786 -
This commit is contained in:
parent
9bb0596049
commit
82f068abd7
@ -217,7 +217,7 @@ type
|
|||||||
function ReadWithStatement(ExceptionOnError, CreateNodes: boolean): boolean;
|
function ReadWithStatement(ExceptionOnError, CreateNodes: boolean): boolean;
|
||||||
function ReadOnStatement(ExceptionOnError, CreateNodes: boolean): boolean;
|
function ReadOnStatement(ExceptionOnError, CreateNodes: boolean): boolean;
|
||||||
procedure ReadVariableType;
|
procedure ReadVariableType;
|
||||||
function ReadHintModifier: boolean;
|
procedure ReadHintModifiers;
|
||||||
function ReadTilTypeOfProperty(PropertyNode: TCodeTreeNode): boolean;
|
function ReadTilTypeOfProperty(PropertyNode: TCodeTreeNode): boolean;
|
||||||
function ReadTilGetterOfProperty(PropertyNode: TCodeTreeNode): boolean;
|
function ReadTilGetterOfProperty(PropertyNode: TCodeTreeNode): boolean;
|
||||||
procedure ReadGUID;
|
procedure ReadGUID;
|
||||||
@ -2338,7 +2338,7 @@ function TPascalParserTool.KeyWordFuncClassProperty: boolean;
|
|||||||
property X: integer index 1 read GetCoords write SetCoords stored IsStored; deprecated;
|
property X: integer index 1 read GetCoords write SetCoords stored IsStored; deprecated;
|
||||||
property Col8: ICol8 read FCol8 write FCol8 implements ICol8, IColor;
|
property Col8: ICol8 read FCol8 write FCol8 implements ICol8, IColor;
|
||||||
property Value: Integer read FCurrent; enumerator Current;
|
property Value: Integer read FCurrent; enumerator Current;
|
||||||
property Visible: WordBool readonly dispid 401;
|
property Visible: WordBool readonly dispid 401; experimental; platform;
|
||||||
|
|
||||||
property specifiers before semicolon:
|
property specifiers before semicolon:
|
||||||
index <id or number>, read <id>, write <id>, stored <id>, default <constant>,
|
index <id or number>, read <id>, write <id>, stored <id>, default <constant>,
|
||||||
@ -2406,12 +2406,8 @@ begin
|
|||||||
end else
|
end else
|
||||||
UndoReadNextAtom;
|
UndoReadNextAtom;
|
||||||
|
|
||||||
if CurPos.Flag=cafSemicolon then begin
|
if CurPos.Flag=cafSemicolon then
|
||||||
// read hint modifiers
|
ReadHintModifiers;
|
||||||
ReadNextAtom;
|
|
||||||
if not ReadHintModifier then
|
|
||||||
UndoReadNextAtom;
|
|
||||||
end;
|
|
||||||
|
|
||||||
end else
|
end else
|
||||||
UndoReadNextAtom;
|
UndoReadNextAtom;
|
||||||
@ -3275,7 +3271,7 @@ begin
|
|||||||
ReadConstExpr; // read constant
|
ReadConstExpr; // read constant
|
||||||
|
|
||||||
// optional: hint modifier
|
// optional: hint modifier
|
||||||
ReadHintModifier;
|
ReadHintModifiers;
|
||||||
|
|
||||||
// semicolon and postfix modifiers
|
// semicolon and postfix modifiers
|
||||||
if CurPos.Flag=cafSemicolon then begin
|
if CurPos.Flag=cafSemicolon then begin
|
||||||
@ -3349,14 +3345,33 @@ begin
|
|||||||
EndChildNode;
|
EndChildNode;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TPascalParserTool.ReadHintModifier: boolean;
|
procedure TPascalParserTool.ReadHintModifiers;
|
||||||
|
// after reading cursor is at next atom
|
||||||
|
|
||||||
|
function IsModifier: boolean;
|
||||||
|
var
|
||||||
|
p: PChar;
|
||||||
|
begin
|
||||||
|
Result:=false;
|
||||||
|
if (CurPos.StartPos<1) or (CurPos.StartPos>SrcLen) then exit;
|
||||||
|
p:=@Src[CurPos.StartPos];
|
||||||
|
case UpChars[p^] of
|
||||||
|
'D': Result:=UpAtomIs('DEPRECATED');
|
||||||
|
'E': Result:=UpAtomIs('EXPERIMENTAL');
|
||||||
|
'L': Result:=UpAtomIs('LIBRARY');
|
||||||
|
'P': Result:=UpAtomIs('PLATFORM');
|
||||||
|
'U': Result:=UpAtomIs('UNIMPLEMENTED');
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
if UpAtomIs('DEPRECATED') or UpAtomIs('PLATFORM')
|
while CurPos.Flag=cafSemicolon do begin
|
||||||
or UpAtomIs('UNIMPLEMENTED') or UpAtomIs('EXPERIMENTAL')
|
ReadNextAtom;
|
||||||
or UpAtomIs('LIBRARY')
|
if not IsModifier then begin
|
||||||
then begin
|
UndoReadNextAtom;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
//debugln(['TPascalParserTool.ReadHintModifier ',CurNode.DescAsString,' ',CleanPosToStr(CurPos.StartPos)]);
|
//debugln(['TPascalParserTool.ReadHintModifier ',CurNode.DescAsString,' ',CleanPosToStr(CurPos.StartPos)]);
|
||||||
Result:=true;
|
|
||||||
CreateChildNode;
|
CreateChildNode;
|
||||||
CurNode.Desc:=ctnHintModifier;
|
CurNode.Desc:=ctnHintModifier;
|
||||||
CurNode.EndPos:=CurPos.EndPos;
|
CurNode.EndPos:=CurPos.EndPos;
|
||||||
@ -3371,8 +3386,7 @@ begin
|
|||||||
if not (CurPos.Flag in [cafSemicolon,cafRoundBracketClose]) then
|
if not (CurPos.Flag in [cafSemicolon,cafRoundBracketClose]) then
|
||||||
SaveRaiseCharExpectedButAtomFound(';');
|
SaveRaiseCharExpectedButAtomFound(';');
|
||||||
EndChildNode;
|
EndChildNode;
|
||||||
end else
|
end;
|
||||||
Result:=false;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TPascalParserTool.KeyWordFuncBeginEnd: boolean;
|
function TPascalParserTool.KeyWordFuncBeginEnd: boolean;
|
||||||
@ -3626,11 +3640,11 @@ begin
|
|||||||
if (not AtomIsStringConstant) and (not AtomIsIdentifier) then
|
if (not AtomIsStringConstant) and (not AtomIsIdentifier) then
|
||||||
SaveRaiseStringExpectedButAtomFound(ctsStringConstant);
|
SaveRaiseStringExpectedButAtomFound(ctsStringConstant);
|
||||||
ReadConstant(true,false,[]);
|
ReadConstant(true,false,[]);
|
||||||
// read hint modifier
|
|
||||||
ReadHintModifier;
|
|
||||||
// read ;
|
// read ;
|
||||||
if CurPos.Flag<>cafSemicolon then
|
if CurPos.Flag<>cafSemicolon then
|
||||||
SaveRaiseCharExpectedButAtomFound(';');
|
SaveRaiseCharExpectedButAtomFound(';');
|
||||||
|
// read hint modifier
|
||||||
|
ReadHintModifiers;
|
||||||
CurNode.EndPos:=CurPos.EndPos;
|
CurNode.EndPos:=CurPos.EndPos;
|
||||||
EndChildNode;
|
EndChildNode;
|
||||||
end else begin
|
end else begin
|
||||||
@ -3774,7 +3788,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
ReadConstExpr;
|
ReadConstExpr;
|
||||||
// optional: hint modifier
|
// optional: hint modifier
|
||||||
ReadHintModifier;
|
ReadHintModifiers;
|
||||||
if CurPos.Flag=cafSemicolon then begin
|
if CurPos.Flag=cafSemicolon then begin
|
||||||
if (CurNode.Parent.Desc=ctnConstSection)
|
if (CurNode.Parent.Desc=ctnConstSection)
|
||||||
and (CurNode.Parent.Parent.Desc in AllCodeSections) then begin
|
and (CurNode.Parent.Parent.Desc in AllCodeSections) then begin
|
||||||
@ -3858,7 +3872,7 @@ begin
|
|||||||
ReadNextAtom;
|
ReadNextAtom;
|
||||||
ParseType(CurPos.StartPos,CurPos.EndPos-CurPos.StartPos);
|
ParseType(CurPos.StartPos,CurPos.EndPos-CurPos.StartPos);
|
||||||
// read hint modifier
|
// read hint modifier
|
||||||
ReadHintModifier;
|
ReadHintModifiers;
|
||||||
// read ;
|
// read ;
|
||||||
if CurPos.Flag<>cafSemicolon then
|
if CurPos.Flag<>cafSemicolon then
|
||||||
SaveRaiseCharExpectedButAtomFound(';');
|
SaveRaiseCharExpectedButAtomFound(';');
|
||||||
@ -4184,10 +4198,8 @@ begin
|
|||||||
// read extra flags
|
// read extra flags
|
||||||
ReadNextAtom;
|
ReadNextAtom;
|
||||||
end;
|
end;
|
||||||
if CurPos.Flag=cafSemicolon then
|
|
||||||
ReadNextAtom;
|
|
||||||
// read hint modifier
|
// read hint modifier
|
||||||
ReadHintModifier;
|
ReadHintModifiers;
|
||||||
if CurPos.Flag=cafSemicolon then
|
if CurPos.Flag=cafSemicolon then
|
||||||
ReadNextAtom;
|
ReadNextAtom;
|
||||||
// read post modifiers
|
// read post modifiers
|
||||||
@ -4294,10 +4306,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
if CurPos.Flag=cafEND then begin
|
if CurPos.Flag=cafEND then begin
|
||||||
ReadNextAtom;
|
ReadNextAtom;
|
||||||
if CurPos.Flag=cafSemicolon then
|
|
||||||
ReadNextAtom;
|
|
||||||
// read hint modifier
|
|
||||||
ReadHintModifier;
|
|
||||||
if CurPos.Flag=cafSemicolon then
|
if CurPos.Flag=cafSemicolon then
|
||||||
ReadNextAtom;
|
ReadNextAtom;
|
||||||
// read post modifiers
|
// read post modifiers
|
||||||
@ -4308,6 +4316,8 @@ begin
|
|||||||
ReadConstant(true,false,[]);
|
ReadConstant(true,false,[]);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
// read hint modifier
|
||||||
|
ReadHintModifiers;
|
||||||
if CurPos.Flag<>cafSemicolon then
|
if CurPos.Flag<>cafSemicolon then
|
||||||
UndoReadNextAtom;
|
UndoReadNextAtom;
|
||||||
end;
|
end;
|
||||||
@ -4816,7 +4826,7 @@ begin
|
|||||||
debugln(['TPascalParserTool.KeyWordFuncTypeRecordCase ParseType failed']);
|
debugln(['TPascalParserTool.KeyWordFuncTypeRecordCase ParseType failed']);
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
ReadHintModifier;
|
ReadHintModifiers;
|
||||||
CurNode.EndPos:=CurPos.EndPos;
|
CurNode.EndPos:=CurPos.EndPos;
|
||||||
EndChildNode; // close variable definition
|
EndChildNode; // close variable definition
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user