зеркало из https://github.com/github/ruby.git
Generate token ID indexes in id.def
Separate the logic accross the tables from the template view for id.h.
This commit is contained in:
Родитель
7400628cb0
Коммит
a977c66312
|
@ -194,13 +194,14 @@ predefined.split(/^/).each_with_index do |line, num|
|
|||
end << token
|
||||
predefined_ids[token] = name
|
||||
end
|
||||
index = 127
|
||||
token_ops.split(/^/).each do |line|
|
||||
next if /^#/ =~ line
|
||||
line.sub!(/\s+#.*/, '')
|
||||
id, op, token = line.split
|
||||
next unless id and op
|
||||
token ||= (id unless /\A\W\z/ =~ op)
|
||||
token_op_ids << [id, op, token]
|
||||
token_op_ids << [id, op, token, (index += 1 if token)]
|
||||
end
|
||||
{
|
||||
"LOCAL" => local_ids,
|
||||
|
@ -212,4 +213,5 @@ end
|
|||
:preserved => preserved_ids,
|
||||
:predefined => predefined_ids,
|
||||
:token_op => token_op_ids,
|
||||
:last_token => index,
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
**********************************************************************/
|
||||
<%
|
||||
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)
|
||||
ops = ids[:token_op].uniq {|id, op, token| token && op}
|
||||
%>
|
||||
% ops.each do |_id, _op, token|
|
||||
|
|
|
@ -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,7 +62,7 @@ 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
|
||||
|
|
Загрузка…
Ссылка в новой задаче