List Info

Thread: Parsing Error in javacc




Parsing Error in javacc
user name
2007-10-19 16:44:43
https://javacc.dev.java.net/issues/show_bug.cgi?id=167




User paulcager changed the following:

                What    ld value 
               |New value
============================================================
====================
                  Status|NEW                      
|RESOLVED
------------------------------------------------------------
--------------------
              Resolution|                          |INVALID
------------------------------------------------------------
--------------------




------- Additional comments from paulcagerdev.java.net Fri Oct 19 21:44:42 +0000 2007 -------
Hi Balasankar,

It looks as though JavaCC is behaving correctly, given your
grammar. The
troublesom part is the 
    ("\" ["""])
(i.e. a slash optionally followed by a quote.

For the
    "D:","dd"
case the " is matched as a slash followed by a quote
(i.e the quote is included
in the string:
    D:"
so you end up with a missing terminating quote.

For the    
    "D:\","dd"
case then this is matched as two slashes followed by a
quote.

So I think the bug lies in your specification, rather than
JavaCC, I'm afraid.

To get the sort of behaviour you want you will probably want
to use something like:
  < STRING_LITERAL:
      """
      (  
(~[""","\","n","
r"])
        | ("\"
            (
["n","t","b","r",&qu
ot;f","\","'","""]

            | ["0"-"7"] (
["0"-"7"] )?
            | ["0"-"3"]
["0"-"7"] ["0"-"7"]
            )
          )
      )*
      """
  >

(from the Java grammar).

------------------------------------------------------------
---------
To unsubscribe, e-mail: issues-unsubscribejavacc.dev.java.net
For additional commands, e-mail: issues-helpjavacc.dev.java.net


[1]

about | contact  Other archives ( Real Estate discussion Medical topics )