[GrammarKit] Store parsed token in Psi class
I have the following rule:
Def ::= ('val' | 'var') PatternDef
class which represents 'Def' rule doesn't contain tokens, it contains only PatternDef reference.
Is there a way to make GrammarKit generator to store which token ('var' or 'val') was matched?
Right now I have to do this:
Def ::= 'val' ValDef | 'var' VarDef
Thanks.
Please sign in to leave a comment.
Hi Sergiy
For my opinion the prefered way is:
But your original variant is also possible. You can use com.intellij.psi.formatter.FormatterUtil#getPreviousNonWhitespaceLeaf and understand what the token type placed before PatternDef.