mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-21 07:00:10 +01:00
CodeTools: Fix parsing "with" statement, ended by outer block (repeat, try, if...) Issue #39684 Patch by Domingo Galmés
This commit is contained in:
parent
749ab743d6
commit
68366d178c
@ -257,6 +257,7 @@ type
|
|||||||
function SkipTypeReference(ExceptionOnError: boolean): boolean;
|
function SkipTypeReference(ExceptionOnError: boolean): boolean;
|
||||||
function SkipSpecializeParams(ExceptionOnError: boolean): boolean;
|
function SkipSpecializeParams(ExceptionOnError: boolean): boolean;
|
||||||
function WordIsPropertyEnd: boolean;
|
function WordIsPropertyEnd: boolean;
|
||||||
|
function WordIsStatemendEnd: boolean;
|
||||||
function AllowAttributes: boolean; inline;
|
function AllowAttributes: boolean; inline;
|
||||||
function AllowAnonymousFunctions: boolean; inline;
|
function AllowAnonymousFunctions: boolean; inline;
|
||||||
public
|
public
|
||||||
@ -3249,6 +3250,26 @@ begin
|
|||||||
until false;
|
until false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TPascalParserTool.WordIsStatemendEnd: boolean;
|
||||||
|
var
|
||||||
|
p: PChar;
|
||||||
|
begin
|
||||||
|
p:=@Src[CurPos.StartPos];
|
||||||
|
case UpChars[p^] of
|
||||||
|
'E':
|
||||||
|
case UpChars[p[1]] of
|
||||||
|
'L': if UpAtomIs('ELSE') then exit(true);
|
||||||
|
'N': if UpAtomIs('END') then exit(true);
|
||||||
|
'X': if UpAtomIs('EXCEPT') then exit(true);
|
||||||
|
end;
|
||||||
|
'F': if UpAtomIs('FINALLY') then exit(true);
|
||||||
|
'O': if UpAtomIs('OTHERWISE') then exit(true);
|
||||||
|
'U': if UpAtomIs('UNTIL') then exit(true);
|
||||||
|
end;
|
||||||
|
Result:=false;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
function TPascalParserTool.ReadTilStatementEnd(ExceptionOnError,
|
function TPascalParserTool.ReadTilStatementEnd(ExceptionOnError,
|
||||||
CreateNodes: boolean): boolean;
|
CreateNodes: boolean): boolean;
|
||||||
// after reading the current atom will be on the last atom of the statement
|
// after reading the current atom will be on the last atom of the statement
|
||||||
@ -3272,10 +3293,17 @@ begin
|
|||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
cafSemicolon: exit;
|
cafSemicolon: exit;
|
||||||
else
|
cafWord:
|
||||||
if CurPos.StartPos>SrcLen then exit;
|
begin
|
||||||
ReadNextAtom;
|
if WordIsStatemendEnd then
|
||||||
|
begin
|
||||||
|
UndoReadNextAtom;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
if CurPos.StartPos>SrcLen then exit;
|
||||||
|
ReadNextAtom;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user