[antlr-interest] How to write '\v' in antlr grammar?

mzukowski at yci.com mzukowski at yci.com
Mon Mar 31 14:35:24 PST 2003


You can always look up and use the octal escape for that character '\013'.
Write a comment that it is '\v'.

Monty

-----Original Message-----
From: Albert Huh [mailto:albert.huh at embarcadero-ca.com]
Sent: Friday, March 28, 2003 1:39 PM
To: antlr-interest at yahoogroups.com
Subject: RE: [antlr-interest] How to write '\v' in antlr grammar?


maybe it's a bug in the antlr grammar?? the antlr compiler is croaking on
the '\v'.  the antlr compiler is in java.  maybe you could try '\\v'
instead??  i'm just guessing here.

-----Original Message-----
From: zai-qiang.leng at sybase.com [mailto:zai-qiang.leng at sybase.com]
Sent: Thursday, March 27, 2003 8:27 PM
To: antlr-interest at yahoogroups.com
Subject: RE: [antlr-interest] How to write '\v' in antlr grammar?



I am not sure if '\v' is a valid escape char in Java, but I am sure it is a
valid escape char in C++.  I got following messages from MSDN:

Table 1.4   Escape Sequences


|---------------+-----------------------------|
|               |                             |
|  Escape       |  Represents                 |
|  Sequence     |                             |
|               |                             |
|---------------+-----------------------------|
|               |                             |
|  \a           |  Bell (alert)               |
|               |                             |
|---------------+-----------------------------|
|               |                             |
|  \b           |  Backspace                  |
|               |                             |
|---------------+-----------------------------|
|               |                             |
|  \f           |  Formfeed                   |
|               |                             |
|---------------+-----------------------------|
|               |                             |
|  \n           |  New line                   |
|               |                             |
|---------------+-----------------------------|
|               |                             |
|  \r           |  Carriage return            |
|               |                             |
|---------------+-----------------------------|
|               |                             |
|  \t           |  Horizontal tab             |
|               |                             |
|---------------+-----------------------------|
|               |                             |
|  \v           |  Vertical tab               |
|               |                             |
|---------------+-----------------------------|
|               |                             |
|  \'           |  Single quotation mark      |
|               |                             |
|---------------+-----------------------------|
|               |                             |
|  \"           |  Double quotation mark      |
|               |                             |
|---------------+-----------------------------|
|               |                             |
|  \\           |  Backslash                  |
|               |                             |
|---------------+-----------------------------|
|               |                             |
|  \?           |  Literal question mark      |
|               |                             |
|---------------+-----------------------------|
|               |                             |
|  \ooo         |  ASCII character in octal   |
|               |  notation                   |
|               |                             |
|---------------+-----------------------------|
|               |                             |
|  \xhhh        |  ASCII character in         |
|               |  hexadecimal notation       |
|               |                             |
|---------------+-----------------------------|




Thanks
Zaiqiang



 

                    "Albert Huh"

                    <albert.huh at embarcade       To:
<antlr-interest at yahoogroups.com>                                  
                    ro-ca.com>                  cc:

                                                Subject:     RE:
[antlr-interest] How to write '\v' in antlr grammar?     
                    03/28/03 12:54 AM

                    Please respond to

                    antlr-interest

 

 




are you sure '\v' is a valid escape sequence in java/c++?

i could be wrong, but i don't think \v means anything at all...


-----Original Message-----
From: zai-qiang.leng at sybase.com [mailto:zai-qiang.leng at sybase.com]
Sent: Thursday, March 27, 2003 3:25 AM
To: antlr-interest at yahoogroups.com
Subject: [antlr-interest] How to write '\v' in antlr grammar?


Hi,

I have following lexer rules,

protected
ESC
     :    '~'!
          (
               'n'       {$setText('\n');}
          |    'r'       {$setText('\r');}
          |    'v'       {$setText('\v');}                        //If I
change the '\v' to ''(empty char), all is ok.
          |    't'       {$setText('\t');}
          |    'f'       {$setText('\f');}
          |    'b'       {$setText('\b');}
          |    ('0'..'2') (Digit) (Digit)
          );


but when I compile it via antlr, I got following errors:

NTLR Parser Generator   Version 2.7.1   1989-2000 jGuru.com
error: Token stream error reading
grammar(s):antlr.TokenStreamRecognitionException: unexpected char: v
TokenStreamException: unexpected char: v
Error executing c:\winnt\system32\cmd.exe.


Can anyone tell me how to solve this?

Thanks
Zaiqiang




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





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








 

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



 

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


 

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



More information about the antlr-interest mailing list