2007-11-13 12:41:41 +00:00
|
|
|
#!/bin/sed -f
|
|
|
|
/^int yydebug;/{
|
|
|
|
i\
|
|
|
|
#ifndef yydebug
|
|
|
|
a\
|
|
|
|
#endif
|
|
|
|
}
|
2012-07-25 04:12:44 +00:00
|
|
|
/^extern int yydebug;/{
|
|
|
|
i\
|
|
|
|
#ifndef yydebug
|
|
|
|
a\
|
|
|
|
#endif
|
|
|
|
}
|
2007-12-28 02:46:06 +00:00
|
|
|
/^yydestruct.*yymsg/,/#endif/{
|
2007-12-25 12:26:11 +00:00
|
|
|
/^yydestruct/{
|
|
|
|
/parser/!{
|
2015-12-13 14:46:09 +00:00
|
|
|
H
|
2007-12-25 12:26:11 +00:00
|
|
|
s/^/ruby_parser_&/
|
|
|
|
s/)$/, parser)/
|
|
|
|
/\*/s/parser)$/struct parser_params *&/
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/^#endif/{
|
|
|
|
x
|
2015-12-13 14:46:09 +00:00
|
|
|
/yydestruct/{
|
2007-12-25 12:26:11 +00:00
|
|
|
i\
|
|
|
|
struct parser_params *parser;
|
|
|
|
a\
|
|
|
|
#define yydestruct(m, t, v) ruby_parser_yydestruct(m, t, v, parser)
|
|
|
|
}
|
|
|
|
x
|
|
|
|
}
|
|
|
|
}
|
2015-12-13 14:46:09 +00:00
|
|
|
/^yy_stack_print/{
|
|
|
|
/parser/!{
|
|
|
|
H
|
|
|
|
s/)$/, parser)/
|
|
|
|
/\*/s/parser)$/struct parser_params *&/
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/yy_stack_print.*;/{
|
|
|
|
x
|
|
|
|
/yy_stack_print/{
|
|
|
|
x
|
|
|
|
s/\(yy_stack_print *\)(\(.*\));/\1(\2, parser);/
|
|
|
|
x
|
|
|
|
}
|
|
|
|
x
|
|
|
|
}
|
2015-12-14 06:36:50 +00:00
|
|
|
/^yy_reduce_print/,/^}/{
|
|
|
|
s/fprintf *(stderr,/YYFPRINTF (parser,/g
|
|
|
|
}
|
2015-12-13 16:54:43 +00:00
|
|
|
s/\( YYFPRINTF *(\)yyoutput,/\1parser,/
|
|
|
|
s/\( YYFPRINTF *(\)stderr,/\1parser,/
|
|
|
|
s/\( YYDPRINTF *((\)stderr,/\1parser,/
|
2007-12-25 12:26:11 +00:00
|
|
|
s/^\([ ]*\)\(yyerror[ ]*([ ]*parser,\)/\1parser_\2/
|
2007-11-13 12:41:41 +00:00
|
|
|
s!^ *extern char \*getenv();!/* & */!
|
|
|
|
s/^\(#.*\)".*\.tab\.c"/\1"parse.c"/
|
2009-03-11 16:08:24 +00:00
|
|
|
/^\(#.*\)".*\.y"/s:\\\\:/:g
|