[antlr-interest] Having trouble with creating a parser for my desired grammar. Running afoul of multiple alternatives warnings

Jarrod Roberson jarrod at vertigrated.com
Wed Nov 16 11:45:47 PST 2011


On Wed, Nov 16, 2011 at 2:39 PM, Bart Kiers <bkiers at gmail.com> wrote:

> On Wed, Nov 16, 2011 at 8:38 PM, Bart Kiers <bkiers at gmail.com> wrote:
>
>> Hi,
>>
>> On Wed, Nov 16, 2011 at 8:21 PM, Jarrod Roberson <jarrod at vertigrated.com>wrote:
>>
>>>
>>> actually thanks to Bart I need the FLOAT rule as a parser rule with the
>>> predicate because I want to be able to match
>>
>>
>> But John raises a valid point that I didn't mention: by "promoting" such
>> a rule to a parser rule, you run the risk that the parser matches a
>> `number` rule for the input source: "123   .   5" (spaces around the '.')
>> because the parser ignores the white spaces.
>>
>
> Or even the input: "123 /* some comments */ . /* more comments */ 5" would
> be a valid `number`... :)
>

Is there a way to support both

a -> 1.
b -> 1.1.

in a pure lexer rule then, I didn't think there was?

-- 
Jarrod Roberson
678.551.2852


More information about the antlr-interest mailing list