1 # -*- mode: ruby; coding: us-ascii -*-
21 respond_to? Respond_to
22 respond_to_missing? Respond_to_missing
26 core#set_variable_alias
29 core#define_singleton_method
37 class KeywordError < RuntimeError
38 def
self.raise(mesg, line)
39 super(
self, mesg, ["#{__FILE__}:#{line}
", *caller])
51 predefined.split(/^/).each_with_index do |line, num|
53 line.sub!(/\s+#.*/, '')
54 name, token = line.split
58 token = "_#{
token.gsub(/\W+/,
'_')}
"
60 token = token.sub(/\?/, 'P').sub(/\A[a-z]/) {$&.upcase}
61 token.sub!(/\A\$/, "_G_
")
62 token.sub!(/\A@@/, "_C_
")
63 token.sub!(/\A@/, "_I_
")
64 token.gsub!(/\W+/, "")
67 KeywordError.raise("#{
name} is already registered at line #{prev+
firstline}
", firstline+num)
69 if prev = predefined_ids[token]
70 KeywordError.raise("#{
token} is already used
for #{prev} at line #{
names[prev]+
firstline}
", firstline+num)
74 when /\A[A-Z]\w*\z/; const_ids
75 when /\A(?!\d)\w+\z/; local_ids
76 when /\A\$(?:\d+|(?!\d)\w+)\z/; global_ids
77 when /\A@@(?!\d)\w+\z/; class_ids
78 when /\A@(?!\d)\w+\z/; instance_ids
79 when /\A((?!\d)\w+)=\z/
80 KeywordError.raise("use
ID2ATTRSET(#{$1}) instead of ATTRSET #{
name}
", firstline+num)
83 predefined_ids[token] = name
87 "INSTANCE
" => instance_ids,
88 "GLOBAL
" => global_ids,
91 :preserved => preserved_ids,
92 :predefined => predefined_ids,
static VALUE initialize(int rbargc, VALUE argv[], VALUE self)
static struct tcltkip *VALUE self
static VALUE method_missing(VALUE obj, ID id, int argc, const VALUE *argv, int call_status)