From 28ee4c296680e9131c6d7869d0fd523738af2b89 Mon Sep 17 00:00:00 2001
From: nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>
Date: Tue, 4 Dec 2012 17:36:19 +0000
Subject: 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
---
 defs/id.def | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)
 create mode 100644 defs/id.def

(limited to 'defs/id.def')

diff --git a/defs/id.def b/defs/id.def
new file mode 100644
index 0000000000..0c47bd7804
--- /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
-- 
cgit v1.2.3

