ruby-changes:21425
From: nobu <ko1@a...>
Date: Tue, 18 Oct 2011 23:06:04 +0900 (JST)
Subject: [ruby-changes:21425] nobu:r33474 (trunk): * ext/ripper/eventids2.c (ripper_init_eventids2): separate
nobu 2011-10-18 23:05:51 +0900 (Tue, 18 Oct 2011) New Revision: 33474 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=33474 Log: * ext/ripper/eventids2.c (ripper_init_eventids2): separate initializations of IDs and objects. * ext/ripper/tools/generate.rb (generate_eventids1): ditto. * parse.y (Init_ripper, InitVM_ripper): fix inversed roles. Modified files: trunk/ChangeLog trunk/ext/ripper/eventids2.c trunk/ext/ripper/tools/generate.rb trunk/parse.y Index: ChangeLog =================================================================== --- ChangeLog (revision 33473) +++ ChangeLog (revision 33474) @@ -1,3 +1,12 @@ +Tue Oct 18 23:05:49 2011 Nobuyoshi Nakada <nobu@r...> + + * ext/ripper/eventids2.c (ripper_init_eventids2): separate + initializations of IDs and objects. + + * ext/ripper/tools/generate.rb (generate_eventids1): ditto. + + * parse.y (Init_ripper, InitVM_ripper): fix inversed roles. + Sun Oct 16 19:46:16 2011 Nobuyoshi Nakada <nobu@r...> * ext/bigdecimal/bigdecimal.gemspec (files): fixed typo, and Index: parse.y =================================================================== --- parse.y (revision 33473) +++ parse.y (revision 33474) @@ -10969,17 +10969,25 @@ void -InitVM_ripper(void) +Init_ripper(void) { parser_data_type.parent = RTYPEDDATA_TYPE(rb_parser_new()); + + ripper_id_gets = rb_intern("gets"); + ripper_init_eventids1(); + ripper_init_eventids2(); + /* ensure existing in symbol table */ + (void)rb_intern("||"); + (void)rb_intern("&&"); + + InitVM(ripper); } void -Init_ripper(void) +InitVM_ripper(void) { VALUE Ripper; - InitVM(ripper); Ripper = rb_define_class("Ripper", rb_cObject); rb_define_const(Ripper, "Version", rb_usascii_str_new2(RIPPER_VERSION)); rb_define_alloc_func(Ripper, ripper_s_allocate); @@ -10998,12 +11006,8 @@ rb_define_method(rb_mKernel, "validate_object", ripper_validate_object, 1); #endif - ripper_id_gets = rb_intern("gets"); - ripper_init_eventids1(Ripper); - ripper_init_eventids2(Ripper); - /* ensure existing in symbol table */ - (void)rb_intern("||"); - (void)rb_intern("&&"); + ripper_init_eventids1_table(Ripper); + ripper_init_eventids2_table(Ripper); # if 0 /* Hack to let RDoc document SCRIPT_LINES__ */ Index: ext/ripper/tools/generate.rb =================================================================== --- ext/ripper/tools/generate.rb (revision 33473) +++ ext/ripper/tools/generate.rb (revision 33474) @@ -74,15 +74,18 @@ end buf << %Q[\n] buf << %Q[static void\n] - buf << %Q[ripper_init_eventids1(VALUE self)\n] + buf << %Q[ripper_init_eventids1(void)\n] buf << %Q[{\n] - buf << %Q[ VALUE h;\n] - buf << %Q[ ID id;\n] ids.each do |id, arity| buf << %Q[ ripper_id_#{id} = rb_intern_const("on_#{id}");\n] end + buf << %Q[}\n] buf << %Q[\n] - buf << %Q[ h = rb_hash_new();\n] + buf << %Q[static void\n] + buf << %Q[ripper_init_eventids1_table(VALUE self)\n] + buf << %Q[{\n] + buf << %Q[ VALUE h = rb_hash_new();\n] + buf << %Q[ ID id;\n] buf << %Q[ rb_define_const(self, "PARSER_EVENT_TABLE", h);\n] ids.each do |id, arity| buf << %Q[ id = rb_intern_const("#{id}");\n] Index: ext/ripper/eventids2.c =================================================================== --- ext/ripper/eventids2.c (revision 33473) +++ ext/ripper/eventids2.c (revision 33474) @@ -59,7 +59,7 @@ #include "eventids2table.c" static void -ripper_init_eventids2(VALUE self) +ripper_init_eventids2(void) { ripper_id_backref = rb_intern_const("on_backref"); ripper_id_backtick = rb_intern_const("on_backtick"); @@ -108,8 +108,6 @@ ripper_id_heredoc_end = rb_intern_const("on_heredoc_end"); ripper_id___end__ = rb_intern_const("on___end__"); ripper_id_CHAR = rb_intern_const("on_CHAR"); - - ripper_init_eventids2_table(self); } static const struct token_assoc { -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/