From: Sean Chittenden Date: 2002-05-28T18:08:42+09:00 Subject: Re: yyparse() and friends >> rubyparse() or rbparse()... --b5gNqxB1S1yM7hjW Content-Type: text/plain; charset=us-ascii Content-Disposition: inline > > |All -p does is add a few #defines for build time at the top of > > |the generated parser. I think it would be trivial to duplicate > > |this by adding this to parse.y. > > > > We already have those #defines in intern.h, so do you mean you > > want to move them to parse.y? > > Hmm... let me look at the code. Looks like this is even easier to > solve than we'd thought. Could someone please apply the attached > patch? -sc Err... the previous patch didn't break ruby, but didn't fix my linking/build problem. The attached patch, however fixes everything and does work. -sc -- Sean Chittenden --b5gNqxB1S1yM7hjW Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=patch ? patch ? test.rb Index: intern.h =================================================================== RCS file: /src/ruby/intern.h,v retrieving revision 1.88 diff -u -r1.88 intern.h --- intern.h 2002/04/26 00:40:28 1.88 +++ intern.h 2002/05/28 07:56:02 @@ -284,12 +284,6 @@ /* parse.y */ EXTERN int ruby_sourceline; EXTERN char *ruby_sourcefile; -#define yyparse ruby_yyparse -#define yylex ruby_yylex -#define yyerror ruby_yyerror -#define yylval ruby_yylval -#define yychar ruby_yychar -#define yydebug ruby_yydebug int yyparse _((void)); ID rb_id_attrset _((ID)); void rb_parser_append_print _((void)); Index: parse.y =================================================================== RCS file: /src/ruby/parse.y,v retrieving revision 1.172 diff -u -r1.172 parse.y --- parse.y 2002/05/22 09:37:45 1.172 +++ parse.y 2002/05/28 07:56:03 @@ -15,11 +15,19 @@ #define YYDEBUG 1 #include "ruby.h" #include "env.h" +#include "intern.h" #include "node.h" #include "st.h" #include #include #include + +#define yyparse ruby_yyparse +#define yylex ruby_yylex +#define yyerror ruby_yyerror +#define yylval ruby_yylval +#define yychar ruby_yychar +#define yydebug ruby_yydebug #define ID_SCOPE_SHIFT 3 #define ID_SCOPE_MASK 0x07 Index: ruby.c =================================================================== RCS file: /src/ruby/ruby.c,v retrieving revision 1.61 diff -u -r1.61 ruby.c --- ruby.c 2002/05/23 07:41:53 1.61 +++ ruby.c 2002/05/28 07:56:04 @@ -46,7 +46,7 @@ VALUE ruby_verbose = Qfalse; static int sflag = 0; static int xflag = 0; -extern int yydebug; +extern int ruby_yydebug; char *ruby_inplace_mode = Qfalse; @@ -436,7 +436,7 @@ goto reswitch; case 'y': - yydebug = 1; + ruby_yydebug = 1; s++; goto reswitch; @@ -612,7 +612,7 @@ ruby_verbose = Qtrue; } else if (strcmp("yydebug", s) == 0) - yydebug = 1; + ruby_yydebug = 1; else if (strcmp("help", s) == 0) { usage(origargv[0]); exit(0); --b5gNqxB1S1yM7hjW--