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.
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
.