[antlr-interest] Java 1.5 grammar error on importDefinition?

Ruben Trancoso rubentrancoso at gmail.com
Fri Mar 9 21:51:19 PST 2007


Looks like ID_PART are still avoiding numbers. I removed the number
range from the ~ part. I dont know if its an already know problem. By
the way...

protected ID_PART :
        '_' | '$' |
        (
            {Character.isLetterOrDigit(LA(1))}?
            ~(
                '_' | '$' | '/' | '*' |
                '.' | '\'' | '\\' | '"' | '\t' | '\n' |
                '\r' | ' ' | '\f' | '(' | ')' |
                '{' | '}' | '[' | ']'| ';' | ',' | '=' |
                '+' | '~' | '&' | '<' | '>' | '-' | '!' |
                '^' | '%' | ':' | '?' | '|' | '@'
            )
        )
    ;


On 3/10/07, Ruben Trancoso <rubentrancoso at gmail.com> wrote:
> http://www.antlr.org/grammar/1147455993609/Java5.zip
>
> I was just parsing some java code to test this grammar and I got the
> following error:
>
> line 16:13: unexpected token: 3
>  Character.isLetter(LA(1))
>        at JavaLexer.nextToken(JavaLexer.java:382)
>        at antlr.TokenBuffer.fill(TokenBuffer.java:69)
>        at antlr.TokenBuffer.LT(TokenBuffer.java:86)
>        at antlr.LLkParser.LT(LLkParser.java:56)
>        at antlr.antlrStudio.ASLLKDebuggingParser.LA(ASLLKDebuggingParser.java:203)
>        at JavaRecognizer.compilationUnit(JavaRecognizer.java:305)
>        at Java.main(Java.java:25)
>
> the import definition in code is:
> import org.w3c.dom.*;
>
> --
> Quando um homem não acredita em Deus,
> não é que não acredite mais em nada -
> é que ele acredita em qualquer coisa.
> (G. K. Chesterton)
>


-- 
Quando um homem não acredita em Deus,
não é que não acredite mais em nada -
é que ele acredita em qualquer coisa.
(G. K. Chesterton)


More information about the antlr-interest mailing list