diff options
Diffstat (limited to 'gcc/java')
-rw-r--r-- | gcc/java/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/java/lex.c | 15 |
2 files changed, 14 insertions, 5 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 592d782..accbbc7 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,5 +1,9 @@ 2001-03-20 Tom Tromey <tromey@redhat.com> + * lex.c (java_read_unicode): Only accept leading `u's. + +2001-03-20 Tom Tromey <tromey@redhat.com> + * jcf-parse.c (read_class): Initialize `class'. 2001-03-20 Matt Kraai <kraai@alumni.carnegiemellon.edu> diff --git a/gcc/java/lex.c b/gcc/java/lex.c index 3b43fa0..4f9a731 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); } |