From 298694a2fdf4451163299d61a49a15fe49ab598a Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 21 Dec 2012 07:38:03 +0000 Subject: id.def: other scope ID * defs/id.def: support for other scope IDs, ID_{INSTANCE,GLOBAL,CONST,CLASS}. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38521 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- template/id.h.tmpl | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'template/id.h.tmpl') diff --git a/template/id.h.tmpl b/template/id.h.tmpl index b918bb8953..8df17b398b 100644 --- a/template/id.h.tmpl +++ b/template/id.h.tmpl @@ -21,10 +21,9 @@ token_op_ids = %w[ tCOLON2 tCOLON3 ] -preserved_ids = nil -attr_ids = nil defs = File.join(File.dirname(erb.filename), "../defs/id.def") -eval(File.read(defs), binding, defs) +ids = eval(File.read(defs), binding, defs) +types = ids.keys.grep(/^[A-Z]/) %> #ifndef RUBY_ID_H #define RUBY_ID_H @@ -75,16 +74,20 @@ enum ruby_method_ids { idAREF = RUBY_TOKEN(AREF), idASET = RUBY_TOKEN(ASET), tPRESERVED_ID_BEGIN = <%=op_id_offset + token_op_ids.size - 1%>, -% preserved_ids.each do |token| +% ids[:preserved].each do |token| id<%=token%>, % end tPRESERVED_ID_END, -% attr_ids.each do |token| +% ids.values_at(*types).flatten.each do |token| t<%=token%>, % end -#define TOKEN2ID(n) id##n = ((t##n<), +% types.each do |type| +% types = ids[type] or next +% types.empty? and next +#define TOKEN2<%=type%>ID(n) id##n = ((t##n<) +% types.each do |token| + TOKEN2<%=type%>ID(<%=token%>), +% end % end tLAST_OP_ID = tPRESERVED_ID_END-1, idLAST_OP_ID = tLAST_OP_ID >> ID_SCOPE_SHIFT -- cgit v1.2.3