diff options
Diffstat (limited to 'src/java/org/anarres/cpp/LexerSource.java')
-rw-r--r-- | src/java/org/anarres/cpp/LexerSource.java | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/java/org/anarres/cpp/LexerSource.java b/src/java/org/anarres/cpp/LexerSource.java index 51b5c07..8561c04 100644 --- a/src/java/org/anarres/cpp/LexerSource.java +++ b/src/java/org/anarres/cpp/LexerSource.java @@ -479,7 +479,7 @@ public class LexerSource extends Source { int _c = column; int c = read(); - int d, e; + int d; switch (c) { case '\n': @@ -561,9 +561,23 @@ public class LexerSource extends Source { tok = new Token(MOD_EQ); else if (d == '>') tok = new Token('}'); // digraph - else if (d == ':') - tok = new Token('#'); // digraph - else // XXX Deal with %:%: -> ## + else if (d == ':') PASTE: { + d = read(); + if (d != '%') { + unread(d); + tok = new Token('#'); // digraph + break PASTE; + } + d = read(); + if (d != ':') { + unread(d); + unread('%'); + tok = new Token('#'); // digraph + break PASTE; + } + tok = new Token(PASTE); // digraph + } + else unread(d); break; |