more ytab.sed fixes

* tool/ytab.sed: fix for more old bison which does not support %lex-param
  at yydestruct (missed at the previous commit).
  define yy_stack_print macro to add `p` argument instead of
  replacement at callers.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61832 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2018-01-15 02:39:32 +00:00
parent 8f745a2fab
commit 65236c069e

View File

@ -12,13 +12,13 @@ i\
a\ a\
#endif #endif
} }
/^yydestruct.*yymsg/,/#endif/{ /^yydestruct.*yymsg/,/{/{
/^yydestruct/{ /^yydestruct/{
/[, *]p)/!{ /[, *]p)/!{
H H
s/^/ruby_parser_&/ s/^/ruby_parser_&/
s/)$/, p)/ s/)$/, p)/
/\*/s/parser)$/struct parser_params *&/ /\*/s/p)$/struct parser_params *&/
} }
} }
/^#endif/{ /^#endif/{
@ -26,16 +26,23 @@ a\
/yydestruct/{ /yydestruct/{
i\ i\
\ struct parser_params *p; \ struct parser_params *p;
a\ }
x
}
/^{/{
x
/yydestruct/{
i\
#define yydestruct(m, t, v) ruby_parser_yydestruct(m, t, v, p) #define yydestruct(m, t, v) ruby_parser_yydestruct(m, t, v, p)
} }
x x
} }
} }
/^yy_stack_print /,/#endif/{ /^yy_stack_print /,/{/{
/^yy_stack_print/{ /^yy_stack_print/{
/[, *]p)/!{ /[, *]p)/!{
H H
s/^/ruby_parser_&/
s/)$/, p)/ s/)$/, p)/
/\*/s/p)$/struct parser_params *&/ /\*/s/p)$/struct parser_params *&/
} }
@ -48,15 +55,14 @@ a\
} }
x x
} }
} /^{/{
/yy_stack_print.*;/{
x
/yy_stack_print/{
x x
s/\(yy_stack_print *\)(\(.*\));/\1(\2, p);/ /yy_stack_print/{
i\
#define yy_stack_print(b, t) ruby_parser_yy_stack_print(b, t, p)
}
x x
} }
x
} }
/^yy_reduce_print/,/^}/{ /^yy_reduce_print/,/^}/{
s/fprintf *(stderr,/YYFPRINTF (p,/g s/fprintf *(stderr,/YYFPRINTF (p,/g