intellij-ideabnfintellij-plugingrammar-kit

How to express a lowercase followed by any case char using BNF?


I am trying to learn how IntelliJ Grammar Kit works for creating a BNF

How can I define an identifier that stars with 'v' and then have any case. e.g. 'vModule'.

Here is my attempt:

identifier ::= "v"id

But then, instead of 'vModule', it expects 'v Module'.


Solution

  • You need to include the actual regular expression matching your identifier into the token definition. Something like:

    identifier ::= "regexp:v\w+"