[antlr-interest] Simple questions

elimesika elim at tti-telecom.com
Sun Feb 24 08:29:48 PST 2002


HI

I have two simple questions:

1) my grammer should recognize the char '!', I have a "connect!" 
command that I should identify. I have tried to define it in the 
Tokens area :

tokens {
	CONNECT = "connect!";
}

and got a run time error. 
Writing
tokens {
	CONNECT = "connect\!";
}
gives an antlr compilation error.
I am using (in the Lexer option section): 
	charVocabulary = '\3'..'\377';
How can I handle that ???

2) I am reading a file written in a certain language.
   I have to recognize only a subset of the language, but I want to 
keep the statements that I am not recognizing.
I have tried to use the filter option and an IGNORE rule :

options {
	k=2;
	filter=IGNORE;
	charVocabulary = '\3'..'\377';
}

protected
IGNORE
	:	c:.
		{System.out.println(c);}
	;

I don't get any printing when I type things that the parser don't 
recognize.
Does anybody knows what's the problem or have a better way to do that?

TIA
     Eli




 

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



More information about the antlr-interest mailing list