summaryrefslogtreecommitdiff
path: root/perly.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2016-01-26 15:14:50 +0000
committerDavid Mitchell <davem@iabyn.com>2016-02-03 14:46:37 +0000
commitf39ff1f37d442c1701859527bbfca27427551179 (patch)
tree5588bb3b4665adbc7ed4eef8b847f3c2862ff6a1 /perly.c
parentd7745c5ba8365bb4f5024b0d0bb76126d632c8bd (diff)
downloadperl-f39ff1f37d442c1701859527bbfca27427551179.tar.gz
Add support for bison 3.0
Mainly it no longer generates some tables used for debugging. This commit also adds a new define showing what bison version was used.
Diffstat (limited to 'perly.c')
-rw-r--r--perly.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/perly.c b/perly.c
index 91b4c79886..5aed62858c 100644
--- a/perly.c
+++ b/perly.c
@@ -48,6 +48,10 @@ typedef signed char yysigned_char;
# define YY_NULL 0
#endif
+#ifndef YY_NULLPTR
+# define YY_NULLPTR NULL
+#endif
+
/* contains all the parser state tables; auto-generated from perly.y */
#include "perly.tab"
@@ -169,8 +173,14 @@ yy_reduce_print (pTHX_ int yyrule)
YYFPRINTF (Perl_debug_log, "Reducing stack by rule %d (line %u), ",
yyrule - 1, yylineno);
/* Print the symbols being reduced, and their result. */
+#if PERL_BISON_VERSION >= 30000 /* 3.0+ */
+ for (yyi = 0; yyi < yyr2[yyrule]; yyi++)
+ YYFPRINTF (Perl_debug_log, "%s ",
+ yytname [yystos[(PL_parser->ps)[yyi + 1 - yyr2[yyrule]].state]]);
+#else
for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
YYFPRINTF (Perl_debug_log, "%s ", yytname [yyrhs[yyi]]);
+#endif
YYFPRINTF (Perl_debug_log, "-> %s\n", yytname [yyr1[yyrule]]);
}