I've a problem with tokens definition.
here is my grammar.
r: PROPNAME ':' PROPVALUE
PROPNAME: [a-zA-Z]+
PROPVALUE: [a-zA-Z0-9]+
if I use
name:christof123 it match
if I use
name:christof it doesn't match
Arguing 'christof' is PROPNAME lexer when PROPVALUE waited since 'christof' matches both PROPVALUE & PROPNAME expressions.
But I don' want matching on
name123:christof
Any Idea?
Like you said, the lexer will match christof with PROPNAME because that comes first in your definition that will match the longest. You can check the matches using
grun
.Your grammar produces the below matches which gives the error.
So modifying your grammar to the below would solve.
Which produces the following match with grun.