ruby-changes:24671
From: nobu <ko1@a...>
Date: Fri, 17 Aug 2012 17:35:22 +0900 (JST)
Subject: [ruby-changes:24671] nobu:r36722 (trunk): id.h.tmpl: preserved ids
nobu 2012-08-17 17:35:12 +0900 (Fri, 17 Aug 2012) New Revision: 36722 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=36722 Log: id.h.tmpl: preserved ids * template/id.h.tmpl (preserved_ids): move from parse.y. Modified files: trunk/parse.y trunk/template/id.h.tmpl Index: parse.y =================================================================== --- parse.y (revision 36721) +++ parse.y (revision 36722) @@ -48,7 +48,7 @@ #include "id.c" #endif -#define is_notop_id(id) ((id)>tLAST_TOKEN) +#define is_notop_id(id) ((id)>tLAST_OP_ID) #define is_local_id(id) (is_notop_id(id)&&((id)&ID_SCOPE_MASK)==ID_LOCAL) #define is_global_id(id) (is_notop_id(id)&&((id)&ID_SCOPE_MASK)==ID_GLOBAL) #define is_instance_id(id) (is_notop_id(id)&&((id)&ID_SCOPE_MASK)==ID_INSTANCE) @@ -800,21 +800,6 @@ %right tPOW %right '!' '~' tUPLUS -%nonassoc idNULL -%nonassoc idRespond_to -%nonassoc idIFUNC -%nonassoc idCFUNC -%nonassoc id_core_set_method_alias -%nonassoc id_core_set_variable_alias -%nonassoc id_core_undef_method -%nonassoc id_core_define_method -%nonassoc id_core_define_singleton_method -%nonassoc id_core_set_postexe -%nonassoc id_core_hash_from_ary -%nonassoc id_core_hash_merge_ary -%nonassoc id_core_hash_merge_ptr -%nonassoc id_core_hash_merge_kwd - %token tLAST_TOKEN %% Index: template/id.h.tmpl =================================================================== --- template/id.h.tmpl (revision 36721) +++ template/id.h.tmpl (revision 36722) @@ -14,6 +14,7 @@ require 'optparse' vpath = ["."] input = nil + opt = OptionParser.new do |o| o.on('-v', '--vpath=DIR') {|dirs| vpath.concat dirs.split(File::PATH_SEPARATOR)} input, = o.order!(ARGV) @@ -48,6 +49,23 @@ Bitblt Answer ] + +preserved_ids = %w[ + NULL + Respond_to + IFUNC + CFUNC + _core_set_method_alias + _core_set_variable_alias + _core_undef_method + _core_define_method + _core_define_singleton_method + _core_set_postexe + _core_hash_from_ary + _core_hash_merge_ary + _core_hash_merge_ptr + _core_hash_merge_kwd +] %> #ifndef RUBY_ID_H #define RUBY_ID_H @@ -105,7 +123,13 @@ idNeqTilde = tNMATCH, idAREF = tAREF, idASET = tASET, - idLAST_TOKEN = tLAST_TOKEN >> ID_SCOPE_SHIFT, + tPRESERVED_ID_BEGIN = tLAST_TOKEN-1, +% preserved_ids.each do |token| + id<%=token%>, +% end + tPRESERVED_ID_END, + tLAST_OP_ID = tPRESERVED_ID_END-1, + idLAST_OP_ID = tLAST_OP_ID >> ID_SCOPE_SHIFT, % method_ids.each do |token| t<%=token%>, % end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/