[antlr-interest] similar constructs using '[' ']'

Marc Bischof atlan at gmx.li
Thu Jul 10 23:52:32 PDT 2008


Hej List,

I'am confused about the following, may be you can give me a hint.

I have two similar constructs using '['  ']'.
One which represents an extended expression (using nongreedy wildcard) and one 
which contain some other stuff.

Now every time I want to use the sequence rule the EXT_EXPR is invoked.
Is it possible to keep that modelling?

sequence 
	:	('[' j+=join? s+=signal* ']')? b=body  ;

join
	:	'join' '(' k+=ID (',' k+=ID)* (',' expr)? ')' -> ^(JOIN $k+ expr?);

expr	
	:	s_expr | EXT_EXPR | funct_call;

EXT_EXPR
	:	'[' (options {greedy=false;} : .)* ']';

Cheers Marc


More information about the antlr-interest mailing list