[antlr-interest] Problem with Special Char

Micheal J open.zone at virgin.net
Tue Jul 26 07:40:33 PDT 2005


PS: Please don't post in HTML format.
 
 
(~EndOfLine) isn't valid ANTLR usage IIRC. You need to specify the
indivisual chars thus:
 
(~('\n'|'\r'))

-----Original Message-----
From: antlr-interest-bounces at antlr.org
[mailto:antlr-interest-bounces at antlr.org] On Behalf Of Premkumar Rathanavelu
Sent: 26 July 2005 12:14
To: antlr-interest at antlr.org
Subject: [antlr-interest] Problem with Special Char 


Hi.,
  Thanks Martin.
After reading your reply i came to know about the charVocabulary
option and now when i added the following lines to my LEXER
 
options{
charVocabulary = '\u0000'..'\uFFFE';
}
its working pretty fine.
 
HATS OFF Martin.
 
I have another question..consider the following rule
 
in PARSER
 
testPragmaRule:
 MacroPragma testLine ;
 
testLine:
(~(EndOfLine)*);
 
in LEXER
 
MacroPragma : "#pragma";
EndOfLine:
 ( options{generateAmbigWarnings = false;}:
   "\r\n"  // WIN
  | '\r'    // Mac
  | '\n'    // Unix
  )  {newline();} 
 ;
 
Line to be Parsed:
#pragma Computer Software - Restricted
 
now i'm getting the error 

unexpected char: 0x2013 (this is the hyphen)
 
Could you please tell me why this happens?
 
Eager to get your reply.
 
Thanks.,
Prem




  _____  

Yahoo! Mail for Mobile
Take  <http://us.rd.yahoo.com/evt=31132/*http://mobile.yahoo.com/learn/mail>
Yahoo! Mail with you! Check email on your mobile phone.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20050726/44e3bd55/attachment.html


More information about the antlr-interest mailing list