Does JavaCC supports begging of line regex like ‘^’ ?
I have a Token like this
TOKEN: { < ENTRYTK : "DATA"(" ")* > }
Would like it to match only the following regex
^"DATA"[ ]*
I have tried the following which neither works
TOKEN: { < ENTRYTK : "^DATA"(" ")* > }
TOKEN: { < ENTRYTK : ^"DATA"(" ")* > }
No it doesn’t. Use lexical states to ensure that the production is only in play at the start of a newline. Since every file starts with a newline, the default state will be the one for the start of a newline.