summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authoryui-knk <spiketeika@gmail.com>2022-09-23 23:01:55 +0900
committerYuichiro Kaneko <spiketeika@gmail.com>2022-11-08 12:30:03 +0900
commitf7db1affd10767d729866e95c02ffb26266829ab (patch)
tree899bffb5982d0129f5e48747fd7126bca9d9e700 /parse.y
parent7456647effc8c0d0fd85eb16b47635b96d2401df (diff)
downloadruby-f7db1affd10767d729866e95c02ffb26266829ab.tar.gz
Set default %printer for NODE nterms
Before: ``` Reducing stack by rule 639 (line 5062): $1 = token "integer literal" (1.0-1.1: 1) -> $$ = nterm simple_numeric (1.0-1.1: ) ``` After: ``` Reducing stack by rule 641 (line 5078): $1 = token "integer literal" (1.0-1.1: 1) -> $$ = nterm simple_numeric (1.0-1.1: NODE_LIT) ``` `"<*>"` is supported by Bison 2.3b (2008-05-27) or later. https://git.savannah.gnu.org/cgit/bison.git/commit/?id=12e3584054c16ab255672c07af0ffc7bb220e8bc Therefore developers need to install Bison 2.3b+ to build ruby from source codes if their Bison is older. Minimum version requirement for Bison is changed to 3.0. See: https://bugs.ruby-lang.org/issues/19068 [Feature #19068]
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y8
1 files changed, 8 insertions, 0 deletions
diff --git a/parse.y b/parse.y
index f4b4b8f3d1..f6b32d5c97 100644
--- a/parse.y
+++ b/parse.y
@@ -1141,6 +1141,14 @@ static int looking_at_eol_p(struct parser_params *p);
%define parse.error verbose
%printer {
#ifndef RIPPER
+ if ($$) {
+ rb_parser_printf(p, "%s", ruby_node_name(nd_type($$)));
+ }
+#else
+#endif
+} <node>
+%printer {
+#ifndef RIPPER
rb_parser_printf(p, "%"PRIsVALUE, rb_id2str($$));
#else
rb_parser_printf(p, "%"PRIsVALUE, RNODE($$)->nd_rval);