[antlr-interest] ANTLR NUB

Gavin Lambert antlr at mirality.co.nz
Mon Jan 21 23:41:15 PST 2008


At 19:25 22/01/2008, Jan Nielsen wrote:
 >
 >I initially envisioned having repeated exclusion and inclusion
 >clauses but I don't think I need to support it now

If you want them, it's pretty straightforward.  Just change the 
prog rule to this:

prog
     : 'from' date ('to' date)? (exclude_clause | include_clause)* 
EOF
     ;

This will permit any number of include and exclude clauses in any 
order.

 >day_of_week_period
 >    : DAY_OF_WEEK ('[' occurrence ']')? ('-' DAY_OF_WEEK)?
 >    ;

If "Monday[3]-Wednesday" doesn't make sense (and I'm not sure how 
it could), you could possibly change this to:

day_of_week_period
     : DAY_OF_WEEK ('[' occurrence ']' | '-' DAY_OF_WEEK)?
     ;

This will permit only one (or neither) of the two options to be 
specified.



More information about the antlr-interest mailing list