-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add CTBuilder
options for setting behavior of regex.
#400
Conversation
Like you, I think, I'm not 100% sure what the right approach here is. One thing that occurs to me looking at the code is that the |
Yeah, I guess the main benefit (which I entirely forgot to implement) of the approach that I took is that we can implement |
While i've implemented some cleaned up code as per above. I ran into some issues that I hadn't taken into consideration. At the moment don't really see a way to implement the parsing aspects without changing the trait to accept a associated type for options along with the lexer sources. Given the current lack of a motivating use case I'm not sure it's worth breaking compatibility over? The one thing I guess I note that seems noteworthy is that the call here: https://github.com/softdevteam/grmtools/blob/master/lrlex/src/lib/ctbuilder.rs#L329 is using a concrete type instance rather than e.g. a trait object, so perhaps we could provide a instance like I'll have to have a think on those aspects a bit more, but it seems difficult to pull off without breaking semver compatibility. Edit: I probably didn't do a good job of explaining the issue, e.g. |
Hmm, I hadn't thought about that either! |
FWIW I put the attempt at using normal builder style here: https://github.com/ratmice/grmtools/tree/regex_options_take_2 |
Think i'll just close this one for now. |
Do you think this route can work? I'm not quite sure if it suffers from the problem you mentioned above or not. |
Yeah, it still does suffer from that problem. The main missing piece of it is that there is no way to call the |
Hmm, yes, I don't have an immediately good answer to that :/ |
Yeah, i'm pretty hesitant to make such API changes without a real motivating use case, so I don't think there is any immediate need. But I do plan on tinkering with a few potential things to see if I can come up with anything that seems worthwhile. |
This is a patch that I discussed in #399
It is still missing some odds and ends, e.g. it only currently works with
CTLexerBuilder
and is missing support within the runtime builders. But it seemed a worthwhile place to stop and ponder if this is a viable approach. I tried to do it using a mechanism that allows us to avoid adding a new builder function for each regex setting, It seemed at least worth trying however i'm not sure how I feel about how the actual calls toRegexBuilder
now look.This isn't something that I really need, or seems to be blocking anything to my knowledge, so that alone should maybe induce some skepticism about the idea.
quote::ToTokens
trait instead ofDebug
?