[antlr-interest] Re: Problem with existence of the same literal in two rules

vivek bhaskar vivek_bhaskar at hotmail.com
Mon May 5 21:36:34 PDT 2003


Hey ramya,
for default k(=1), in my lexer i have used following and its working fine.
STRING:	('+'|'-')? (DIGIT)+
	|  ('a'..'z' | 'A'..'Z' | '_') ( 'a'..'z' | 'A'..'Z' | '_' | DIGIT |'#' | 
'\\')*
	| '"' (~'"'|'%'|'=')* '"'
	| '\'' (~'\'')* '\''
	;

protected
DIGIT:	'0'..'9'
	;
vivek






>From: "ramyasivadas" <ramyasivadas at yahoo.co.in>
>Reply-To: antlr-interest at yahoogroups.com
>To: antlr-interest at yahoogroups.com
>Subject: [antlr-interest] Re: Problem with existence of the same literal in 
>two rules
>Date: Tue, 06 May 2003 04:31:42 -0000
>
>Hi,
>Thank you so much for your reply.
>Thank you for the efforts you have taken to explain the solution in
>detail.
>I'm trying out the solution.
>
>But when i define the STRING as follows,
>STRING : ('a'..'z' | 'A'..'Z') ('a'..'z' | 'A'..'Z'|INT)*
>the grammar doesn't compile at all.I think it gets caught in an
>infinite loop somewhere. My lookahead is 20. Do i have to change that?
>
>I also tried defining STRING as
>STRING : ('a'..'z' | 'A'..'Z') ('a'..'z' | 'A'..'Z'|INT)+
>Even this gets into an infinite loop.
>
>Can you please suggest me a solution for defining the string.
>
>Thanks in advance.
>
>Regards,
>Ramya
>
>
>
>
>
>Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>


_________________________________________________________________
Find lost friends. Revive old flames. http://www.batchmates.com/msn.asp Only 
on Batchmates.com


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 




More information about the antlr-interest mailing list