[antlr-interest] How to rewrite rule with optional terms?

fridi70 at gmx.de fridi70 at gmx.de
Mon May 26 13:10:38 PDT 2008


Hi,

if have a grammar like this:

op: queryOp ('>' INT)?;

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