diff options
Diffstat (limited to 'template/id.h.tmpl')
-rw-r--r-- | template/id.h.tmpl | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/template/id.h.tmpl b/template/id.h.tmpl index 687cbbbe40..4f7053885f 100644 --- a/template/id.h.tmpl +++ b/template/id.h.tmpl @@ -11,10 +11,8 @@ **********************************************************************/ <% -op_id_offset = 128 - defs = File.join(File.dirname(File.dirname(erb.filename)), "defs/id.def") -ids = eval(File.read(defs), binding, defs) +ids = eval(File.read(defs), nil, defs) types = ids.keys.grep(/^[A-Z]/) %> #ifndef RUBY_ID_H @@ -49,11 +47,9 @@ enum ruby_id_types { #define symIFUNC ID2SYM(idIFUNC) #define symCFUNC ID2SYM(idCFUNC) -% index = op_id_offset -% ids[:token_op].each do |_id, _op, token| +% ids[:token_op].each do |_id, _op, token, index| % next unless token #define RUBY_TOKEN_<%=token%> <%=index%> -% index += 1 % end #define RUBY_TOKEN(t) RUBY_TOKEN_##t @@ -66,29 +62,38 @@ enum ruby_method_ids { % ids[:token_op].uniq {|_, op| op}.each do |id, op, token| id<%=id%> = <%=token ? "RUBY_TOKEN(#{token})" : "'#{op}'"%>, % end - tPRESERVED_ID_BEGIN = <%=index-1%>, + tPRESERVED_ID_BEGIN = <%=ids[:last_token]%>, % ids[:preserved].each do |token| id<%=token%>, % end tPRESERVED_ID_END, + % prev = 'tPRESERVED_ID_END' % types.each do |type| % tokens = ids[type] + /* <%= type %> tokens {{{ */ tTOKEN_<%=type%>_BEGIN = <%=prev%>-1, % tokens.each do |token| t<%=token%>, % end % prev = "tTOKEN_#{type}_END" <%=prev%>, + /* <%= type %> tokens }}} */ + % end tNEXT_ID = <%=prev%>, + % types.each do |type| % tokens = ids[type] + /* <%= type %> IDs {{{ */ #define DEFINE_<%=type%>ID_FROM_TOKEN(n) id##n = TOKEN2<%=type%>ID(t##n) % tokens or next % tokens.each do |token| DEFINE_<%=type%>ID_FROM_TOKEN(<%=token%>), % end +#undef DEFINE_<%=type%>ID_FROM_TOKEN + /* <%= type %> IDs }}} */ + % end tLAST_OP_ID = tPRESERVED_ID_END-1, idLAST_OP_ID = tLAST_OP_ID >> ID_SCOPE_SHIFT |