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

Should we have comments in BNF? #337

Open
ris58h opened this issue May 22, 2023 · 0 comments
Open

Should we have comments in BNF? #337

ris58h opened this issue May 22, 2023 · 0 comments

Comments

@ris58h
Copy link

ris58h commented May 22, 2023

PsiBuilder ignores whitespace and comment tokens but we have to use comment token in BNF just to have corresponding IElementType generated.

Even the official documentation for Custom Language has it as example: private item_ ::= (property|COMMENT|CRLF).

In my own grammar I've ended up with an 'orphan' rule and it works fine: private comment ::= COMMENT

If comment tokens doesn't add anything to a parser, shouldn't we stop using them as we do for whitespace tokens. Of course they are necessary for corresponding IElementType generation but we could use an 'orphan' rules for them or even have a predefined com.intellij.psi.TokenType.

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

1 participant