diff --git a/components/jcf2/Parse/BuildParseTree.pas b/components/jcf2/Parse/BuildParseTree.pas index 9a5947cc18..9af29dd2aa 100644 --- a/components/jcf2/Parse/BuildParseTree.pas +++ b/components/jcf2/Parse/BuildParseTree.pas @@ -3268,7 +3268,7 @@ end; procedure TBuildParseTree.RecogniseCaseStmnt; begin - // CaseStmt -> CASE Expression OF CaseSelector/';'... [ELSE Statement] [';'] END + // CaseStmt -> CASE Expression OF CaseSelector/';'... [ELSE / OTHERWISE Statement] [';'] END PushNode(nCaseStatement); Recognise(ttCase); @@ -3279,13 +3279,13 @@ begin Recognise(ttOf); - while not (fcTokenList.FirstSolidTokenType in [ttElse, ttEnd]) do + while not (fcTokenList.FirstSolidTokenType in [ttElse, ttOtherwise, ttEnd]) do RecogniseCaseSelector; - if fcTokenList.FirstSolidTokenType = ttElse then + if fcTokenList.FirstSolidTokenType in [ttElse, ttOtherwise] then begin PushNode(nElseCase); - Recognise(ttElse); + Recognise(fcTokenList.FirstSolidTokenType); RecogniseStatementList([ttEnd]); PopNode; end; diff --git a/components/jcf2/Parse/Tokens.pas b/components/jcf2/Parse/Tokens.pas index 361eeaa438..fc20a5bba2 100644 --- a/components/jcf2/Parse/Tokens.pas +++ b/components/jcf2/Parse/Tokens.pas @@ -123,6 +123,7 @@ type ttOf, ttOperator, ttOut, + ttOtherwise, ttPackage, ttPacked, ttProcedure, @@ -617,6 +618,7 @@ begin AddKeyword('of', wtReservedWord, ttOf); AddKeyword('operator', wtReservedWord, ttOperator); AddKeyword('out', wtReservedWordDirective, ttOut); + AddKeyword('otherwise', wtReservedWord, ttOtherwise); AddKeyword('packed', wtReservedWord, ttPacked); AddKeyword('procedure', wtReservedWord, ttProcedure); AddKeyword('program', wtReservedWord, ttProgram); diff --git a/components/jcf2/Process/Indent/Indenter.pas b/components/jcf2/Process/Indent/Indenter.pas index 5620ffd925..4b9fc00db7 100644 --- a/components/jcf2/Process/Indent/Indenter.pas +++ b/components/jcf2/Process/Indent/Indenter.pas @@ -460,7 +460,7 @@ begin // don't indent the case label again if pt.HasParentNode(nCaseLabel, 6) then Dec(liIndentCount) - else if (pt.TokenType = ttElse) and pt.HasParentNode(nElseCase, 1) then + else if (pt.TokenType in [ttElse, ttOtherwise]) and pt.HasParentNode(nElseCase, 1) then Dec(liIndentCount); if not FormattingSettings.Indent.IndentCaseElse then