ruby-changes:35032
From: hsbt <ko1@a...>
Date: Sat, 9 Aug 2014 11:03:08 +0900 (JST)
Subject: [ruby-changes:35032] hsbt:r47114 (trunk): * lib/irb.rb: removed commented-out code.
hsbt 2014-08-09 11:02:58 +0900 (Sat, 09 Aug 2014) New Revision: 47114 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=47114 Log: * lib/irb.rb: removed commented-out code. * lib/irb/**/*.rb: ditto. Modified files: trunk/ChangeLog trunk/lib/irb/cmd/load.rb trunk/lib/irb/completion.rb trunk/lib/irb/context.rb trunk/lib/irb/ext/change-ws.rb trunk/lib/irb/ext/history.rb trunk/lib/irb/ext/loader.rb trunk/lib/irb/ext/multi-irb.rb trunk/lib/irb/ext/save-history.rb trunk/lib/irb/extend-command.rb trunk/lib/irb/init.rb trunk/lib/irb/input-method.rb trunk/lib/irb/inspector.rb trunk/lib/irb/ruby-lex.rb trunk/lib/irb/ruby-token.rb trunk/lib/irb/slex.rb trunk/lib/irb/xmp.rb trunk/lib/irb.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 47113) +++ ChangeLog (revision 47114) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Sat Aug 9 11:02:07 2014 SHIBATA Hiroshi <shibata.hiroshi@g...> + + * lib/irb.rb: removed commented-out code. + * lib/irb/**/*.rb: ditto. + Sat Aug 9 10:35:30 2014 Laurent Arnoud <laurent@s...> * lib/cmath.rb: fixed indent. [fix GH-696] Index: lib/irb/input-method.rb =================================================================== --- lib/irb/input-method.rb (revision 47113) +++ lib/irb/input-method.rb (revision 47114) @@ -117,7 +117,6 @@ module IRB https://github.com/ruby/ruby/blob/trunk/lib/irb/input-method.rb#L117 def gets print @prompt l = @io.gets -# print @prompt, l l end Index: lib/irb/context.rb =================================================================== --- lib/irb/context.rb (revision 47113) +++ lib/irb/context.rb (revision 47114) @@ -30,7 +30,6 @@ module IRB https://github.com/ruby/ruby/blob/trunk/lib/irb/context.rb#L30 @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 https://github.com/ruby/ruby/blob/trunk/lib/irb/context.rb#L377 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: Index: lib/irb/ext/save-history.rb =================================================================== --- lib/irb/ext/save-history.rb (revision 47113) +++ lib/irb/ext/save-history.rb (revision 47114) @@ -59,23 +59,7 @@ module IRB https://github.com/ruby/ruby/blob/trunk/lib/irb/ext/save-history.rb#L59 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 Index: lib/irb/ext/history.rb =================================================================== --- lib/irb/ext/history.rb (revision 47113) +++ lib/irb/ext/history.rb (revision 47114) @@ -21,8 +21,7 @@ module IRB # :nodoc: https://github.com/ruby/ruby/blob/trunk/lib/irb/ext/history.rb#L21 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 Index: lib/irb/ext/multi-irb.rb =================================================================== --- lib/irb/ext/multi-irb.rb (revision 47113) +++ lib/irb/ext/multi-irb.rb (revision 47114) @@ -17,7 +17,6 @@ module IRB https://github.com/ruby/ruby/blob/trunk/lib/irb/ext/multi-irb.rb#L17 # Creates a new JobManager object def initialize - # @jobs = [[thread, irb],...] @jobs = [] @current_job = nil end Index: lib/irb/ext/loader.rb =================================================================== --- lib/irb/ext/loader.rb (revision 47113) +++ lib/irb/ext/loader.rb (revision 47114) @@ -82,7 +82,6 @@ module IRB # :nodoc: https://github.com/ruby/ruby/blob/trunk/lib/irb/ext/loader.rb#L82 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 Index: lib/irb/ext/change-ws.rb =================================================================== --- lib/irb/ext/change-ws.rb (revision 47113) +++ lib/irb/ext/change-ws.rb (revision 47114) @@ -40,30 +40,6 @@ module IRB # :nodoc: https://github.com/ruby/ruby/blob/trunk/lib/irb/ext/change-ws.rb#L40 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 Index: lib/irb/ruby-token.rb =================================================================== --- lib/irb/ruby-token.rb (revision 47113) +++ lib/irb/ruby-token.rb (revision 47114) @@ -186,7 +186,6 @@ module RubyToken https://github.com/ruby/ruby/blob/trunk/lib/irb/ruby-token.rb#L186 [:TkRSHFT, TkOp, ">>"], [:TkCOLON2, TkOp], [:TkCOLON3, TkOp], -# [:OPASGN, TkOp], # +=, -= etc. # [:TkASSOC, TkOp, "=>"], [:TkQUESTION, TkOp, "?"], #? [:TkCOLON, TkOp, ":"], #: Index: lib/irb/cmd/load.rb =================================================================== --- lib/irb/cmd/load.rb (revision 47113) +++ lib/irb/cmd/load.rb (revision 47114) @@ -19,7 +19,6 @@ module IRB https://github.com/ruby/ruby/blob/trunk/lib/irb/cmd/load.rb#L19 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 https://github.com/ruby/ruby/blob/trunk/lib/irb/cmd/load.rb#L27 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} Index: lib/irb/init.rb =================================================================== --- lib/irb/init.rb (revision 47113) +++ lib/irb/init.rb (revision 47114) @@ -88,7 +88,6 @@ module IRB # :nodoc: https://github.com/ruby/ruby/blob/trunk/lib/irb/init.rb#L88 }, :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: https://github.com/ruby/ruby/blob/trunk/lib/irb/init.rb#L109 @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] = [] Index: lib/irb/extend-command.rb =================================================================== --- lib/irb/extend-command.rb (revision 47113) +++ lib/irb/extend-command.rb (revision 47114) @@ -49,28 +49,18 @@ module IRB # :nodoc: https://github.com/ruby/ruby/blob/trunk/lib/irb/extend-command.rb#L49 [: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: https://github.com/ruby/ruby/blob/trunk/lib/irb/extend-command.rb#L71 [: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]], Index: lib/irb/xmp.rb =================================================================== --- lib/irb/xmp.rb (revision 47113) +++ lib/irb/xmp.rb (revision 47114) @@ -54,8 +54,6 @@ class XMP https://github.com/ruby/ruby/blob/trunk/lib/irb/xmp.rb#L54 # 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 https://github.com/ruby/ruby/blob/trunk/lib/irb/xmp.rb#L63 @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 Index: lib/irb/inspector.rb =================================================================== --- lib/irb/inspector.rb (revision 47113) +++ lib/irb/inspector.rb (revision 47114) @@ -61,20 +61,6 @@ module IRB # :nodoc: https://github.com/ruby/ruby/blob/trunk/lib/irb/inspector.rb#L61 # 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 Index: lib/irb/ruby-lex.rb =================================================================== --- lib/irb/ruby-lex.rb (revision 47113) +++ lib/irb/ruby-lex.rb (revision 47114) @@ -101,7 +101,6 @@ class RubyLex https://github.com/ruby/ruby/blob/trunk/lib/irb/ruby-lex.rb#L101 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 https://github.com/ruby/ruby/blob/trunk/lib/irb/ruby-lex.rb#L265 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 https://github.com/ruby/ruby/blob/trunk/lib/irb/ruby-lex.rb#L275 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 https://github.com/ruby/ruby/blob/trunk/lib/irb/ruby-lex.rb#L292 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 https://github.com/ruby/ruby/blob/trunk/lib/irb/ruby-lex.rb#L546 @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 https://github.com/ruby/ruby/blob/trunk/lib/irb/ruby-lex.rb#L577 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 https://github.com/ruby/ruby/blob/trunk/lib/irb/ruby-lex.rb#L706 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 https://github.com/ruby/ruby/blob/trunk/lib/irb/ruby-lex.rb#L818 @indent += 1 @indent_stack.push token_c end - # p @indent_stack end elsif DEINDENT_CLAUSE.include?(token) @@ -880,7 +855,6 @@ class RubyLex https://github.com/ruby/ruby/blob/trunk/lib/irb/ruby-lex.rb#L855 def identify_here_document ch = getc -# if lt = PERCENT_LTYPE[ch] if ch == "-" ch = getc indent = true @@ -912,12 +886,6 @@ class RubyLex https://github.com/ruby/ruby/blob/trunk/lib/irb/ruby-lex.rb#L886 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 https://github.com/ruby/ruby/blob/trunk/lib/irb/ruby-lex.rb#L922 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 https://github.com/ruby/ruby/blob/trunk/lib/irb/ruby-lex.rb#L1110 @ltype = "#" while ch = getc -# if ch == "\\" #" -# read_escape -# end if ch == "\n" @ltype = nil ungetc Index: lib/irb/completion.rb =================================================================== --- lib/irb/completion.rb (revision 47113) +++ lib/irb/completion.rb (revision 47114) @@ -38,8 +38,6 @@ module IRB https://github.com/ruby/ruby/blob/trunk/lib/irb/completion.rb#L38 CompletionProc = proc { |input| bind = IRB.conf[:MAIN_CONTEXT].workspace.binding - # puts "input: #{input}" - case input when /^((["'`]).*\2)\.([^.]*)$/ # String @@ -90,7 +88,6 @@ module IRB https://github.com/ruby/ruby/blob/trunk/lib/irb/completion.rb#L88 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 https://github.com/ruby/ruby/blob/trunk/lib/irb/completion.rb#L140 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 https://github.com/ruby/ruby/blob/trunk/lib/irb/completion.rb#L222 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 Index: lib/irb/slex.rb =================================================================== --- lib/irb/slex.rb (revision 47113) +++ lib/irb/slex.rb (revision 47114) @@ -247,7 +247,6 @@ end https://github.com/ruby/ruby/blob/trunk/lib/irb/slex.rb#L247 # :startdoc: if $0 == __FILE__ - # Tracer.on case $1 when "1" tr = SLex.new @@ -281,4 +280,3 @@ if $0 == __FILE__ https://github.com/ruby/ruby/blob/trunk/lib/irb/slex.rb#L280 end exit end - Index: lib/irb.rb =================================================================== --- lib/irb.rb (revision 47113) +++ lib/irb.rb (revision 47114) @@ -13,7 +13,6 @@ require "e2mmap" https://github.com/ruby/ruby/blob/trunk/lib/irb.rb#L13 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 https://github.com/ruby/ruby/blob/trunk/lib/irb.rb#L398 ensure irb_at_exit end -# print "\n" end # Calls each event hook of IRB.conf[:AT_EXIT] when the current session quits. -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/