[antlr-interest] if/else if/else vs. if/elif/else
    st3 
    stempuro2 at gmail.com
       
    Thu Sep  2 09:45:54 PDT 2010
    
    
  
Hi,
I have defined a simple if/else if/else rule (below):
ifExpr	:	'if' LRND ifCond=rightExpr RRND ifBlock=block
		('else if' LRND elifCond+=rightExpr RRND elifBlock+=block)*
		('else' elseBlock=block)?
this throws the following error:
mismatched character '{' expecting 'i'
extraneous input '}' expecting 'return '
I can solve it by changing 'else if' to 'elif' - as clearly 'else if' and
'else' are confusing the lexer/parser.
However, I was hoping to have the easer-to-read 'else if'.
Can someone suggest how I can accomplish that?
I tried the syntactic predicate ('else if')=> - but that did not work.
Thank you!
-- 
View this message in context: http://antlr.1301665.n2.nabble.com/if-else-if-else-vs-if-elif-else-tp5491890p5491890.html
Sent from the ANTLR mailing list archive at Nabble.com.
    
    
More information about the antlr-interest
mailing list