Rewrite Charset so that it uses Expression#2190
Draft
ehuss wants to merge 1 commit intorust-lang:masterfrom
Draft
Rewrite Charset so that it uses Expression#2190ehuss wants to merge 1 commit intorust-lang:masterfrom
ehuss wants to merge 1 commit intorust-lang:masterfrom
Conversation
This removes the `Characters` type, and instead uses `Expression`. There was a lot of overlap with `Expression`, and this simplifies things a little bit and removes some duplication. This also helps with some future changes I am working on that do coverage analysis, and this makes it easier to track coverage data for the different character values. The downside is that without the enum it isn't clear from the code what limitations there are with `ExpressionKind::Charset`, or that `ExpressionKind::CharacterRange` should only be in a `Charset`. These are implicit based on how the parser works. I'm willing to make that tradeoff. The `Characters` map as: - `Characters::Named` to `ExpressionKind::Nt` - `Characters::Terminal` to `ExpressionKind::Terminal` - `Characters::Range` to the NEW `ExpressionKind::CharacterRange` This incidentally fixes a small oversight where `Characters::Named` was missing span with the `grammar-text` class.
Contributor
Author
|
Opening as a draft as I'm not 100% confident that this is the right tradeoff to make. It would be nice if the type system could enforce the constraints, but I don't see an alternative way to do that which is any better than this. |
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 removes the
Characterstype, and instead usesExpression. There was a lot of overlap withExpression, and this simplifies things a little bit and removes some duplication.This also helps with some future changes I am working on that do coverage analysis, and this makes it easier to track coverage data for the different character values.
The downside is that without the enum it isn't clear from the code what limitations there are with
ExpressionKind::Charset, or thatExpressionKind::CharacterRangeshould only be in aCharset. These are implicit based on how the parser works. I'm willing to make that tradeoff.The
Charactersmap as:Characters::NamedtoExpressionKind::NtCharacters::TerminaltoExpressionKind::TerminalCharacters::Rangeto the NEWExpressionKind::CharacterRangeThis incidentally fixes a small oversight where
Characters::Namedwas missing span with thegrammar-textclass.