mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-07 17:58:03 +02:00
JCF2: Support "otherwise" in a case clause. Issue #34592, patch from BrunoK.
git-svn-id: trunk@59640 -
This commit is contained in:
parent
07abf42286
commit
02ba3da476
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user