Repository navigation
Conversation
ratmice
commented
Dec 6, 2026
| pub(crate) fn lex_flags(&self) -> &LexFlags { | ||
| &self.lex_flags | ||
| self.lexerdef | ||
| .lex_flags() |
Collaborator
Author
There was a problem hiding this comment.
I don't know if this is better, I guess it might actually go against the point of LexerBuildEnv,
It's a bit weird to have both a Option<LexFlags> and a cloned copy of it in the same struct.
Initially the idea behind the BuildEnv structs is that by the time it's constructed,
all the various Option types have been resolved to Some value.
What I hadn't really payed attention to, is that it is a bit weird in this case, since lexerdef actually owns the value.
Collaborator
Author
There was a problem hiding this comment.
Hmm, the fact that it returns an Option<LexFlags> seems to actually be a historical artifact.
It always returns Some.
Collaborator
Author
There was a problem hiding this comment.
Finally feels much cleaner to me in d8f7b94
This branch has not been deployed
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 is patch is migrates the
build_envfunction in lrlex.Making it return a
Vec<LexerSrcEnvError>instead of storing aVec<HeaderError>in a variant.This is similar to one of the patches for lrpar in #674, in preparation for making lrlex codegen a publicly usable unstable api.
The resulting error handling in
build_env& parts of this patch is not very pretty.I was struggling to find a way to improve it, it seems like it ends up a bit worse without
?But I'm not sure we can do much about it without
tryblocks