[antlr-interest] [BUG] 3.0b4 no complaint on parser reference to lexical fragment
John B. Brodie
jbb at acm.org
Sun Nov 12 16:21:54 PST 2006
on Mon, 13 Nov 2006 00:45:31 +0100, Kay Roepke wrote:
>On 13. Nov 2006, at 0:38 , John B. Brodie wrote:
>
>> Sorry if this is a duplicate.
>>
>> This incorrect grammar draws no error report from org.antlr.Tool
>
>Neither should it, IMHO.
>
>Yes, it will fail to recognize just 'c' as input, but ANTLR can't be certain
>that you didn't have any actions that explicitely set the token type to C in
>some other rule.
i have declared C to be a fragment, doesn't fragment mean "part of" ? aren't
fragments meant to be internal to the lexer. does it make sense for C to be an
internal "part of" one token and then be the whole of (via set token type) of
another token ?
>Throwing an error here would mean that you couldn't reference any tokens from
>a @tokens section, for instance.
(i am not aware of a @tokens section, to you mean tokens{...} (no @) ?)
sounds like an unfortunate mixing of functionality between fragment and the
tokens{...} section
More information about the antlr-interest
mailing list