diff options
Diffstat (limited to 'src/java/org/anarres/cpp/LexerSource.java')
-rw-r--r-- | src/java/org/anarres/cpp/LexerSource.java | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/java/org/anarres/cpp/LexerSource.java b/src/java/org/anarres/cpp/LexerSource.java index 90869bc..c38ff6a 100644 --- a/src/java/org/anarres/cpp/LexerSource.java +++ b/src/java/org/anarres/cpp/LexerSource.java @@ -318,14 +318,18 @@ public class LexerSource extends Source { return val; case 'x': + text.append((char)d); len = 0; val = 0; - do { + while (len++ < 2) { + d = read(); + if (Character.digit(d, 16) == -1) { + unread(d); + break; + } val = (val << 4) + Character.digit(d, 16); text.append((char)d); - d = read(); - } while (++len < 2 && Character.digit(d, 16) != -1); - unread(d); + } return val; /* Exclude two cases from the warning. */ @@ -444,14 +448,14 @@ public class LexerSource extends Source { } else if (d == 'L' || d == 'l') { if ((bits & 4) != 0) - /* XXX warn */ ; + warning("Conflicting numeric suffices: I and L."); bits |= 2; text.append((char)d); d = read(); } else if (d == 'I' || d == 'i') { if ((bits & 2) != 0) - /* XXX warn */ ; + warning("Conflicting numeric suffices: L and I."); bits |= 4; text.append((char)d); d = read(); |