2007-11-13 07:41:41 -05:00
|
|
|
#!/bin/sed -f
|
2016-07-02 17:01:04 -04:00
|
|
|
# This file is used when generating code for the Ruby parser.
|
2007-11-13 07:41:41 -05:00
|
|
|
/^int yydebug;/{
|
|
|
|
i\
|
|
|
|
#ifndef yydebug
|
|
|
|
a\
|
|
|
|
#endif
|
|
|
|
}
|
2012-07-25 00:12:44 -04:00
|
|
|
/^extern int yydebug;/{
|
|
|
|
i\
|
|
|
|
#ifndef yydebug
|
|
|
|
a\
|
|
|
|
#endif
|
|
|
|
}
|
2018-01-14 21:39:32 -05:00
|
|
|
/^yydestruct.*yymsg/,/{/{
|
2007-12-25 07:26:11 -05:00
|
|
|
/^yydestruct/{
|
2018-01-14 21:23:24 -05:00
|
|
|
/[, *]p)/!{
|
2015-12-13 09:46:09 -05:00
|
|
|
H
|
2007-12-25 07:26:11 -05:00
|
|
|
s/^/ruby_parser_&/
|
2018-01-14 19:45:26 -05:00
|
|
|
s/)$/, p)/
|
2018-01-14 21:39:32 -05:00
|
|
|
/\*/s/p)$/struct parser_params *&/
|
2007-12-25 07:26:11 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
/^#endif/{
|
|
|
|
x
|
2015-12-13 09:46:09 -05:00
|
|
|
/yydestruct/{
|
2007-12-25 07:26:11 -05:00
|
|
|
i\
|
2018-01-14 21:23:24 -05:00
|
|
|
\ struct parser_params *p;
|
2018-01-14 21:39:32 -05:00
|
|
|
}
|
|
|
|
x
|
|
|
|
}
|
|
|
|
/^{/{
|
|
|
|
x
|
|
|
|
/yydestruct/{
|
|
|
|
i\
|
2018-01-14 19:45:26 -05:00
|
|
|
#define yydestruct(m, t, v) ruby_parser_yydestruct(m, t, v, p)
|
2007-12-25 07:26:11 -05:00
|
|
|
}
|
|
|
|
x
|
|
|
|
}
|
|
|
|
}
|
2018-01-14 21:39:32 -05:00
|
|
|
/^yy_stack_print /,/{/{
|
2018-01-14 21:23:24 -05:00
|
|
|
/^yy_stack_print/{
|
|
|
|
/[, *]p)/!{
|
|
|
|
H
|
2018-01-14 21:39:32 -05:00
|
|
|
s/^/ruby_parser_&/
|
2018-01-14 21:23:24 -05:00
|
|
|
s/)$/, p)/
|
|
|
|
/\*/s/p)$/struct parser_params *&/
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/^#endif/{
|
|
|
|
x
|
|
|
|
/yy_stack_print/{
|
|
|
|
i\
|
|
|
|
\ struct parser_params *p;
|
|
|
|
}
|
|
|
|
x
|
2015-12-13 09:46:09 -05:00
|
|
|
}
|
2018-01-14 21:39:32 -05:00
|
|
|
/^{/{
|
2015-12-13 09:46:09 -05:00
|
|
|
x
|
2018-01-14 21:39:32 -05:00
|
|
|
/yy_stack_print/{
|
|
|
|
i\
|
|
|
|
#define yy_stack_print(b, t) ruby_parser_yy_stack_print(b, t, p)
|
|
|
|
}
|
2015-12-13 09:46:09 -05:00
|
|
|
x
|
|
|
|
}
|
|
|
|
}
|
2015-12-14 01:36:50 -05:00
|
|
|
/^yy_reduce_print/,/^}/{
|
2018-01-14 19:45:26 -05:00
|
|
|
s/fprintf *(stderr,/YYFPRINTF (p,/g
|
2015-12-14 01:36:50 -05:00
|
|
|
}
|
2019-05-10 03:40:34 -04:00
|
|
|
s/^yysyntax_error (/&struct parser_params *p, /
|
|
|
|
s/ yysyntax_error (/&p, /
|
2018-01-14 08:51:38 -05:00
|
|
|
s/\( YYFPRINTF *(\)yyoutput,/\1p,/
|
2018-11-11 07:40:40 -05:00
|
|
|
s/\( YYFPRINTF *(\)yyo,/\1p,/
|
2018-01-14 08:51:38 -05:00
|
|
|
s/\( YYFPRINTF *(\)stderr,/\1p,/
|
|
|
|
s/\( YYDPRINTF *((\)stderr,/\1p,/
|
2007-12-25 07:26:11 -05:00
|
|
|
s/^\([ ]*\)\(yyerror[ ]*([ ]*parser,\)/\1parser_\2/
|
2007-11-13 07:41:41 -05:00
|
|
|
s!^ *extern char \*getenv();!/* & */!
|
|
|
|
s/^\(#.*\)".*\.tab\.c"/\1"parse.c"/
|
2009-03-11 12:08:24 -04:00
|
|
|
/^\(#.*\)".*\.y"/s:\\\\:/:g
|