-
Notifications
You must be signed in to change notification settings - Fork 286
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Don't include whitespace in the span with empty nonterminals
Empty non-terminals used to be spanned by the whitespace between the previous and next token. If the non-terminal was the first thing in another production this span would leak into that production, causing it to have a to large span assigned. This makes empty productions instead only point to the start of the lookahead to avoid this problem.
- Loading branch information
Showing
7 changed files
with
224 additions
and
228 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
grammar; | ||
|
||
Sp<T> = @L T @R; | ||
|
||
Meta: () = { | ||
"comment" => (), | ||
=> (), | ||
}; | ||
|
||
// An empty `Meta` production here should not cause the span of `Let` to include the preceding whitespace | ||
Let: &'input str = Meta <"let">; | ||
|
||
pub Test: (usize, &'input str, usize) = "before" <Sp<Let>>; |
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.