1

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

Johnny Everson
  • 8,343
  • 7
  • 39
  • 75

1 Answers1

1

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

identifier ::= "regexp:v\w+"
yole
  • 92,896
  • 20
  • 260
  • 197
  • thanks. Is there any alternative way to combine tokens to make them a single token? e.g. when they are complex to be captured as a single regex. – Johnny Everson Jan 18 '16 at 13:07