-
Notifications
You must be signed in to change notification settings - Fork 78
Should comments be treated as whitespaces? #54
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
Comments
Whitespaces and comments are different things. Why handling them as the same object ? Is it not simpler (user-side) to have options for both ? Note that in most languages, comments are handled per rule. This is an example in C, where two comments have different side-effects:
I do not know if it is possible at all, but letting user provides a set of rule names indicating which rules may (not) be broken by a comment seems to fix a lot of problems too. |
Can you elaborate more on this please. Not sure that I follow. If I understand the example with C you are implying that comment between
This is the default behaviour. Regex can't be broken by a comment or whitespace. It is in a sense atomic. |
Please do not treat comments as whitespace:
|
@igordejanovic In fact, one of the things that I miss the most is not having access to the comments, for example, when transpiling things. We just lose the comments. I would like to have a flag to conserve them. |
@fzipi Totally agree. Actually, that is something I had been planning for quite some time. It requires some work in the Arpeggio. I thought that the issue for this is already registered in the tracker but it seems that I was wrong. Please feel free to register the feature request. |
@igordejanovic Super, will do! Thanks for your support :) |
Created textX/Arpeggio#56. |
textX/Arpeggio treat comments in a special way. More specifically,
noskipws
rule modifier will disable whitespace skipping but will leave comments skipping in place which may lead to some gotchas.If comments should be treated like whitespaces than
noskipws
would mean don't skip whitespaces and comments. This would be a backward incompatible change. This would also mean that comments should be handled manually innoskipws
rules.This issue is created as a poll to gather feedback from the community. Please vote with emoji thumbs up/down.
The text was updated successfully, but these errors were encountered: