If I remove the TEXT token definition and the reference in the Item production, the remaining grammar does properly match the first line and I get a parse error at the new line character (as expected). Why does the introduction of my TEXT token override those previously-matching tokens, even though it is listed last in the %tokens% section?
On Sun, Feb 27, 2011 at 11:49 PM, Oliver Bock <address@hidden> wrote:
I had to do a similar thing, but putting the more specific tokens
first in %tokens% worked for me. From my grammar:
The text "ON" could match both these tokens, but for me ON matches,
not VARNAME. I suggest you cut your example down into a very simple
grammar (like the above).
Oliver
On 28/02/2011 4:37 PM, Drew Vogel wrote:
If I have two regex tokens A and B and A is a subset
of B, how do I disambiguate them such that A will always be tried
before B? The order they appear in the %tokens% section does not
seem to affect this and I did not see an example of this in the
documentation.
The parser I am trying to construct is for a template-like
language with commands embedded in text. Thus I have a "text"
token regex <<.+>> to match everything not otherwise
matched as a command, but I only want to match it after all
other token regex patterns have been tried.