Skip to content

new Parser, missing lex #90

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

Open
Mike-3 opened this issue Feb 8, 2025 · 3 comments · May be fixed by #91
Open

new Parser, missing lex #90

Mike-3 opened this issue Feb 8, 2025 · 3 comments · May be fixed by #91

Comments

@Mike-3
Copy link

Mike-3 commented Feb 8, 2025

Is there an alternative for the lex function in the new parser? I couldn't find anything suitable?

Great library. Thanks for expanding the functionality. It's also super fast.

@fkleon
Copy link
Owner

fkleon commented Feb 8, 2025

Hi @Mike-3, thanks for the praise, always great to hear from users! 😄

You're right, the new parser does not expose the tokens (intermediate representation) of the parsed expression in any way. This is due to this implementation relying on petitparser which does not use a traditional lexer but a parsing expression grammar (PEG) instead.

I considered the lexer an internal implementation detail of the parser, so have not maintained any sort of backwards compatibility there. However I'm curious to hear what your use case is?

@Mike-3
Copy link
Author

Mike-3 commented Feb 8, 2025

In this case, I used it for a verbal arithmetic solver and used the functionality to determine the available variables. But I'm sure I can do that some other way.

https://github.com/GCWizard/GCWizard/blob/aa2d8ce3fb67be61212f6c12b2ae84edf0bbac4c/lib/tools/games/verbal_arithmetic/logic/helper.dart#L76

@fkleon
Copy link
Owner

fkleon commented Feb 8, 2025

That makes sense. I was planning to implement #73 soon which would solve that particular issue.

@fkleon fkleon linked a pull request Feb 13, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants