summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-08-09 02:02:58 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-08-09 02:02:58 +0000
commit76515504d552d3677f81539c29ed5f558f0dc4f0 (patch)
treeef35eaabde005fe0350b8ac955a63a4cebaa1cdc /lib
parent5afa23b4a46b55667d8f1c6e4490dfb315c8616f (diff)
* lib/irb.rb: removed commented-out code.
* lib/irb/**/*.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47114 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/irb.rb2
-rw-r--r--lib/irb/cmd/load.rb2
-rw-r--r--lib/irb/completion.rb7
-rw-r--r--lib/irb/context.rb3
-rw-r--r--lib/irb/ext/change-ws.rb24
-rw-r--r--lib/irb/ext/history.rb3
-rw-r--r--lib/irb/ext/loader.rb1
-rw-r--r--lib/irb/ext/multi-irb.rb1
-rw-r--r--lib/irb/ext/save-history.rb16
-rw-r--r--lib/irb/extend-command.rb14
-rw-r--r--lib/irb/init.rb2
-rw-r--r--lib/irb/input-method.rb1
-rw-r--r--lib/irb/inspector.rb14
-rw-r--r--lib/irb/ruby-lex.rb44
-rw-r--r--lib/irb/ruby-token.rb1
-rw-r--r--lib/irb/slex.rb2
-rw-r--r--lib/irb/xmp.rb3
17 files changed, 3 insertions, 137 deletions
diff --git a/lib/irb.rb b/lib/irb.rb
index 1874f234c6..9bd37c8b0b 100644
--- a/lib/irb.rb
+++ b/lib/irb.rb
@@ -13,7 +13,6 @@ require "e2mmap"
require "irb/init"
require "irb/context"
require "irb/extend-command"
-#require "irb/workspace"
require "irb/ruby-lex"
require "irb/input-method"
@@ -399,7 +398,6 @@ module IRB
ensure
irb_at_exit
end
-# print "\n"
end
# Calls each event hook of IRB.conf[:AT_EXIT] when the current session quits.
diff --git a/lib/irb/cmd/load.rb b/lib/irb/cmd/load.rb
index 1b6dee6918..acda9d0c8c 100644
--- a/lib/irb/cmd/load.rb
+++ b/lib/irb/cmd/load.rb
@@ -19,7 +19,6 @@ module IRB
include IrbLoader
def execute(file_name, priv = nil)
- # return ruby_load(file_name) unless IRB.conf[:USE_LOADER]
return irb_load(file_name, priv)
end
end
@@ -28,7 +27,6 @@ module IRB
include IrbLoader
def execute(file_name)
- # return ruby_require(file_name) unless IRB.conf[:USE_LOADER]
rex = Regexp.new("#{Regexp.quote(file_name)}(\.o|\.rb)?")
return false if $".find{|f| f =~ rex}
diff --git a/lib/irb/completion.rb b/lib/irb/completion.rb
index b8f124f13b..05b1ed4873 100644
--- a/lib/irb/completion.rb
+++ b/lib/irb/completion.rb
@@ -38,8 +38,6 @@ module IRB
CompletionProc = proc { |input|
bind = IRB.conf[:MAIN_CONTEXT].workspace.binding
- # puts "input: #{input}"
-
case input
when /^((["'`]).*\2)\.([^.]*)$/
# String
@@ -90,7 +88,6 @@ module IRB
candidates = Object.constants.collect{|m| m.to_s}
candidates.grep(/^#{receiver}/).collect{|e| "::" + e}
- # when /^(((::)?[A-Z][^:.\(]*)+)::?([^:.]*)$/
when /^([A-Z].*)::([^:.]*)$/
# Constant or class methods
receiver = $1
@@ -143,9 +140,6 @@ module IRB
regmessage = Regexp.new(Regexp.quote($1))
candidates = global_variables.collect{|m| m.to_s}.grep(regmessage)
- # when /^(\$?(\.?[^.]+)+)\.([^.]*)$/
- # when /^((\.?[^.]+)+)\.([^.]*)$/
- # when /^([^."].*)\.([^.]*)$/
when /^([^."].*)(\.|::)([^.]*)$/
# variable.func or func.func
receiver = $1
@@ -228,7 +222,6 @@ module IRB
end
if Readline.respond_to?("basic_word_break_characters=")
- # Readline.basic_word_break_characters= " \t\n\"\\'`><=;|&{("
Readline.basic_word_break_characters= " \t\n`><=;|&{("
end
Readline.completion_append_character = nil
diff --git a/lib/irb/context.rb b/lib/irb/context.rb
index 1c24c57c8e..9cf9600f02 100644
--- a/lib/irb/context.rb
+++ b/lib/irb/context.rb
@@ -30,7 +30,6 @@ module IRB
@workspace = WorkSpace.new
end
@thread = Thread.current if defined? Thread
- # @irb_level = 0
# copy of default configuration
@ap_name = IRB.conf[:AP_NAME]
@@ -378,8 +377,6 @@ module IRB
def evaluate(line, line_no) # :nodoc:
@line_no = line_no
set_last_value(@workspace.evaluate(self, line, irb_path, line_no))
- # @workspace.evaluate("_ = IRB.conf[:MAIN_CONTEXT]._")
- # @_ = @workspace.evaluate(line, irb_path, line_no)
end
def inspect_last_value # :nodoc:
diff --git a/lib/irb/ext/change-ws.rb b/lib/irb/ext/change-ws.rb
index a5c243aaf3..0ae9097285 100644
--- a/lib/irb/ext/change-ws.rb
+++ b/lib/irb/ext/change-ws.rb
@@ -40,30 +40,6 @@ module IRB # :nodoc:
main.extend ExtendCommandBundle
end
end
-
-# def change_binding(*_main)
-# back = @workspace
-# @workspace = WorkSpace.new(*_main)
-# unless _main.empty?
-# begin
-# main.extend ExtendCommandBundle
-# rescue
-# print "can't change binding to: ", main.inspect, "\n"
-# @workspace = back
-# return nil
-# end
-# end
-# @irb_level += 1
-# begin
-# catch(:SU_EXIT) do
-# @irb.eval_input
-# end
-# ensure
-# @irb_level -= 1
-# @workspace = back
-# end
-# end
-# alias change_workspace change_binding
end
end
diff --git a/lib/irb/ext/history.rb b/lib/irb/ext/history.rb
index d991f4d33b..0096357c9c 100644
--- a/lib/irb/ext/history.rb
+++ b/lib/irb/ext/history.rb
@@ -21,8 +21,7 @@ module IRB # :nodoc:
def set_last_value(value)
_set_last_value(value)
- # @workspace.evaluate self, "_ = IRB.CurrentContext.last_value"
- if @eval_history #and !@eval_history_values.equal?(llv)
+ if @eval_history
@eval_history_values.push @line_no, @last_value
@workspace.evaluate self, "__ = IRB.CurrentContext.instance_eval{@eval_history_values}"
end
diff --git a/lib/irb/ext/loader.rb b/lib/irb/ext/loader.rb
index 9edf02b1d0..054ce6b0d1 100644
--- a/lib/irb/ext/loader.rb
+++ b/lib/irb/ext/loader.rb
@@ -82,7 +82,6 @@ module IRB # :nodoc:
irb.suspend_input_method(FileInputMethod.new(path)) do
|back_io|
irb.signal_status(:IN_LOAD) do
- # p irb.conf
if back_io.kind_of?(FileInputMethod)
irb.eval_input
else
diff --git a/lib/irb/ext/multi-irb.rb b/lib/irb/ext/multi-irb.rb
index b46aa5a1d8..01d06fb222 100644
--- a/lib/irb/ext/multi-irb.rb
+++ b/lib/irb/ext/multi-irb.rb
@@ -17,7 +17,6 @@ module IRB
# Creates a new JobManager object
def initialize
- # @jobs = [[thread, irb],...]
@jobs = []
@current_job = nil
end
diff --git a/lib/irb/ext/save-history.rb b/lib/irb/ext/save-history.rb
index d2ea37f950..b4c72a0339 100644
--- a/lib/irb/ext/save-history.rb
+++ b/lib/irb/ext/save-history.rb
@@ -59,23 +59,7 @@ module IRB
module HistorySavingAbility # :nodoc:
include Readline
-# def HistorySavingAbility.create_finalizer
-# proc do
-# if num = IRB.conf[:SAVE_HISTORY] and (num = num.to_i) > 0
-# if hf = IRB.conf[:HISTORY_FILE]
-# file = File.expand_path(hf)
-# end
-# file = IRB.rc_file("_history") unless file
-# open(file, 'w' ) do |f|
-# hist = HISTORY.to_a
-# f.puts(hist[-num..-1] || hist)
-# end
-# end
-# end
-# end
-
def HistorySavingAbility.extended(obj)
-# ObjectSpace.define_finalizer(obj, HistorySavingAbility.create_finalizer)
IRB.conf[:AT_EXIT].push proc{obj.save_history}
obj.load_history
obj
diff --git a/lib/irb/extend-command.rb b/lib/irb/extend-command.rb
index c10f9e63cf..a9326272ff 100644
--- a/lib/irb/extend-command.rb
+++ b/lib/irb/extend-command.rb
@@ -49,28 +49,18 @@ module IRB # :nodoc:
[:irb_print_working_workspace, OVERRIDE_ALL],
[:irb_cwws, OVERRIDE_ALL],
[:irb_pwws, OVERRIDE_ALL],
- # [:irb_cww, OVERRIDE_ALL],
- # [:irb_pww, OVERRIDE_ALL],
[:cwws, NO_OVERRIDE],
[:pwws, NO_OVERRIDE],
- # [:cww, NO_OVERRIDE],
- # [:pww, NO_OVERRIDE],
[:irb_current_working_binding, OVERRIDE_ALL],
[:irb_print_working_binding, OVERRIDE_ALL],
[:irb_cwb, OVERRIDE_ALL],
[:irb_pwb, OVERRIDE_ALL],
- # [:cwb, NO_OVERRIDE],
- # [:pwb, NO_OVERRIDE]
],
[:irb_change_workspace, :ChangeWorkspace, "irb/cmd/chws",
[:irb_chws, OVERRIDE_ALL],
- # [:irb_chw, OVERRIDE_ALL],
[:irb_cws, OVERRIDE_ALL],
- # [:irb_cw, OVERRIDE_ALL],
[:chws, NO_OVERRIDE],
- # [:chw, NO_OVERRIDE],
[:cws, NO_OVERRIDE],
- # [:cw, NO_OVERRIDE],
[:irb_change_binding, OVERRIDE_ALL],
[:irb_cb, OVERRIDE_ALL],
[:cb, NO_OVERRIDE]],
@@ -81,17 +71,13 @@ module IRB # :nodoc:
[:bindings, NO_OVERRIDE]],
[:irb_push_workspace, :PushWorkspace, "irb/cmd/pushws",
[:irb_pushws, OVERRIDE_ALL],
- # [:irb_pushw, OVERRIDE_ALL],
[:pushws, NO_OVERRIDE],
- # [:pushw, NO_OVERRIDE],
[:irb_push_binding, OVERRIDE_ALL],
[:irb_pushb, OVERRIDE_ALL],
[:pushb, NO_OVERRIDE]],
[:irb_pop_workspace, :PopWorkspace, "irb/cmd/pushws",
[:irb_popws, OVERRIDE_ALL],
- # [:irb_popw, OVERRIDE_ALL],
[:popws, NO_OVERRIDE],
- # [:popw, NO_OVERRIDE],
[:irb_pop_binding, OVERRIDE_ALL],
[:irb_popb, OVERRIDE_ALL],
[:popb, NO_OVERRIDE]],
diff --git a/lib/irb/init.rb b/lib/irb/init.rb
index 82dde493f3..af9c363a97 100644
--- a/lib/irb/init.rb
+++ b/lib/irb/init.rb
@@ -88,7 +88,6 @@ module IRB # :nodoc:
},
:INF_RUBY => {
:PROMPT_I => "%N(%m):%03n:%i> ",
- # :PROMPT_N => "%N(%m):%03n:%i> ",
:PROMPT_N => nil,
:PROMPT_S => nil,
:PROMPT_C => nil,
@@ -110,7 +109,6 @@ module IRB # :nodoc:
@CONF[:CONTEXT_MODE] = 3 # use binding in function on TOPLEVEL_BINDING
@CONF[:SINGLE_IRB] = false
-# @CONF[:LC_MESSAGES] = "en"
@CONF[:LC_MESSAGES] = Locale.new
@CONF[:AT_EXIT] = []
diff --git a/lib/irb/input-method.rb b/lib/irb/input-method.rb
index 0b765d377b..590dfb9d9f 100644
--- a/lib/irb/input-method.rb
+++ b/lib/irb/input-method.rb
@@ -117,7 +117,6 @@ module IRB
def gets
print @prompt
l = @io.gets
-# print @prompt, l
l
end
diff --git a/lib/irb/inspector.rb b/lib/irb/inspector.rb
index cdd90d4081..f09b12927a 100644
--- a/lib/irb/inspector.rb
+++ b/lib/irb/inspector.rb
@@ -61,20 +61,6 @@ module IRB # :nodoc:
# Inspector.def_inspector(key, inspector)
# Inspector.def_inspector([key1,...], inspector)
def self.def_inspector(key, arg=nil, &block)
- # if !block_given?
- # case arg
- # when nil, Proc
- # inspector = IRB::Inspector(init_p)
- # when Inspector
- # inspector = init_p
- # else
- # IRB.Raise IllegalParameter, init_p
- # end
- # init_p = nil
- # else
- # inspector = IRB::Inspector(block, init_p)
- # end
-
if block_given?
inspector = IRB::Inspector(block, arg)
else
diff --git a/lib/irb/ruby-lex.rb b/lib/irb/ruby-lex.rb
index 8bb7edbbaf..06665af089 100644
--- a/lib/irb/ruby-lex.rb
+++ b/lib/irb/ruby-lex.rb
@@ -101,7 +101,6 @@ class RubyLex
def getc
while @rests.empty?
-# return nil unless buf_input
@rests.push nil unless buf_input
end
c = @rests.shift
@@ -266,12 +265,8 @@ class RubyLex
until (((tk = token).kind_of?(TkNL) || tk.kind_of?(TkEND_OF_SCRIPT)) &&
!@continue or
tk.nil?)
- #p tk
- #p @lex_state
- #p self
end
line = get_readed
- # print self.inspect
if line == "" and tk.kind_of?(TkEND_OF_SCRIPT) || tk.nil?
nil
else
@@ -280,8 +275,6 @@ class RubyLex
end
def token
- # require "tracer"
- # Tracer.on
@prev_seek = @seek
@prev_line_no = @line_no
@prev_char_no = @char_no
@@ -299,15 +292,14 @@ class RubyLex
if @readed_auto_clean_up
get_readed
end
- # Tracer.off
tk
end
ENINDENT_CLAUSE = [
"case", "class", "def", "do", "for", "if",
- "module", "unless", "until", "while", "begin" #, "when"
+ "module", "unless", "until", "while", "begin"
]
- DEINDENT_CLAUSE = ["end" #, "when"
+ DEINDENT_CLAUSE = ["end"
]
PERCENT_LTYPE = {
@@ -554,7 +546,6 @@ class RubyLex
@OP.def_rule("::") do
|op, io|
-# p @lex_state.id2name, @space_seen
if @lex_state == EXPR_BEG or @lex_state == EXPR_ARG && @space_seen
@lex_state = EXPR_BEG
Token(TkCOLON3)
@@ -586,11 +577,6 @@ class RubyLex
Token("^")
end
- # @OP.def_rules("^=") do
- # @lex_state = EXPR_BEG
- # Token(OP_ASGN, :^)
- # end
-
@OP.def_rules(",") do
|op, io|
@lex_state = EXPR_BEG
@@ -720,16 +706,6 @@ class RubyLex
end
end
- # @OP.def_rule("def", proc{|op, io| /\s/ =~ io.peek(0)}) do
- # |op, io|
- # @indent += 1
- # @lex_state = EXPR_FNAME
- # # @lex_state = EXPR_END
- # # until @rests[0] == "\n" or @rests[0] == ";"
- # # rests.shift
- # # end
- # end
-
@OP.def_rule("") do
|op, io|
printf "MATCH: start %s: %s\n", op, io.inspect if RubyLex.debug?
@@ -842,7 +818,6 @@ class RubyLex
@indent += 1
@indent_stack.push token_c
end
- # p @indent_stack
end
elsif DEINDENT_CLAUSE.include?(token)
@@ -880,7 +855,6 @@ class RubyLex
def identify_here_document
ch = getc
-# if lt = PERCENT_LTYPE[ch]
if ch == "-"
ch = getc
indent = true
@@ -912,12 +886,6 @@ class RubyLex
end
@here_header = false
-# while l = gets
-# l = l.sub(/(:?\r)?\n\z/, '')
-# if (indent ? l.strip : l) == quoted
-# break
-# end
-# end
line = ""
while ch = getc
@@ -954,11 +922,6 @@ class RubyLex
else
RubyLex.fail SyntaxError, "unknown type of %string"
end
-# if ch !~ /\W/
-# ungetc
-# next
-# end
- #@ltype = lt
@quoted = ch unless @quoted = PERCENT_PAREN[ch]
identify_string(lt, @quoted)
end
@@ -1147,9 +1110,6 @@ class RubyLex
@ltype = "#"
while ch = getc
-# if ch == "\\" #"
-# read_escape
-# end
if ch == "\n"
@ltype = nil
ungetc
diff --git a/lib/irb/ruby-token.rb b/lib/irb/ruby-token.rb
index 4f36cf0cee..52aebe7246 100644
--- a/lib/irb/ruby-token.rb
+++ b/lib/irb/ruby-token.rb
@@ -186,7 +186,6 @@ module RubyToken
[:TkRSHFT, TkOp, ">>"],
[:TkCOLON2, TkOp],
[:TkCOLON3, TkOp],
-# [:OPASGN, TkOp], # +=, -= etc. #
[:TkASSOC, TkOp, "=>"],
[:TkQUESTION, TkOp, "?"], #?
[:TkCOLON, TkOp, ":"], #:
diff --git a/lib/irb/slex.rb b/lib/irb/slex.rb
index 4f0c16a81a..cd11edf291 100644
--- a/lib/irb/slex.rb
+++ b/lib/irb/slex.rb
@@ -247,7 +247,6 @@ end
# :startdoc:
if $0 == __FILE__
- # Tracer.on
case $1
when "1"
tr = SLex.new
@@ -281,4 +280,3 @@ if $0 == __FILE__
end
exit
end
-
diff --git a/lib/irb/xmp.rb b/lib/irb/xmp.rb
index 2e3fefc4ba..8accdb96a2 100644
--- a/lib/irb/xmp.rb
+++ b/lib/irb/xmp.rb
@@ -54,8 +54,6 @@ class XMP
# full detail.
def initialize(bind = nil)
IRB.init_config(nil)
- #IRB.parse_opts
- #IRB.load_modules
IRB.conf[:PROMPT_MODE] = :XMP
@@ -65,7 +63,6 @@ class XMP
@irb = IRB::Irb.new(ws, @io)
@irb.context.ignore_sigint = false
-# IRB.conf[:IRB_RC].call(@irb.context) if IRB.conf[:IRB_RC]
IRB.conf[:MAIN_CONTEXT] = @irb.context
end