-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support dividing statement lists into clauses/stanzas (#79)
This commit adds support for dividing statement lists into clauses/stanzas. This prevents the need for the empty `//` workaround to divide code into stanzas. Specifically, with this, the following code is considered well-formatted: ```rs verus! { fn fff() { reveal(f1); foo; bar; baz; } } // verus! ``` Prior to this, verusfmt would have collapsed the additional newlines around `foo;`. With this PR, we maintain the additional newlines (_however_ if there are too many newlines, we bring it down to just the two, as a stylistic choice). Note: this _only_ adds support for stanzas for statement lists. It explicitly does _not_ work in general contexts (such as dividing a single expression up via extra newlines). I believe that supporting stanzas at the statement level should cover most people's use cases for them, while limiting the scope of the shenanigans necessary for the parser to be able to handle the special case of the double/multi-newline.
- Loading branch information
1 parent
5e1dc17
commit c5fdb28
Showing
6 changed files
with
80 additions
and
28 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
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