summaryrefslogtreecommitdiff
path: root/node_dump.c
diff options
context:
space:
mode:
authorS-H-GAMELINKS <gamelinks007@gmail.com>2024-01-05 12:03:11 +0900
committerYuichiro Kaneko <spiketeika@gmail.com>2024-01-07 09:24:34 +0900
commit1b8d01136c3ff6c60325c7609d61e19ac42acd9f (patch)
tree99e027e7711867464c30a72d20f9e56a96e87a83 /node_dump.c
parent76afbda5b566148b9e73939e0ff9b8464d59806c (diff)
Introduce Numeric Node's
Diffstat (limited to 'node_dump.c')
-rw-r--r--node_dump.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/node_dump.c b/node_dump.c
index c42a02e3b3..8060984391 100644
--- a/node_dump.c
+++ b/node_dump.c
@@ -706,7 +706,7 @@ dump_node(VALUE buf, VALUE indent, int comment, const NODE * node)
case NODE_LIT:
ANN("literal");
ANN("format: [nd_lit]");
- ANN("example: 1, /foo/");
+ ANN("example: :sym, /foo/");
goto lit;
case NODE_STR:
ANN("string literal");
@@ -721,6 +721,34 @@ dump_node(VALUE buf, VALUE indent, int comment, const NODE * node)
F_LIT(nd_lit, RNODE_LIT, "literal");
return;
+ case NODE_INTEGER:
+ ANN("integer literal");
+ ANN("format: [val]");
+ ANN("example: 1");
+ F_VALUE(val, rb_node_integer_literal_val(RNODE_INTEGER(node)), "val");
+ return;
+
+ case NODE_FLOAT:
+ ANN("float literal");
+ ANN("format: [val]");
+ ANN("example: 1.2");
+ F_VALUE(val, rb_node_float_literal_val(RNODE_FLOAT(node)), "val");
+ return;
+
+ case NODE_RATIONAL:
+ ANN("rational number literal");
+ ANN("format: [val]");
+ ANN("example: 1r");
+ F_VALUE(val, rb_node_rational_literal_val(RNODE_RATIONAL(node)), "val");
+ return;
+
+ case NODE_IMAGINARY:
+ ANN("complex number literal");
+ ANN("format: [val]");
+ ANN("example: 1i");
+ F_VALUE(val, rb_node_imaginary_literal_val(RNODE_IMAGINARY(node)), "val");
+ return;
+
case NODE_ONCE:
ANN("once evaluation");
ANN("format: [nd_body]");