Using '-' and ':' in a token
1 posts in topic
Flat View  Flat View

Posted By:   Jeffrey_Campbell
Posted On:   Tuesday, March 12, 2002 04:18 AM

I am implementing a specified grammar that has tokens in it like "agent-id" and ":sender".

The only way to get them to parse with out error is to split up the tokens like this...

"agent" DASH "id"

COLON "sender"

where DASH and COLON are defined in the lexer. It would be much better for the project if I can leave the tokens whole - is there a way to do this?

The error received is - line 1: expecting "agent-identifier", found 'agent'



Re: Using '-' and ':' in a token

Posted By:   Monty_Zukowski  
Posted On:   Wednesday, March 13, 2002 06:29 AM

Your ID rule must have the '-' and ':' in it. What happens is that the ID is matched and at the end of the rule it is compared to the literal table. If it's in the literal table the type is changed. Obviously if you aren't matching '-' and ':' in your ID rule then you don't have the whole token when you are doing the lookup in the literals table.
About | Sitemap | Contact