summaryrefslogtreecommitdiff
path: root/defs
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-04 17:36:19 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-04 17:36:19 +0000
commit28ee4c296680e9131c6d7869d0fd523738af2b89 (patch)
tree86f96a97921bbdde51cb6e7f312c881eec766408 /defs
parent01380620bdbe1afe848e91fc953dc345a39a1188 (diff)
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
Diffstat (limited to 'defs')
-rw-r--r--defs/id.def50
1 files changed, 50 insertions, 0 deletions
diff --git a/defs/id.def b/defs/id.def
new file mode 100644
index 0000000..0c47bd7
--- /dev/null
+++ b/defs/id.def
@@ -0,0 +1,50 @@
+# -*- 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