[antlr-interest] Range generation in C++ mode

Martin Probst mail at martin-probst.com
Fri Sep 3 08:41:27 PDT 2004


Hello,
I have a beginners question about range generation in C++ mode. When
trying to track down the problem I have I came to this simple grammar:

==== snip ====
options {
	language="Cpp";
}

class SimpleParser extends Parser;
options {
	buildAST = true;
}

expr:
	(ID)+
	;

class SimpleLexer extends Lexer;

WS:
	( ' '
	| '\t'
	| '\n' { newline(); }
	| '\r'
	)+
	{ $setType(ANTLR_USE_NAMESPACE(antlr)Token::SKIP); }
	;

ID:
	(LETTER)+
	;

protected LETTER:
	('\u0000'..'\u00f3')
	;
==== snap ====

I have a simple main file just reading an input file and starting the
Lexer/Parser. It's mainly a direct ripoff from the calc example.

If I run my executable I see the following:
==== snip ====
martin at perseus simple $ ./Main input.txt
Using file input.txt
Hello World out there
Parse exception: <cin>:1:1: expecting token in range: '0x00'..'0x63',
found ''H''
==== snap ====

Somewhere with the Lexer I found this line:
        matchRange('\0','\363');
which I just don't understand. Is this a bug or am I doing something
wrong? I'm writing this on a Linux system with ANTLR 2.7.3 and
gcc-3.3.4.

Regards,
Martin Probst



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
    antlr-interest-unsubscribe at yahoogroups.com

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



More information about the antlr-interest mailing list