String Literal Problem [message #21281] |
Tue, 01 May 2007 18:11 |
Eclipse User |
|
|
|
Originally posted by: mike.aol.com
I need to use regular expression string literals in OCL, but the parser
barfs on escaped characters.
For example: '\[' causes
1:1:1:4 "'\[' unexpected token(s)"
But '\\[' evaluates to "\\["
What does it want?
Thanks,
Mike Gering
|
|
|
Re: String Literal Problem [message #21302 is a reply to message #21281] |
Tue, 01 May 2007 18:39 |
Eclipse User |
|
|
|
Originally posted by: cdamus.ca.ibm.com
Hi, Mike,
You have most curious timing. I was just investigating a question of how to
escape single-quotes ("'") within strings literals -- something for which
the OCL specification makes no provision -- and discovered that the lexer
grammar definition has rules for Java-style backslash escapes that are not
compliant with the spec. The grammar understands "\\" as an escaped
backslash, but the parser does not process the escapes when constructing
the Java string representations.
This is a bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=184948
I will see about fixing it for the 1.1 release by removing the backslash
rules (since they didn't work, anyway, nobody will miss them). For OCL
1.0.x, you can avoid using string literals for these cases by defining
"global variables" and injecting them into the environment, as you
indicated that you were doing with rule bindings a few days ago.
Cheers,
Christian
Mike Gering wrote:
> I need to use regular expression string literals in OCL, but the parser
> barfs on escaped characters.
>
> For example: '\[' causes
> 1:1:1:4 "'\[' unexpected token(s)"
>
> But '\\[' evaluates to "\\["
>
> What does it want?
>
> Thanks,
> Mike Gering
|
|
|
Re: String Literal Problem [message #21552 is a reply to message #21302] |
Tue, 01 May 2007 19:15 |
Eclipse User |
|
|
|
Originally posted by: mike.aol.com
Christian,
Thanks, and I'll use the global variable approach as a workaround.
Do you want to tell me the next bug I'll find, or should I tell you the
next one you'll find? :-)
Mike
|
|
|
Powered by
FUDForum. Page generated in 0.03080 seconds