Jedi code format: Fix parser error on deprecated hint with descriptive text. Issue #40355

This commit is contained in:
DomingoGP 2023-06-29 21:00:40 +02:00
parent 8eab0fb13f
commit 88a2fe4b51

View File

@ -218,6 +218,7 @@ type
procedure RecogniseActualParams; procedure RecogniseActualParams;
procedure RecogniseActualParam; procedure RecogniseActualParam;
procedure RecogniseDeprecated;
procedure RecogniseProcedureDirectives; procedure RecogniseProcedureDirectives;
procedure RecogniseExportsSection; procedure RecogniseExportsSection;
@ -588,18 +589,7 @@ begin
{ unit can be "deprecated platform library" } { unit can be "deprecated platform library" }
if fcTokenList.FirstSolidTokenType in HintDirectives then if fcTokenList.FirstSolidTokenType in HintDirectives then
begin RecogniseHintDirectives;
PushNode(nHintDirectives);
while fcTokenList.FirstSolidTokenType in HintDirectives do
Recognise(HintDirectives);
PopNode;
end;
{ or platform }
if fcTokenList.FirstSolidTokenType = ttPlatform then
Recognise(ttPlatform);
Recognise(ttSemicolon); Recognise(ttSemicolon);
RecogniseNotSolidTokens; RecogniseNotSolidTokens;
@ -1313,9 +1303,9 @@ begin
Recognise(ttNested); Recognise(ttNested);
end; end;
// the type can be deprecated // the type can be deprecated or another hint directive
if fcTokenList.FirstSolidTokenType = ttDeprecated then if fcTokenList.FirstSolidTokenType in HintDirectives then
Recognise(ttDeprecated); RecogniseHintDirectives;
if fcTokenList.FirstSolidTokenType <> ttDot then if fcTokenList.FirstSolidTokenType <> ttDot then
break; break;
@ -4476,6 +4466,13 @@ begin
end; end;
end; end;
procedure TBuildParseTree.RecogniseDeprecated;
begin
Recognise(ttDeprecated);
if fcTokenList.FirstSolidTokenType in LiteralStringStarters then
RecogniseLiteralString;
end;
procedure TBuildParseTree.RecogniseProcedureDirectives; procedure TBuildParseTree.RecogniseProcedureDirectives;
var var
lTokenType, lNextType: TTokenType; lTokenType, lNextType: TTokenType;
@ -4518,9 +4515,7 @@ begin
RecogniseIdentifier(False, idStrict); RecogniseIdentifier(False, idStrict);
end; end;
ttDeprecated: begin ttDeprecated: begin
Recognise(ttDeprecated); RecogniseDeprecated;
if fcTokenList.FirstSolidTokenType <> ttSemicolon then
RecogniseConstantExpression;
end end
else else
Recognise(ProcedureDirectives); Recognise(ProcedureDirectives);
@ -5965,6 +5960,9 @@ begin
while (fcTokenList.FirstSolidTokenType in HintDirectives) do while (fcTokenList.FirstSolidTokenType in HintDirectives) do
begin begin
if fcTokenList.FirstSolidTokenType = ttDeprecated then
RecogniseDeprecated
else
Recognise(HintDirectives); Recognise(HintDirectives);
end; end;