X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/cf98343c1df980ad140fd71aa3d66dea3db8913c..deef2a0a4d97b580fe45a02da328b94ce32538b1:/data/glr.c diff --git a/data/glr.c b/data/glr.c index c6de6d8f..f8a32a82 100644 --- a/data/glr.c +++ b/data/glr.c @@ -109,7 +109,15 @@ m4_define([b4_pure_formals], # -------------------- # Expansion of $$. m4_define([b4_lhs_value], -[((*yyvalp)[]m4_ifval([$1], [.$1]))]) +[b4_symbol_value([(*yyvalp)], [$1])]) + + +# b4_rhs_data(RULE-LENGTH, NUM) +# ----------------------------- +# Expand to the semantic stack place that contains value and location +# of symbol number NUM in a rule of length RULE-LENGTH. +m4_define([b4_rhs_data], +[((yyGLRStackItem const *)yyvsp)@{YYFILL (($2) - ($1))@}.yystate]) # b4_rhs_value(RULE-LENGTH, NUM, [TYPE]) @@ -117,7 +125,7 @@ m4_define([b4_lhs_value], # Expansion of $NUM, where the current rule has RULE-LENGTH # symbols on RHS. m4_define([b4_rhs_value], -[(((yyGLRStackItem const *)yyvsp)@{YYFILL (($2) - ($1))@}.yystate.yysemantics.yysval[]m4_ifval([$3], [.$3]))]) +[b4_symbol_value([b4_rhs_data([$1], [$2]).yysemantics.yysval], [$3])]) @@ -137,7 +145,7 @@ m4_define([b4_lhs_location], # Expansion of @NUM, where the current rule has RULE-LENGTH symbols # on RHS. m4_define([b4_rhs_location], -[(((yyGLRStackItem const *)yyvsp)@{YYFILL (($2) - ($1))@}.yystate.yyloc)]) +[(b4_rhs_data([$1], [$2]).yyloc)]) @@ -148,7 +156,7 @@ m4_define([b4_rhs_location], # We do want M4 expansion after # for CPP macros. m4_changecom() m4_divert_push(0)dnl -@output(b4_parser_file_name@) +@output(b4_parser_file_name@)@ b4_copyright([Skeleton implementation for Bison GLR parsers in C], [2002, 2003, 2004, 2005, 2006]) [ @@ -2637,7 +2645,7 @@ dnl glr.cc produces its own header. dnl m4_if(b4_skeleton, ["glr.c"], [b4_defines_if( -[@output(b4_spec_defines_file@) +[@output(b4_spec_defines_file@)@ b4_copyright([Skeleton interface for Bison GLR parsers in C], [2002, 2003, 2004, 2005, 2006])