diff options
Diffstat (limited to 'src/java/org/anarres/cpp/LexerSource.java')
-rw-r--r-- | src/java/org/anarres/cpp/LexerSource.java | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/java/org/anarres/cpp/LexerSource.java b/src/java/org/anarres/cpp/LexerSource.java index b696c9c..5f3bfc7 100644 --- a/src/java/org/anarres/cpp/LexerSource.java +++ b/src/java/org/anarres/cpp/LexerSource.java @@ -431,8 +431,23 @@ public class LexerSource extends Source { } } text.append(close); - return new Token(close == '>' ? HEADER : STRING, + switch (close) { + case '"': + return new Token(STRING, + text.toString(), buf.toString()); + case '>': + return new Token(HEADER, + text.toString(), buf.toString()); + case '\'': + if (buf.length() == 1) + return new Token(CHARACTER, text.toString(), buf.toString()); + return new Token(SQSTRING, + text.toString(), buf.toString()); + default: + throw new IllegalStateException( + "Unknown closing character " + (char)close); + } } private Token _number_suffix(StringBuilder text, NumericValue value, int d) @@ -819,7 +834,7 @@ public class LexerSource extends Source { break; case '\'': - tok = character(); + tok = string('\'', '\''); break; case '"': |