-
-
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
Add multiline comments to Pest's PEG format #332
Conversation
If we want this to mirror Rust's block comments, they should probably nest:
You can test by patching a use site to use a path dependency on your local pest (or your git branch). |
Yo, that is awesome! It took me less than 5 minutes to make that work and test it with my project :D (PS: it accepts my multiline comments now c: )
I have no opinion on this, but it sounds better. I didn't think of nested multiline comments, that's probably a pretty good use case. It also makes more sense from the ergonomics standpoint: when I used to work in C#, the multiline comments were as I have just implemented them and it was very weird that a single So, what's missing now are some tests for this, I'd think. Where can I put such a test? Something like a couple of example grammars with multiline comments would be nice to have as a test :) |
Now I've uploaded an update that makes multiline comments nestable. Thanks @CAD97 ^^ |
- Add multiline comment to PEG's format grammar, at COMMENT pattern's definition - Add test for single line comments - Add test for multiline one-line comments - Add test for multiline n-line comments - Add test for nested: --: Single line in multiline --: (Multiline in) multiline --: Invalid grammar pattern definition inside multiline
Now that it has tests, I think the PR is ready for review. What do you think? This is what's implemented:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for working on this! Everything looks good, but I'd like to ask a favor: will you please symlink all *.pest
files from derive/tests
in vm/tests
so they don't have to be updated separately? As I said before, my testing can get sloppy sometimes...
Sure, I can do that. But is that something related to this PR (like, something I might have broken), or is it something else that the repo needs and hasn't been done yet? If it's the second, then maybe it should be done in a separate PR? To separate these two additions and all that. Or maybe just in a separate commit, and then we can merge two commits with the same PR. What do you think? |
It should be a separate PR, yes, but it's a very small change I'd hoped to get away with. 😃 We're currently not squashing PR commits before merging, so the whole history is there. |
Hahaha, okay 😄 Something like: "for each file |
Yes, but only the |
Okay, I'll add it :) |
Added! :) |
bors r+ |
332: [WIP] Add multiline comments to Pest's PEG format r=dragostis a=felix91gr Implementation of #330. At least, that's what I think. Probably needs tests. How do I make one, or update the existing ones? And how can I test it manually? Thanks <3 Co-authored-by: Félix Fischer <[email protected]> Co-authored-by: Félix Fischer <[email protected]>
Build succeeded |
Wooo :D |
⛵ |
Implementation of #330. At least, that's what I think.
Probably needs tests. How do I make one, or update the existing ones?
And how can I test it manually?
Thanks <3