From: Tom Tromey Date: Wed, 21 Mar 2001 18:50:02 +0000 (+0000) Subject: * lex.c (java_read_unicode): Only accept leading `u's. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4aed89380ce9687f123b6b171d54adfaf6f878f3;p=gcc.git * lex.c (java_read_unicode): Only accept leading `u's. From-SVN: r40702 --- diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 592d7822f4b..accbbc72f63 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,7 @@ +2001-03-20 Tom Tromey + + * lex.c (java_read_unicode): Only accept leading `u's. + 2001-03-20 Tom Tromey * jcf-parse.c (read_class): Initialize `class'. diff --git a/gcc/java/lex.c b/gcc/java/lex.c index 3b43fa0ac5f..4f9a731f765 100644 --- a/gcc/java/lex.c +++ b/gcc/java/lex.c @@ -532,6 +532,16 @@ java_read_unicode (lex, unicode_escape_p) { unicode_t unicode = 0; int shift = 12; + + /* Recognize any number of `u's in \u. */ + while ((c = java_read_char (lex)) == 'u') + ; + + /* Unget the most recent character as it is not a `u'. */ + if (c == UEOF) + return UEOF; + lex->unget_value = c; + /* Next should be 4 hex digits, otherwise it's an error. The hex value is converted into the unicode, pushed into the Unicode stream. */ @@ -543,11 +553,6 @@ java_read_unicode (lex, unicode_escape_p) unicode |= (unicode_t)((c-'0') << shift); else if ((c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F')) unicode |= (unicode_t)((10+(c | 0x20)-'a') << shift); - else if (c == 'u') - { - /* Recognize any number of u in \u. */ - shift += 4; - } else java_lex_error ("Non hex digit in Unicode escape sequence", 0); }