1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/defs/id.def
nobu 28ee4c2966 id.c: generate
* common.mk, defs/id.def, template/id.c.tmpl: generate id.c as well as id.h.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38192 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-04 17:36:19 +00:00

50 lines
1.2 KiB
Ruby

# -*- ruby -*-
predefined = %[\
intern
method_missing MethodMissing
length
size
gets
succ
each
lambda
send
__send__
initialize
initialize_copy
initialize_clone
initialize_dup
_ UScore
"/*NULL*/" NULL
empty?
respond_to? Respond_to
respond_to_missing? Respond_to_missing
<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
]
predefined_ids = {}
preserved_ids = []
attr_ids = []
predefined.each_line do |line|
next if /^#/ =~ line or (name, token = line.split; !name)
token ||= name
if /#/ =~ token
token = "_#{token.gsub(/\W+/, '_')}"
else
token = token.sub(/\?/, 'P').sub(/\A[a-z]/) {$&.upcase}
token.gsub!(/\W+/, "")
end
(/\A(?!\d)\w+\z/ =~ name ? attr_ids : preserved_ids) << token
predefined_ids[token] = name
end