Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

.. can never be matched as ..

53 views
Skip to first unread message

Walter Milner

unread,
May 17, 2013, 12:25:36 PM5/17/13
to
My grammar includes:
TOKEN : { < CONSTANT : (["0"-"9"])+ > }
TOKEN : { < VARIABLE : ["x"-"z"] > }
TOKEN : { < TERM : <CONSTANT> | <VARIABLE> > }
but I get warning Regular expression choice : CONSTANT can never be matched as : TERM
Why not?
How come
12
would not be a term, since it is a constant?
Aplogies for my lack of a brain

bblla...@gmail.com

unread,
Jun 26, 2013, 4:54:04 AM6/26/13
to
Considering the order of token definitions, the token TERM will never match anything, because it was already matched by the CONSTANT/VARIABLE definitions itself.

If you want to use tokens only within other tokens, use the following definition:

<#MY_TOKEN_PART: "bla">
<MY_TOKEN: <MY_TOKEN_PART> "blu">

Hope that helps.
0 new messages