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