-
Notifications
You must be signed in to change notification settings - Fork 106
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
Re-usable parsers #25
Comments
You might be able to do that by importing the internal |
Yeah, @untitaker's correct; it would have to call the private Another potential issue is that I plan to add a facility for a grammar to have a state object threaded through all the parse rules, for things like string interners, filenames for source maps, etc. It would have to ensure both grammars have the same type of state object so they're compatible. |
I thought it wouldn't be that easy, too bad. Are you planning on adding such functionality in the near future? One more thing, it would be awesome to allow to import some stuff into the parser and making it available for the whole. Else I have to write long statements like |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
Probably the way to do that is to introduce another macro, say, |
Assume I define a few parsers within a module and export the parsing functions, similar like the following:
I'm wondering if it is possible to reuse the exporter parser in another module in another PEG macro call. In general, I'm interested in reusing parsers defined in different source files.
Any ideas?
The text was updated successfully, but these errors were encountered: