Open
Conversation
This adds the ability to add a label to a repeat range so that a subsequent expression can match the same repetition. This is intended to help with expressing things like raw strings where the `#` characters must be balanced on both sides, with a limit on the number of matches.
This changes the raw string grammars to use named repetition to represent that the `#` characters need to be balanced within a specific limit. This also adds a cut after the `#` and before the `"` because rustc generates an error in this situation if a `"` is not found. It's maybe not the prettiest, and I'm on the fence whether this makes it clearer.
These non-greedy repetitions are no longer needed because we now use negative lookahead in the rules that were using them. This is intended to simplify things a little, and lean in on the negative lookahead. There were two alternate interpretations of `R1 -> A E*? S B`: R1 -> A _0 B _0 -> S | (E _0) or R1 -> A _0 _0 -> (S B) | (E _0) Rather than trying to document this subtle interpretation, this chooses to just get rid of it and be explicit about what is not allowed to follow.
Collaborator
|
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds the ability to add a label to a repeat range so that a subsequent expression can match the same repetition. This is used in raw strings where the
#characters must be balanced on both sides, with a limit on the number of matches.This also removes the non-greedy repetitions because they are no longer used.