diff options
author | Shevek <[email protected]> | 2014-12-30 22:24:45 -0800 |
---|---|---|
committer | Shevek <[email protected]> | 2014-12-30 22:24:45 -0800 |
commit | 3d7eba8b626226b48e56137d601131b8586cd5ba (patch) | |
tree | d403053ef59792aa6adcca644947f54aa21d603f | |
parent | c7b8f222102b6b8882ebe8c0d2b0255bf32817f7 (diff) |
Much simpler fix for #25 still passes tests.
-rw-r--r-- | src/main/java/org/anarres/cpp/MacroTokenSource.java | 6 | ||||
-rw-r--r-- | src/main/java/org/anarres/cpp/Preprocessor.java | 1 |
2 files changed, 2 insertions, 5 deletions
diff --git a/src/main/java/org/anarres/cpp/MacroTokenSource.java b/src/main/java/org/anarres/cpp/MacroTokenSource.java index 07c388c..5874584 100644 --- a/src/main/java/org/anarres/cpp/MacroTokenSource.java +++ b/src/main/java/org/anarres/cpp/MacroTokenSource.java @@ -78,13 +78,9 @@ import static org.anarres.cpp.Token.*; private void concat(StringBuilder buf, Argument arg) { Iterator<Token> it = arg.iterator(); - boolean newline = false; while (it.hasNext()) { Token tok = it.next(); - String text = tok.getText(); - if (text.contains("\n")) newline = true; - if (newline) text = text.trim(); - buf.append(text); + buf.append(tok.getText()); } } diff --git a/src/main/java/org/anarres/cpp/Preprocessor.java b/src/main/java/org/anarres/cpp/Preprocessor.java index af3b896..155117e 100644 --- a/src/main/java/org/anarres/cpp/Preprocessor.java +++ b/src/main/java/org/anarres/cpp/Preprocessor.java @@ -763,6 +763,7 @@ public class Preprocessor implements Closeable { case WHITESPACE: case CCOMMENT: case CPPCOMMENT: + case NL: /* Avoid duplicating spaces. */ space = true; break; |