Hello,

I have a lexer with the following rules:


LBMINUSGT                  : '[->';
LBASRB                     : '[*]';
LBAST                      : '[*';
LBEQUALS                   : '[=';
LBPLUSRB                   : '[+]';
LBRACE                     : '{';
LBRACKET                   : '[';
MINUS                      : '-';

The lexer fails(with an error message) when any string of '[-' or '[*' is
detected. I'm confused why ANTLR cannot tokenize '[-' correctly as LBRACKET
MINUS. It also discards two characters after the failed token. I do not have
a static k defined and ANTLR generates no warnings when compiling. I'm still
debugging but it's slow figuring out how the antlr3dfapredict() function
works. Any help is appreciated.


Test input:
foo[-1]
foo[->saf]
foo[*saf]
foo[+saf]
foo[+]saf]
foo[0]

Test output :
frag.v(1) : lexer error 1 :
        Unexpected character at offset 5, near '1' :
        1]
Token:     SIMPLE_IDENT foo
Token:     SIMPLE_IDENT foo
Token:        LBMINUSGT [->
Token:     SIMPLE_IDENT saf
Token:         RBRACKET ]
Token:     SIMPLE_IDENT foo
Token:            LBAST [*
Token:     SIMPLE_IDENT saf
Token:         RBRACKET ]
Token:     SIMPLE_IDENT foo
Token:     SIMPLE_IDENT f
Token:         RBRACKET ]
Token:     SIMPLE_IDENT foo
Token:         LBPLUSRB [+]
Token:     SIMPLE_IDENT saf
Token:         RBRACKET ]
Token:     SIMPLE_IDENT foo
Token:         LBRACKET [
Token:           DECNUM 0
Token:         RBRACKET ]

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to