mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-09 13:19:54 +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;
|
procedure TBuildParseTree.RecogniseCaseStmnt;
|
||||||
begin
|
begin
|
||||||
// CaseStmt -> CASE Expression OF CaseSelector/';'... [ELSE Statement] [';'] END
|
// CaseStmt -> CASE Expression OF CaseSelector/';'... [ELSE / OTHERWISE Statement] [';'] END
|
||||||
PushNode(nCaseStatement);
|
PushNode(nCaseStatement);
|
||||||
|
|
||||||
Recognise(ttCase);
|
Recognise(ttCase);
|
||||||
@ -3279,13 +3279,13 @@ begin
|
|||||||
|
|
||||||
Recognise(ttOf);
|
Recognise(ttOf);
|
||||||
|
|
||||||
while not (fcTokenList.FirstSolidTokenType in [ttElse, ttEnd]) do
|
while not (fcTokenList.FirstSolidTokenType in [ttElse, ttOtherwise, ttEnd]) do
|
||||||
RecogniseCaseSelector;
|
RecogniseCaseSelector;
|
||||||
|
|
||||||
if fcTokenList.FirstSolidTokenType = ttElse then
|
if fcTokenList.FirstSolidTokenType in [ttElse, ttOtherwise] then
|
||||||
begin
|
begin
|
||||||
PushNode(nElseCase);
|
PushNode(nElseCase);
|
||||||
Recognise(ttElse);
|
Recognise(fcTokenList.FirstSolidTokenType);
|
||||||
RecogniseStatementList([ttEnd]);
|
RecogniseStatementList([ttEnd]);
|
||||||
PopNode;
|
PopNode;
|
||||||
end;
|
end;
|
||||||
|
@ -123,6 +123,7 @@ type
|
|||||||
ttOf,
|
ttOf,
|
||||||
ttOperator,
|
ttOperator,
|
||||||
ttOut,
|
ttOut,
|
||||||
|
ttOtherwise,
|
||||||
ttPackage,
|
ttPackage,
|
||||||
ttPacked,
|
ttPacked,
|
||||||
ttProcedure,
|
ttProcedure,
|
||||||
@ -617,6 +618,7 @@ begin
|
|||||||
AddKeyword('of', wtReservedWord, ttOf);
|
AddKeyword('of', wtReservedWord, ttOf);
|
||||||
AddKeyword('operator', wtReservedWord, ttOperator);
|
AddKeyword('operator', wtReservedWord, ttOperator);
|
||||||
AddKeyword('out', wtReservedWordDirective, ttOut);
|
AddKeyword('out', wtReservedWordDirective, ttOut);
|
||||||
|
AddKeyword('otherwise', wtReservedWord, ttOtherwise);
|
||||||
AddKeyword('packed', wtReservedWord, ttPacked);
|
AddKeyword('packed', wtReservedWord, ttPacked);
|
||||||
AddKeyword('procedure', wtReservedWord, ttProcedure);
|
AddKeyword('procedure', wtReservedWord, ttProcedure);
|
||||||
AddKeyword('program', wtReservedWord, ttProgram);
|
AddKeyword('program', wtReservedWord, ttProgram);
|
||||||
|
@ -460,7 +460,7 @@ begin
|
|||||||
// don't indent the case label again
|
// don't indent the case label again
|
||||||
if pt.HasParentNode(nCaseLabel, 6) then
|
if pt.HasParentNode(nCaseLabel, 6) then
|
||||||
Dec(liIndentCount)
|
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);
|
Dec(liIndentCount);
|
||||||
|
|
||||||
if not FormattingSettings.Indent.IndentCaseElse then
|
if not FormattingSettings.Indent.IndentCaseElse then
|
||||||
|
Loading…
Reference in New Issue
Block a user