Limit token length
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Bogdan_Stanca
Posted On:   Monday, March 1, 2004 04:02 AM

Hi folks,

I need a token length limitation for an int inside the Lexer:

			
DIGIT : ('0'..'9') ;
INTEGER : DIGIT{4} ;


this should mean

			
DIGIT : ('0'..'9') ;
INTEGER : DIGIT DIGIT DIGIT DIGIT;


Does anybody know if that's possible ?

Re: Limit token length

Posted By:   Monty_Zukowski  
Posted On:   Tuesday, March 2, 2004 08:24 AM


DIGIT : ('0'..'9') ;
INTEGER : DIGIT DIGIT DIGIT DIGIT;

would work fine. If you have to limit the length interactively (after compile time) then you will have to write action code which counts the calls to DIGIT and checks to make sure it was the right length at the end.
About | Sitemap | Contact