-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Scanner and Parser support for Switch expressions 2.0 (#3264)
* Restructure switch expressions grammar aligning it with JLS terminology; Eliminate unnecessary calls outs from the automaton (-> instead of ::=); fold multiple consume rules into one by parameterizing; delete dangling non-terminals (ThrowExpression ...); deduplicate unnecessary distinct non-terminals (e.g `SwitchLabelExpr` vs `SwitchLabel` ...) * Replace the pair of tokens, first the synthetic `BeginCaseExpr` followed by '->' in switch rules with a single synthetic `CaseArrow`. The scanner will disambiguate whether a token '->' is `TokenNameARROW` used in lambdas or is a `CaseArrow` used in switch rules by checking if the automaton will shift `CaseArrow` or not. * DiagnoseParser's repair of a misclassified '->' will allow it to recover perfectly! Just suppressing the message will do. * Get rid of code engaging `VanguardParser` in reconnaissance missions for `yield` and '->' disambiguation. * Eliminate feedback from Parser to Scanner on co-ordinates of the case statement * Eliminate feedforward from Parser to SwitchStatement on whether it contains patterns, nulls etc; Let Switch discover it's self by itself :) * Declutter `SwitchStatement.resolve()` by simplifying control flow; streamline management of secrets; * Delete `SelectionParserTest12.java` as it is fully duplicated by `SelectionParserTest13.java`; Rename the latter to `SelectionParserTest14.java` and ensure it runs in the right compliance mode. Hook up this dangling junit to a parent * Tweak a failing test case in `PrimitiveInPatternsTestSH.java` to work around a bug elsewhere that was masked so far. #3265 raised as follow up. * Adjust a few tests that result in altered diagnostics due to grammar refactoring * Adjust test in `FormatterRegressionTests.java` and `ResolveTests12To15.java` to run at the right compliance levels
- Loading branch information
1 parent
dd9a963
commit b294075
Showing
50 changed files
with
1,087 additions
and
2,000 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.