summaryrefslogtreecommitdiffstats
path: root/src/java/org/anarres/cpp/LexerSource.java
diff options
context:
space:
mode:
authorShevek <[email protected]>2008-05-07 22:06:53 +0000
committerShevek <[email protected]>2008-05-07 22:06:53 +0000
commit4f32369bf3db4c2b62507a3473bf4c012b2b6871 (patch)
tree78abf8b68e45992b43482280a13d4b2651d5cd65 /src/java/org/anarres/cpp/LexerSource.java
parenta857c3d76feb46c758cbcca8064a90a9a3c88c5c (diff)
more towards 2.0
Diffstat (limited to 'src/java/org/anarres/cpp/LexerSource.java')
-rw-r--r--src/java/org/anarres/cpp/LexerSource.java22
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;