[antlr-interest] Problem with *

Jens Bartelheimer jens.bartelheimer at gmx.de
Wed Feb 8 13:43:38 PST 2006


Hi again,

has nobody a solution for my problem?

I have recognized that the same problem exist if I define only one 
single token in my rule.

Jens

Jens Bartelheimer wrote:
> Hi,
>
> I am new to antlr and I have a problem with the Star *.
>
> If I only parse a String with a star the first rule recognize the 
> star, the second with a token not.
>
> Why?
>
> 1st:
> ----
>
> getTest
> {
> }
>    :   "*"
>        {
>    System.out.println("Star gefunden");
>        }
>    ;
>
>
> 2nd:
> getTest
> {
> }
>    :   STAR
>        {
>    System.out.println("Star found");
>        }
>    ;
>
> Lexer:
> STAR: '*';
>
> raises: line 1:1: expecting STAR, found '*'
>
>
>


More information about the antlr-interest mailing list