-
-
Notifications
You must be signed in to change notification settings - Fork 262
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
WHITESPACE and COMMENT require $ to be compound #966
Comments
Should this be fixed or just documented in the book? I worry that there may be some code depending on this special behaviour |
As this seems pretty unintuitive, it's probably best to fix it in a major release (whenever that happens) and leave a note about this in the book. |
the next major release will likely have a major API and grammar overhaul, so I'm not sure. I opened a draft PR with a fix under a feature flag, but I feel it may not be worth it, especially that it's not the default (i.e. the person needs to be aware of that feature flag in the first place)... some options:
(plus document it in the book) Maybe the last option seems fair, as "grammar-extras" already contains a bug fix for that weird trailing whitespace issue, so people using that flag are aware of these semantic breaking changes and may appreciate a more intuitive default here. |
added a note to the book: pest-parser/book@f4ad611 |
Describe the bug
When writing a whitespace or a comment rule, you require an explicit $ to get the inner rules.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
You expect to get a COMMENT containing a SingleLineComment rule
Additional context
This is useful when you want to do some whitespace and comment preserving grammars. There is a way to do it the expected way:
COMMENT = ${SingleLineComment}
but it isn't written anywhere in the book that COMMENT and WHITESPACE behave differently than any other rules by defaultThe text was updated successfully, but these errors were encountered: