summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-10-18 14:05:51 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-10-18 14:05:51 +0000
commit560a6c6ffa187f764cb5d81a7d27cb7a84a13c02 (patch)
tree228e4908c26dc993c4e9ab624cf463594c0ade45
parent1a3f365c504650ed51f5c5f284b60fe94fafeca4 (diff)
* 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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33474 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog9
-rw-r--r--ext/ripper/eventids2.c4
-rwxr-xr-xext/ripper/tools/generate.rb11
-rw-r--r--parse.y22
4 files changed, 30 insertions, 16 deletions
diff --git a/ChangeLog b/ChangeLog
index 514d659e41..febf518789 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+Tue Oct 18 23:05:49 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * 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@ruby-lang.org>
* ext/bigdecimal/bigdecimal.gemspec (files): fixed typo, and
diff --git a/ext/ripper/eventids2.c b/ext/ripper/eventids2.c
index 8b0d9c3757..dfe6c08619 100644
--- a/ext/ripper/eventids2.c
+++ b/ext/ripper/eventids2.c
@@ -59,7 +59,7 @@ static ID ripper_id_CHAR;
#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_init_eventids2(VALUE self)
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 {
diff --git a/ext/ripper/tools/generate.rb b/ext/ripper/tools/generate.rb
index 22c3ac0eb7..333b64afae 100755
--- a/ext/ripper/tools/generate.rb
+++ b/ext/ripper/tools/generate.rb
@@ -74,15 +74,18 @@ def generate_eventids1(ids)
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]
diff --git a/parse.y b/parse.y
index 437f534f1d..4bba2ef0b7 100644
--- a/parse.y
+++ b/parse.y
@@ -10969,17 +10969,25 @@ ripper_value(VALUE self, VALUE obj)
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 @@ Init_ripper(void)
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__ */