2009/2/20 Ben Schulz <[email protected]>:
>
>
>
> On Feb 20, 1:08 pm, John Wilson <[email protected]> wrote:
>> 2009/2/20 Ben Schulz <[email protected]>:
>>
>>
>>
>> >> Also there's an interesting little wrinkle with multiple "u" characters.
>>
>> > I just looked at it, as far as I can tell it has to be one or more u's
>> > and that's all. I implemented a java.io.Reader that handles the level
>> > 1 escaping (+ line/column counting), I'd gladly share the code if
>> > you're interested.
>>
>> Yes it's not a big thing. Section 3.3 covers the problem quite well.
>> Because there can be an arbitrary number of 'u' characters you have to
>> scan past them to see if the character sequence is a Unicode escape or
>> not.
>
> Actually you just need to read the first u to know it's a unicode
> escape sequence, but it does not really matter.


This is only true in somewhat limited circumstances.

If the language has the Java conventions for escapes in Strings cna
character literals and the character '\' cannot appear outside of a
String or character literal then it's safe to make this assumption.
For languages (like Groovy) which allow '\' outside a String (e.g. in
a naked Regexp expression) then life is a little more complicated.

John Wilson

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "JVM 
Languages" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/jvm-languages?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to