Skip to content
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

How to write conditional rules? #84

Open
tamlok opened this issue Dec 1, 2024 · 2 comments
Open

How to write conditional rules? #84

tamlok opened this issue Dec 1, 2024 · 2 comments

Comments

@tamlok
Copy link

tamlok commented Dec 1, 2024

Hi,

I am writing a markdown parser. As what we know, there are some feature extensions to the standard markdown grammar. So I want to provide some macros as switches and only compile a certain rules based on the switch.

One solution might be evaluating a C code expression as a precondition check.

I am trying to rewrite the PEG parser here in PackCC and it has the ability to use a C code expression as a precondition check: https://github.com/vnotex/peg-markdown-highlight/blob/20f17c03969a1655c39536bf78f3ee5c2a9dd9f7/pmh_grammar.leg#L97

What is the right way to do it in PackCC?

Thanks!

@arithy
Copy link
Owner

arithy commented Jan 21, 2025

Hello @tamlok , sorry for the late reply.
Currently, PackCC cannot provide a suitable solution. I recognize it's a big issue considering the indent-based grammar such as Markdown and Python (#79). I'm now developing a new feature to solve this. It may take a few months to release it.

@tamlok
Copy link
Author

tamlok commented Jan 22, 2025

Hi @arithy , great to hear from you again!!! I am now all in the packcc in my project :)

Thanks for your work! Look forward to it.

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

No branches or pull requests

2 participants