summaryrefslogtreecommitdiff
path: root/template/id.h.tmpl
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-21 07:38:03 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-21 07:38:03 (GMT)
commit298694a2fdf4451163299d61a49a15fe49ab598a (patch)
treee58e7ee0155c1043c0da27a2e9c30699f8668a1c /template/id.h.tmpl
parente8794bf2151bf2427e9a69f86cd818c9ed24d0fa (diff)
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
Diffstat (limited to 'template/id.h.tmpl')
-rw-r--r--template/id.h.tmpl19
1 files changed, 11 insertions, 8 deletions
diff --git a/template/id.h.tmpl b/template/id.h.tmpl
index b918bb8..8df17b3 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<<ID_SCOPE_SHIFT)|ID_LOCAL)
-% attr_ids.each do |token|
- TOKEN2ID(<%=token%>),
+% types.each do |type|
+% types = ids[type] or next
+% types.empty? and next
+#define TOKEN2<%=type%>ID(n) id##n = ((t##n<<ID_SCOPE_SHIFT)|ID_<%=type%>)
+% 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