[antlr-interest] ANTLR 3.1 gives RewriteEmptyStreamException, ANTLR3.0.1 does not ?
Terence Parr
parrt at cs.usfca.edu
Mon Sep 29 13:19:02 PDT 2008
On Sep 29, 2008, at 12:43 PM, David Pearce wrote:
> Hi Terence,
>
>>> The reason is that the empty production has no rewrite. However, in
>>> ANTLR 3.0.1, this error did not happen.
>>>
>>> So, my question is: is this is a bug, or intentional behaviour? I
>>
>> hi!
>>
>> It is proper behavior; if there is no listBody then list must
>> indicate
>> there is an error.
>
> Just to be clear here --- you're saying this behaviour exhibited in
> ANTLR 3.0.1 was entirely broken?
Yes. you must use
> list : '(' listBody ')' -> ^(LIST listBody?)
not
> list : '(' listBody ')' -> ^(LIST listBody)
clearly listBody can be optional, right?
>> This seems clumsy, since neither the X or Y tokens are actually
>> needed
just use ? :)
Ter
More information about the antlr-interest
mailing list