summaryrefslogtreecommitdiff
path: root/node.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-10-08 01:44:51 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-10-08 01:44:51 +0000
commit4334bb87f918e8f39051d7c80ca1558205762d60 (patch)
tree968e362d29c4a84dd69289bc792dadd3b3b03139 /node.c
parent77ac4a50f12fa545a3ce4aa474c25034c74c1eac (diff)
parentf15ac6c8d6ac6b21a48a84f8b4edbd2bccfe4555 (diff)
node.c: D_FIELD_HEADER
* node.c (D_FIELD_HEADER): concatenate sequential strings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52078 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'node.c')
-rw-r--r--node.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/node.c b/node.c
index bf1ed34..78372f9 100644
--- a/node.c
+++ b/node.c
@@ -20,17 +20,18 @@
#define A_INT(val) rb_str_catf(buf, "%d", (val))
#define A_LONG(val) rb_str_catf(buf, "%ld", (val))
#define A_LIT(lit) AR(rb_inspect(lit))
-#define A_NODE_HEADER(node) \
- rb_str_catf(buf, "@ %s (line: %d)", ruby_node_name(nd_type(node)), nd_line(node))
-#define A_FIELD_HEADER(name) \
- rb_str_catf(buf, "+- %s:", (name))
+#define A_NODE_HEADER(node, term) \
+ rb_str_catf(buf, "@ %s (line: %d)"term, ruby_node_name(nd_type(node)), nd_line(node))
+#define A_FIELD_HEADER(name, term) \
+ rb_str_catf(buf, "+- %s:"term, (name))
+#define D_FIELD_HEADER(name, term) (A_INDENT, A_FIELD_HEADER(name, term))
-#define D_NULL_NODE A_INDENT; A("(null node)"); A("\n");
-#define D_NODE_HEADER(node) A_INDENT; A_NODE_HEADER(node); A("\n");
+#define D_NULL_NODE (A_INDENT, A("(null node)\n"))
+#define D_NODE_HEADER(node) (A_INDENT, A_NODE_HEADER(node, "\n"))
#define COMPOUND_FIELD(name, name2, block) \
do { \
- A_INDENT; A_FIELD_HEADER(comment ? (name2) : (name)); A("\n"); \
+ D_FIELD_HEADER(comment ? (name2) : (name), "\n"); \
rb_str_cat2(indent, next_indent); \
block; \
rb_str_resize(indent, RSTRING_LEN(indent) - 4); \
@@ -38,7 +39,7 @@
#define SIMPLE_FIELD(name, name2, block) \
do { \
- A_INDENT; A_FIELD_HEADER(comment ? (name2) : (name)); A(" "); block; A("\n"); \
+ D_FIELD_HEADER(comment ? (name2) : (name), " "); block; A("\n"); \
} while (0)
#define F_CUSTOM1(name, ann, block) SIMPLE_FIELD(#name, #name " (" ann ")", block)