-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Format switch statements and expressions. (#1294)
Format switch statements and expressions. Switch statements build on the existing SequencePiece but need some additional flexibility in there to handle the fact that switch case lines are indented +2 and then case body lines are indented +4. Switch expressions build on the existing ListPiece since the body is sort of like a collection literal. There are a few tweaks needed here too since an unsplit switch expression body gets spaces inside the curly brackets. Also, switch values (the part in the leading "( ... )") are formatted using ListPiece as well, since they are formatted essentially like a single-element argument list, except that they don't get a trailing comma. This does not implement all of the kinds of patterns that can appear in cases. It just implements basic constants needed for the tests. It also doesn't support guard clauses yet. Those will come later. Co-authored-by: Nate Bosch <nbosch@google.com>
- Loading branch information
1 parent
874d511
commit 2cee560
Showing
12 changed files
with
976 additions
and
121 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
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.