aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorShevek <[email protected]>2014-12-30 22:24:45 -0800
committerShevek <[email protected]>2014-12-30 22:24:45 -0800
commit3d7eba8b626226b48e56137d601131b8586cd5ba (patch)
treed403053ef59792aa6adcca644947f54aa21d603f /src
parentc7b8f222102b6b8882ebe8c0d2b0255bf32817f7 (diff)
Much simpler fix for #25 still passes tests.
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/anarres/cpp/MacroTokenSource.java6
-rw-r--r--src/main/java/org/anarres/cpp/Preprocessor.java1
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;