=?gb2312?q?=BB=D8=B8=B4=A3=BA=20[antlr-interest]=20Strange=20report=20on?= =?gb2312?q?=20console?=

=?gb2312?q?=CB=EF=BC=CD=B8=D5=20Jigang=20(Robert)=20Sun?= sunjigang1965 at yahoo.com.cn
Thu Jul 20 05:56:36 PDT 2006


I suppose the rules is parser rules. Could "File" be recognised as a token by you lexer? I mean 
you should have a lexer rule like

ID: (LETTER)+;
protected LETTER:'a'..'z'|'A'..'Z';

in your rule of
  file_identifier:
                 "File" HEADER_SEPARATOR PATH
                 "RS" QUALIFIED_NAME
                 ;

"File" is intended to be recognised as LITERAL_File, by my experience only after input stream
"File" be firstly matched by a lexer rule, them it is taken as type LITERAL_File.

I am not sure if I am right. 

Jigang
--- romje at javaxpert.comдµÀ:

> 
> Hi all,
> using the latest stable ANTLR release I've got some strange information on
> my console:
> 
> line 1:1: expecting "File", found 'File'
> 
> This is an excerpt from my grammar..
> 
> header_eliot_unit:
>                   file_identifier
>                   ;
> file_identifier:
>                 "File" HEADER_SEPARATOR PATH
>                 "RS" QUALIFIED_NAME
>                 ;
> 
> Can't see what 's wrong with it...
> Can't figure how ANTLR see a string as a kind of char indeed....
> 
> 
> grepping through the source code, found this message comes from the
> MismatchedTokenException#getMessage().. Why such exception ?
> I hope that File is seen a File isn't it ?
> 
> Any clue welcomed
> 
> Cheers
> jerome
> -- 
> Auteur cahiers du programmeur J2EE - Eyrolles 2003
> 
> 


__________________________________________________
¸Ï¿ì×¢²áÑÅ»¢³¬´óÈÝÁ¿Ãâ·ÑÓÊÏä?
http://cn.mail.yahoo.com


More information about the antlr-interest mailing list