summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author(no author) <(no author)@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-04-30 17:38:22 (GMT)
committer(no author) <(no author)@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-04-30 17:38:22 (GMT)
commita9c5e4a25ed9c7d6748f82d010433cdf51c45b1b (patch)
tree50d9ed641dc91a8a33ad87ee5977f1b694821471
parentcbb650f226e0138bdd08dcdaa220a60a9259fc78 (diff)
This commit was manufactured by cvs2svn to create tag 'v0_7_3'.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/tags/v0_7_3@1340 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--lib/irb/completion.rb47
-rw-r--r--lib/irb/frame.rb67
-rw-r--r--lib/irb/xmp.rb84
3 files changed, 0 insertions, 198 deletions
diff --git a/lib/irb/completion.rb b/lib/irb/completion.rb
deleted file mode 100644
index cbd4012..0000000
--- a/lib/irb/completion.rb
+++ /dev/null
@@ -1,47 +0,0 @@
-
-require "readline"
-
-module IRB
- module InputCompletion
- ReservedWords = [
- "BEGIN", "END",
- "alias", "and",
- "begin", "break",
- "case", "class",
- "def", "defined", "do",
- "else", "elsif", "end", "ensure",
- "false", "for",
- "if", "in",
- "module",
- "next", "nil", "not",
- "or",
- "redo", "rescue", "retry", "return",
- "self", "super",
- "then", "true",
- "undef", "unless", "until",
- "when", "while",
- "yield"
- ]
-
- CompletionProc = proc { |input|
- case input
- when /^([^.]+)\.([^.]*)$/
- receiver = $1
- message = $2
- if eval("(local_variables|#{receiver}.type.constants).include?('#{receiver}')",
- IRB.conf[:MAIN_CONTEXT].bind)
- candidates = eval("#{receiver}.methods", IRB.conf[:MAIN_CONTEXT].bind)
- else
- candidates = []
- end
- candidates.grep(/^#{Regexp.quote(message)}/).collect{|e| receiver + "." + e}
- else
- candidates = eval("methods | private_methods | local_variables | type.constants",
- IRB.conf[:MAIN_CONTEXT].bind)
- (candidates|ReservedWords).grep(/^#{Regexp.quote(input)}/)
- end
- }
- end
-end
-
-Readline.completion_proc = IRB::InputCompletion::CompletionProc
diff --git a/lib/irb/frame.rb b/lib/irb/frame.rb
deleted file mode 100644
index a2d7de3..0000000
--- a/lib/irb/frame.rb
+++ /dev/null
@@ -1,67 +0,0 @@
-#
-# frame.rb -
-# $Release Version: 0.6$
-# $Revision$
-# $Date$
-# by Keiju ISHITSUKA(Nihon Rational Software Co.,Ltd)
-#
-# --
-#
-#
-#
-
-require "e2mmap"
-
-module IRB
- class Frame
- extend Exception2MessageMapper
- def_exception :FrameOverflow, "frame overflow"
- def_exception :FrameUnderflow, "frame underflow"
-
- INIT_STACK_TIMES = 3
- CALL_STACK_OFFSET = 3
-
- def initialize
- @frames = [TOPLEVEL_BINDING] * INIT_STACK_TIMES
- end
-
- def trace_func(event, file, line, id, binding)
- case event
- when 'call', 'class'
- @frames.push binding
- when 'return', 'end'
- @frames.pop
- end
- end
-
- def top(n = 0)
- bind = @frames[-(n + CALL_STACK_OFFSET)]
- Fail FrameUnderflow unless bind
- bind
- end
-
- def bottom(n = 0)
- bind = @frames[n]
- Fail FrameOverflow unless bind
- bind
- end
-
- # singleton functions
- def Frame.bottom(n = 0)
- @backtrace.bottom(n)
- end
-
- def Frame.top(n = 0)
- @backtrace.top(n)
- end
-
- def Frame.sender
- eval "self", @backtrace.top
- end
-
- @backtrace = Frame.new
- set_trace_func proc{|event, file, line, id, binding|
- @backtrace.trace_func(event, file, line, id, binding)
- }
- end
-end
diff --git a/lib/irb/xmp.rb b/lib/irb/xmp.rb
deleted file mode 100644
index fc745a2..0000000
--- a/lib/irb/xmp.rb
+++ /dev/null
@@ -1,84 +0,0 @@
-#
-# xmp.rb - irb version of gotoken xmp
-# $Release Version: 0.6$
-# $Revision$
-# $Date$
-# by Keiju ISHITSUKA(Nippon Rational Inc.)
-#
-# --
-#
-#
-#
-
-require "irb/irb"
-require "irb/frame"
-
-class XMP
- @RCS_ID='-$Id$-'
-
- def initialize(bind = nil)
- #IRB.parse_opts
- #IRB.load_modules
-
- bind = IRB::Frame.top(1) unless bind
- main = eval("self", bind)
- @io = StringInputMethod.new
- @irb = IRB::Irb.new(main, bind, @io)
- @irb.context.prompt_mode = :XMP
- @irb.context.ignore_sigint = false
-
-# IRB.conf[:IRB_RC].call(@irb.context) if IRB.conf[:IRB_RC]
- IRB.conf[:MAIN_CONTEXT] = @irb.context
- end
-
- def puts(exps)
- @io.puts exps
-
- if @irb.context.ignore_sigint
- begin
- trap_proc_b = trap("SIGINT"){@irb.signal_handle}
- catch(:IRB_EXIT) do
- @irb.eval_input
- end
- ensure
- trap("SIGINT", trap_proc_b)
- end
- else
- catch(:IRB_EXIT) do
- @irb.eval_input
- end
- end
- end
-
- class StringInputMethod < IRB::InputMethod
- def initialize
- super
- @exps = []
- end
-
- def eof?
- @exps.empty?
- end
-
- def gets
- while l = @exps.shift
- next if /^\s+$/ =~ l
- l.concat "\n"
- print @prompt, l
- break
- end
- l
- end
-
- def puts(exps)
- @exps.concat exps.split(/\n/)
- end
- end
-end
-
-def xmp(exps, bind = nil)
- bind = IRB::Frame.top(1) unless bind
- xmp = XMP.new(bind)
- xmp.puts exps
- xmp
-end