Skip to content

Commit

Permalink
fixing switch-case parsing edge case
Browse files Browse the repository at this point in the history
  • Loading branch information
m0rkeulv committed Feb 14, 2024
1 parent 7d1cf43 commit 49bc76d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ throwStatement ::= 'throw' expression ';'?
switchStatement ::= 'switch' expression switchBlock
switchBlock ::= '{' (switchCase | defaultCase)* '}'{pin=1}

switchCaseBlock ::= (literalExpression <<semicolonUnlessPrecededByStatement>>) | statementList
switchCaseBlock ::= statementList | (literalExpression <<semicolonUnlessPrecededByStatement>>)
switchCase ::= 'case' switchCaseExpr ((','|'|') switchCaseExpr)* guard? ':' switchCaseBlock? {pin=1 recoverWhile="switch_case_recover"}
switchCaseExpr ::= (switchExtractorExpression | expression | switchCaseCaptureVar) {pin=1} // Should NOT be named Expression, because it should not be an expression.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,30 +49,29 @@ Haxe File
HaxePsiToken:true('true')
HaxePsiToken::(':')
SWITCH_CASE_BLOCK
LITERAL_EXPRESSION
BLOCK_STATEMENT
HaxePsiToken:{('{')
CALL_EXPRESSION
REFERENCE_EXPRESSION
IDENTIFIER
HaxePsiToken:ID('trace')
HaxePsiToken:(('(')
CALL_EXPRESSION_LIST
STRING_LITERAL_EXPRESSION
HaxePsiToken:OPEN_QUOTE('"')
HaxePsiToken:REGULAR_STRING_PART('true')
HaxePsiToken:CLOSING_QUOTE('"')
HaxePsiToken:)(')')
HaxePsiToken:;(';')
HaxePsiToken:}('}')
BLOCK_STATEMENT
HaxePsiToken:{('{')
CALL_EXPRESSION
REFERENCE_EXPRESSION
IDENTIFIER
HaxePsiToken:ID('trace')
HaxePsiToken:(('(')
CALL_EXPRESSION_LIST
STRING_LITERAL_EXPRESSION
HaxePsiToken:OPEN_QUOTE('"')
HaxePsiToken:REGULAR_STRING_PART('true')
HaxePsiToken:CLOSING_QUOTE('"')
HaxePsiToken:)(')')
HaxePsiToken:;(';')
HaxePsiToken:}('}')
SWITCH_CASE
HaxePsiToken:case('case')
SWITCH_CASE_EXPR
LITERAL_EXPRESSION
HaxePsiToken:false('false')
HaxePsiToken::(':')
SWITCH_CASE_BLOCK
OBJECT_LITERAL
BLOCK_STATEMENT
HaxePsiToken:{('{')
PsiComment(MSL_COMMENT)('// do nothing')
HaxePsiToken:}('}')
Expand Down

0 comments on commit 49bc76d

Please sign in to comment.