[antlr-interest] Specifying optional elements in a tree grammar.
Gavin Lambert
antlr at mirality.co.nz
Wed Mar 25 12:08:50 PDT 2009
At 06:12 26/03/2009, Jim Idle wrote:
>> )? ->^(SELECTCLAUSE selectClause ^(INTOCLAUSE intoClause)?
>> ^(FROMCLAUSE fromClause)? ^(WHERECLAUSE whereClause)?);
[...]
>>querySpecification :
>> ^(SELECTCLAUSE selectClause ^(INTOCLAUSE intoClause)?
>> ^(FROMCLAUSE fromClause)? ^(WHERECLAUSE whereClause)?)
>> ;
[...]
> ^(SELECTCLAUSE selectClause (^(INTOCLAUSE intoClause))?
> (^(FROMCLAUSE fromClause))? (^(WHERECLAUSE whereClause))?)
>
>Because the ^( xxxxx) is a tree specification and needs to be
>enclosed to make it optional.
Interesting that it seems to work in the rewrite specification,
though. Shouldn't they be consistent? (It's debatable which way
is "better", but it's just confusing if they're different.)
More information about the antlr-interest
mailing list