On Fri, 2008-11-14 at 13:05 +0100, Hendrik Maryns wrote:

> Hendrik Maryns schreef:
> > Hi all,
> > 



> > The bare rule would be:
> > /**
> >  * Conjunction or disjunction.
> >  */
> > n_ary returns [Formula result]
> >     : CONJUNCTION ( WHITESPACE formula )+
> >     | DISJUNCTION ( WHITESPACE formula )+
> >     ;
> > 
> > And for CONJUNCTION I would like new Conjunction(Formula... args) to be
> > invoked with the formulas found (ignoring whitespace).  Similar for new
> > Disjunction(Formula... args).  As you might guess
> > 


I am not sure what your Formula class is, but the two patterns are:

n_ary returns [Formula result]

@init {
   $result = new Formula();
}
 : CONJUNCTION ( WHITESPACE f1=formula   { $result.add($f1); } ) +


And

n_ary returns [Formula result]

: CONJUNCTION ( WHITESPACE f1+=formula    ) +  { $result = new
Formula($f1); } // f1 is  a list


JIm

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---

List: http://www.antlr.org:8080/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org:8080/mailman/options/antlr-interest/your-email-address

Reply via email to