[antlr-interest] Look ahead for the end of rule token

Marian Nedelescu mnedelescu at versasys.com
Mon Dec 29 10:15:52 PST 2008


Hi,

 

I need to parse xdoclet tags that start with @ and doesn't have any end
token.

What I know is that this tag end at EOF or when another tag starts with
'@'.

How can I specify that the ending token of the rule is '@' and then to
put is pack or to look ahead to the next token?

 

I have tried this:

grammar Test;

start :     xdoclet_statement*

      ;

 

xdoclet_statement

      :     '@' (options {greedy=false;}:.)*  END

      ;

 

END   :     ~'@'

      ;

 

 

But it didn't work.

 

Thanks,

Marian

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20081229/51c4dad4/attachment.html 


More information about the antlr-interest mailing list