[antlr-interest] Re: Problem With Special Chars - Detailed
Premkumar Rathanavelu
rprememail at yahoo.com
Mon Jul 25 17:27:53 PDT 2005
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
Martin Probst <mail at martin-probst.com> wrote:
Hi,
> These are the lines from my Vocab file. Is this the one you meant or
> someother?
I see, you don't know about the charVocabulary option I was referring
to. Quote from a webpage which exactly explains your problem and the
solution:
>
> This example uses the ASCII character set in conjunction with some
> values from the extended Unicode character set:
>
>
> class L extends Lexer;
> options {
> charVocabulary = '\3'..'\377'
> |
> '\u1000'..'\u1fff';
>
>
> }
---------------------------------
Start your day with Yahoo! - make it your home page
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20050725/dc608a95/attachment-0001.html
More information about the antlr-interest
mailing list