[antlr-interest] Strange parse result

Søren Kristiansen sorenkris at gmail.com
Fri Jan 14 07:30:18 PST 2011


Hi Mark,
Without the space before ':=', 15: will match your
RULE_ABSTRACT_LITERAL rule and then '=' can't be
matchted.

Regards
   Soren

2011/1/14 Mark Christiaens <mark.christiaens at sigasi.com>

> I have a small test grammar:
>
> grammar test_grammar;
>
> testrule : t*;
> t: RULE_EQUALS | RULE_ABSTRACT_LITERAL | RULE_WS ;
> RULE_EQUALS : ':=';
> RULE_ABSTRACT_LITERAL : ('0'..'9')+ (':' ('0'..'9')+ ':')?;
> RULE_WS : (' '|'\t')+;
>
>
> When I debug this grammar (with ANTLRWorks 1.4.2 using ANLTR 3.3) I feed it
> the input (no spaces)
>
>
> 15:=0
>
>
> and it doesn't parse my input correctly.  When I change the input to
> (adding
> space before ':=')
>
> 15 :=0
>
> it parses successfully.  Any ideas what I'm missing here?
>
> Mark
> --
> <http://www.sigasi.com>
> Mark Christiaens, PhD
> Expert Research Engineer
> www.sigasi.com
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe:
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>


More information about the antlr-interest mailing list