-
Notifications
You must be signed in to change notification settings - Fork 6
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
fix: comment and discard are treated as whitespace in most macros #75
Conversation
On a related note for using
To spell things out, in this example, between So perhaps Although old, here is an example from the wild: https://github.com/technomancy/swank-clojure/blob/master/src/swank/util/class_browse.clj#L64 |
If that path is taken, I guess that may have consequences for "reconstructing" source. That is, if
to reconstruct the source string using May be something like this:
|
@sogaiu thanks a lot for the input. Totally didn't consider the case of |
I did a bit of testing and I think symbolic might benefit from having
https://github.com/carocad/parcera/blob/master/src/Clojure.g4#L134 |
fix: ignore input after metadata entry fix: ignore input between symbolic dispatch and symbol
In general, I was trying to see which patterns would work best for parsing metadata. Since (by now) it is quite a complex rule I wanted to avoid making it too complex. On second thought it probably would be better to stick with the way it was before just to avoid a more complex metadata-entry.
By all means, feel free to report issues as you see them. In this case, all these issues were related to each other so I want to fix them together. If you find an issue that is not related to this discussion then I would move it to another PR/release 😉 |
Thank you. I very much appreciate the explanation. Regarding other (I think mostly unrelated) things, I will create new issues. |
I have done a bit more testing and it looks to me at the moment like reader conditionals and the splicing reader conditionals don't allow any discards or comments to be between the initial
So it looks like
and executing it via
Is this what you see too? FWIW, I verified separately for var quote, discard, tag and eval that they do seem to allow each of discard, whitespace, and comment:
However, since the grammar is more permissive in various ways anyway, may be there is nothing to be done? |
hey, @sogaiu thanks a lot for the extra testing. Totally didn't notice that case.
In general, what I try to do in parcera is to keep it as close as possible to the "real grammar" so that it can be useful for non-Clojure developers (just use antlr4 and generate to your favorite language). So whenever possible I would stick to a more strict rule. |
Thank you for the explanation. |
fixes #74