« Return to Thread: Doublequotes and Backslashes...
J.Chris Findlay wrote:As I read the definition of T_QUOTED, it reads:
A literal space followed by 2 backslashes followed by 1 backslash and
one doublequote, followed by at least one of [a-zA-Z0-9:_-]
If that is not what you intended, then you need to re-define that.
On Wed, Mar 25, 2009 at 4:10 AM, Bertram <bertram@grillitsch.at> wrote:
>
> Hello again,
>
> I am new to Javacc, so there might be a very obvious solution to this.
>
> I'm trying to parse a) "ABC\\" and b) "\\ABC" by somestuff() below. [<= both
> as they are, NOT escaped, 2 backslashes]
> In case of:
> a) the normalString() is used by javacc -> clearly not intended
> b) there is an exception: Lexical error at line 1, column 1. Encountered:
> "\\" (92), after : ""
>
> ------------------------------
>
> options{
> IGNORE_CASE=false ;
> JAVA_UNICODE_ESCAPE= true ;
> }
> PARSER_BEGIN(Test)
> package Mini;
> public class Test {}
> PARSER_END(Test)
> TOKEN :
> {
> < T_ASTERISK: "*">
> | < T_QUOTED: ( (" ") ("\\\\") ("\\\"")
> ["a"-"z","A"-"Z","_","-","0"-"9",":"] )+ >
> | < T_PROPERTY: ( ["a"-"z","A"-"Z","_","-","0"-"9",":"] )+ >
> }
> void somestuff():
> {}
> { escapedQuoteString()
> | normalString()
> | <T_ASTERISK>
> }
> void escapedQuoteString():
> {System.out.println("YEA");}
> {
> <T_QUOTED>
> }
> void normalString():
> {System.out.println("NO");}
> {
> <T_PROPERTY>
> }
>
> ------------------------------
>
> Wasn't able to find anything usefull, on how to handle \\ and \" when
> expected as valid option in your input.
>
> Any help much appreciated !!
>
> Bertram
>
> --
> View this message in context: http://www.nabble.com/Doublequotes-and-Backslashes...-tp22682545p22682545.html
> Sent from the java.net - javacc users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@javacc.dev.java.net
> For additional commands, e-mail: users-help@javacc.dev.java.net
>
>
--
- J.Chris Findlay
(c:
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@javacc.dev.java.net
For additional commands, e-mail: users-help@javacc.dev.java.net
« Return to Thread: Doublequotes and Backslashes...
| Free embeddable forum powered by Nabble | Forum Help |