[Grammar-Kit] define tokens in .bnf which reference other tokens
已回答
Hey,
i am developing a custom language plugin.
I have a .bnf file with declared tokens. The problem is that i can only work with regex within the .bnf file. In the flex file i can reference other tokens e.g.:
https://github.com/JetBrains/Grammar-Kit/blob/master/src/org/intellij/grammar/parser/_BnfLexer.flex
ID_BODY = {ALPHA}
ID = "<" {ID_BODY} ">"
Is there a way to do that within the token attribute from the .bnf file and then generate the flex file?
请先登录再写评论。
https://github.com/JetBrains/Grammar-Kit#tokens defines value for tokens should be constant.
Anyway, generating .flex from bnf is only thought to be used in very initial, prototype-stage development of BNF (or for simulating token in live preview).