[antlr-interest] Problem with a simple grammar

Hrvoje Nezic hrvoje.nezic at envox-lab.hr
Mon Nov 11 00:34:11 PST 2002


Hi, I am relatively new to ANTLR. I have already successfully written
nontrivial grammars. However, I tried a very simple example
(which follows below), and it fails. It parses lines of the form:

    private static final ;

When I give it the input:

    private static final ;
    private static final ;

I get the following error:

    line 1:1: unexpected char: 'p'

Am I doing something wrong or is it a bug?

Thanks,
Hrvoje Nezic

options {

language = "CSharp";

}

class TestParser extends Parser;

test

:

( testLine )*

;

testLine 

:

"private" "static" "final" SEMICOLON

;

class TestLexer extends Lexer;

WS : 

( ' '

| '\t'

| '\n' { newline(); }

| '\r' 

)

{ _ttype = Token.SKIP; }

;

SEMICOLON

:

';'

;



 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list