1 # -*- mode: ruby; coding: us-ascii -*-
10 singleton_method_added
12 singleton_method_removed
14 singleton_method_undefined
33 respond_to? Respond_to
34 respond_to_missing? Respond_to_missing
38 core#set_variable_alias
41 core#define_singleton_method
49 class KeywordError < RuntimeError
50 def
self.raise(mesg, line)
51 super(
self, mesg, ["#{__FILE__}:#{line}
", *caller])
63 predefined.split(/^/).each_with_index do |line, num|
65 line.sub!(/\s+#.*/, '')
66 name, token = line.split
70 token = "_#{
token.gsub(/\W+/,
'_')}
"
72 token = token.sub(/\?/, 'P').sub(/\A[a-z]/) {$&.upcase}
73 token.sub!(/\A\$/, "_G_
")
74 token.sub!(/\A@@/, "_C_
")
75 token.sub!(/\A@/, "_I_
")
76 token.gsub!(/\W+/, "")
79 KeywordError.raise("#{
name} is already registered at line #{prev+
firstline}
", firstline+num)
81 if prev = predefined_ids[token]
82 KeywordError.raise("#{
token} is already used
for #{prev} at line #{
names[prev]+
firstline}
", firstline+num)
86 when /\A[A-Z]\w*\z/; const_ids
87 when /\A(?!\d)\w+\z/; local_ids
88 when /\A\$(?:\d+|(?!\d)\w+)\z/; global_ids
89 when /\A@@(?!\d)\w+\z/; class_ids
90 when /\A@(?!\d)\w+\z/; instance_ids
91 when /\A((?!\d)\w+)=\z/
92 KeywordError.raise("use
ID2ATTRSET(#{$1}) instead of ATTRSET #{
name}
", firstline+num)
95 predefined_ids[token] = name
99 "INSTANCE
" => instance_ids,
100 "GLOBAL
" => global_ids,
101 "CONST" => const_ids,
102 "CLASS
" => class_ids,
103 :preserved => preserved_ids,
104 :predefined => predefined_ids,
static VALUE initialize(int rbargc, VALUE argv[], VALUE self)
static VALUE const_missing(VALUE klass, ID id)
static void method_added(VALUE klass, ID mid)
static struct tcltkip *VALUE self
static VALUE method_missing(VALUE obj, ID id, int argc, const VALUE *argv, int call_status)