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.

> > As for the string escape sequences; I handled those manually too
> > because the lexer is handwritten, but you might as well use
> > String.replace(String, String).
>
> Doesn't using String.replace(...) cause you problems with things like "\\t"?

You're absolutely right, did not think that one through at all (also I
confused replace with replaceAll). I wonder if there is some way to
get around a complicated/ugly loop. Maybe there is a utility method
somewhere that replaces all group(n)'s with n > 0 of all matches.

With kind regards
Ben
--~--~---------~--~----~------------~-------~--~----~
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