aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/anarres/cpp/Macro.java
diff options
context:
space:
mode:
authorShevek <[email protected]>2008-04-04 20:11:04 +0000
committerShevek <[email protected]>2008-04-04 20:11:04 +0000
commit8841a1a84face44e8a0d28175e14e790fd01b15b (patch)
tree0f9f874064e87a6e9116aa36ecf08ba523d4aa3d /src/java/org/anarres/cpp/Macro.java
parent5ff55648127c8a8e1b9829775045af986e37647c (diff)
support pragmas
Diffstat (limited to 'src/java/org/anarres/cpp/Macro.java')
-rw-r--r--src/java/org/anarres/cpp/Macro.java39
1 files changed, 22 insertions, 17 deletions
diff --git a/src/java/org/anarres/cpp/Macro.java b/src/java/org/anarres/cpp/Macro.java
index 0d0ae55..51e9ecd 100644
--- a/src/java/org/anarres/cpp/Macro.java
+++ b/src/java/org/anarres/cpp/Macro.java
@@ -118,6 +118,27 @@ public class Macro {
return tokens;
}
+ public String getText() {
+ StringBuilder buf = new StringBuilder();
+ boolean paste = false;
+ for (int i = 0; i < tokens.size(); i++) {
+ Token tok = tokens.get(i);
+ if (tok.getType() == Token.M_PASTE) {
+ paste = true;
+ continue;
+ }
+ else {
+ buf.append(tok.getText());
+ }
+ if (paste) {
+ buf.append(" #" + "# ");
+ paste = false;
+ }
+ // buf.append(tokens.get(i));
+ }
+ return buf.toString();
+ }
+
public String toString() {
StringBuilder buf = new StringBuilder(name);
if (args != null) {
@@ -133,23 +154,7 @@ public class Macro {
buf.append(')');
}
if (!tokens.isEmpty()) {
- boolean paste = false;
- buf.append(" => ");
- for (int i = 0; i < tokens.size(); i++) {
- Token tok = tokens.get(i);
- if (tok.getType() == Token.M_PASTE) {
- paste = true;
- continue;
- }
- else {
- buf.append(tok.getText());
- }
- if (paste) {
- buf.append(" #" + "# ");
- paste = false;
- }
- // buf.append(tokens.get(i));
- }
+ buf.append(" => ").append(getText());
}
return buf.toString();
}