[antlr-interest] Bug? duplicate token type ... when collapsing subrule into set
Zenzike
zenzike at gmail.com
Sat Jan 3 11:56:39 PST 2009
Dear all,
I'm using ANTLR with a rather large grammar, and I'm hitting an error
when I add a particular clause.
I'm not sure if it's a bug, but the grammar below displays the behaviour:
>>>
grammar Buggy;
start : (PROSE|HELLO|WORLD)+;
PROSE : ~('hello' | 'world');
HELLO
: 'hello'
;
WORLD
: 'world'
;
>>>
This is the error I get:
>>>
[19:49:51] Checking Grammar...
[19:49:51] error(204): Buggy.g:6:21: duplicate token type 'world' when
collapsing subrule into set
>>>
If I change either, or both, of the 'hello' or 'world' occurrences in
PROSE, into HELLO or WORLD, then I don't get the error.
I'm reluctant to do this in the actual grammar I'm working with, since
the HELLO and WORLD rules have actions associated to them,
which I don't want to invoke in PROSE.
Does anybody know what is going on here?
Many thanks!
More information about the antlr-interest
mailing list