[antlr-interest] How to rewrite rule with optional terms?
Terence Parr
parrt at cs.usfca.edu
Mon May 26 13:13:04 PDT 2008
On May 26, 2008, at 1:10 PM, fridi70 at gmx.de wrote:
> Hi,
>
> if have a grammar like this:
>
> op: queryOp ('>' INT)?;
>
trySomething like:
op : queryOp ('>' INT -> ^('>' queryOp INT) | ->^('>' queryOp
INT["0"])) ;
> INT: DIGIT+;
>
> fragment
> DIGIT: '0'..'9';
>
>
> I want to rewrite the rule op in a manner that it adds '>' and '0'
> as children to the root if '>0' is missing.
>
> How can I achieve this? Thanks in advance, fridi
>
> --
> Psssst! Schon vom neuen GMX MultiMessenger gehört?
> Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger
More information about the antlr-interest
mailing list