On 2005-04-19 D. R. E. Moonfire  wrote:
>Related to this, how do I get the following to work?
>
>   %tokens%
>   CONSTRAINT = "CONSTRAINT"
>   IDENTIFIER = <<[a-zA-Z_\$][a-zA-Z0-9_\$]+>>
>   %production%
>   bob = CONSTRAINT IDENTIFIER
>
>where "CONSTRAINT CONSTRAINT" is given as the text. Right now, it keeps 
>telling me that it expects IDENTIFIER but it got the constraint token 
>instead.

Well, this is actually expected... :-)  Thing is, the tokenizer is completely 
context-insensitive. So it generates a flow of tokens from your input chars
all by itself without caring about the current production. And as the 
CONSTRAINT token is placed above the IDENTIFIER token in the list of
token definitions, it is chosen.

The fix here, if you really mean that a constraint can be called CONSTRAINT,
is to change the production:

bob = CONSTRAINT (IDENTIFIER | CONSTRAINT) ;

Or even nicer:

Bob = CONSTRAINT String ;

String = IDENTIFIER
       | CONSTRAINT ;

Hope this helps!

/Per






_______________________________________________
Grammatica-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/grammatica-users

Reply via email to