I'm trying to parse a line like this:
ONMOGOSUB10
(you can read it as: ON MO GOSUB 10)
MO, in this case, is a variable name, while ON and GOSUB are keywords.
However, my grammar is reading MOGOSUB as if it was a variable name.
My grammar is like this (simplified):
start
= "ON"i ws expression ws "GOSUB"i ws number
number
= [0-9]+
expression
= [a-zA-Z]+
keyword
= "GOSUB"i
ws
= " "*
How can I make the "expression" rule not greedy in relation to keyword?
Thanks in advance,
Rafael.
start
= "ON"i ws expression ws "GOSUB"i ws number
number
= $[0-9]+
expression
= $(!keyword [a-zA-Z])+
keyword
= "GOSUB"i
ws
= " "*