grammatica-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Grammatica-users] Regex token order


From: Oliver Bock
Subject: Re: [Grammatica-users] Regex token order
Date: Mon, 28 Feb 2011 16:49:32 +1100
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.2.13) Gecko/20101207 Lightning/1.0b2 Thunderbird/3.1.7

I had to do a similar thing, but putting the more specific tokens first in %tokens% worked for me.  From my grammar:

ON = "ON"
VARNAME = <<address@hidden(address@hidden@])?>>

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.

Drew Vogel
_______________________________________________ Grammatica-users mailing list address@hidden http://lists.nongnu.org/mailman/listinfo/grammatica-users


reply via email to

[Prev in Thread] Current Thread [Next in Thread]