From 88694d38affb3b8d9f99093096d0e83e2a8722a3 Mon Sep 17 00:00:00 2001 From: juha Date: Sun, 4 Jul 2021 14:44:13 +0000 Subject: [PATCH] =?UTF-8?q?Jedi=20Code=20Format:=20Fix=20formatting=20when?= =?UTF-8?q?=20"Enumerator"=20is=20the=20first=20word=20in=20function.=20Is?= =?UTF-8?q?sue=20#39149,=20patch=20by=20Domingo=20Galm=C3=A9s.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: trunk@65365 - --- components/jcf2/Parse/BuildParseTree.pas | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/components/jcf2/Parse/BuildParseTree.pas b/components/jcf2/Parse/BuildParseTree.pas index b21cc779b1..f6c3f3286e 100644 --- a/components/jcf2/Parse/BuildParseTree.pas +++ b/components/jcf2/Parse/BuildParseTree.pas @@ -275,7 +275,7 @@ type procedure RecogniseAnonymousMethod; function AnonymousMethodNext: boolean; - procedure CheckEnumeratorToken; + procedure CheckEnumeratorToken(aCheckTwoTokens:boolean=false); function CheckSpecialize(aRecogniseIfFound:boolean):boolean; Protected procedure RaiseParseError(const aMessage: string; aSourceToken: TSourceToken); @@ -4290,7 +4290,7 @@ begin external is more complex } - CheckEnumeratorToken(); + CheckEnumeratorToken(fcTokenList.FirstSolidTokenType = ttSemicolon); if (fcTokenList.FirstSolidTokenType in ProcedureDirectives) or ((fcTokenList.FirstSolidTokenType = ttSemicolon) and (fcTokenList.SolidTokenType(2) in ProcedureDirectives)) then @@ -4301,7 +4301,7 @@ begin Recognise(ttSemiColon); lbFirstPass := True; - CheckEnumeratorToken(); + CheckEnumeratorToken(fcTokenList.FirstSolidTokenType = ttSemicolon); while (fcTokenList.FirstSolidTokenType in ProcedureDirectives) or ((fcTokenList.FirstSolidTokenType = ttSemicolon) and (fcTokenList.SolidTokenType(2) in ProcedureDirectives)) do @@ -5775,7 +5775,7 @@ const } PropertyDirectives = [ttDefault, ttNoDefault, ttStored, ttEnumerator]; begin - CheckEnumeratorToken(); + CheckEnumeratorToken(fcTokenList.FirstSolidTokenType = ttSemicolon); if ((fcTokenList.FirstSolidTokenType = ttSemicolon) and (fcTokenList.SolidTokenType(2) in PropertyDirectives)) or (fcTokenList.FirstSolidTokenType in PropertyDirectives) then @@ -6008,7 +6008,7 @@ begin end; end; -procedure TBuildParseTree.CheckEnumeratorToken; +procedure TBuildParseTree.CheckEnumeratorToken(aCheckTwoTokens:boolean); var lc: TSourceToken; begin @@ -6018,11 +6018,14 @@ begin lc.TokenType:=ttEnumerator; lc.WordType:=wtReservedWord; end; - lc := fcTokenList.SolidToken(2); - if (lc<>nil) and (lc.TokenType=ttIdentifier) and (length(lc.SourceCode)=10) and (lowercase(lc.SourceCode)='enumerator') then + if aCheckTwoTokens then begin - lc.TokenType:=ttEnumerator; - lc.WordType:=wtReservedWord; + lc := fcTokenList.SolidToken(2); + if (lc<>nil) and (lc.TokenType=ttIdentifier) and (length(lc.SourceCode)=10) and (lowercase(lc.SourceCode)='enumerator') then + begin + lc.TokenType:=ttEnumerator; + lc.WordType:=wtReservedWord; + end; end; end;