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 paulcager dev.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-unsubscribe javacc.dev.java.net
For additional commands, e-mail: issues-help javacc.dev.java.net
|