mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	* 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
This commit is contained in:
		
							parent
							
								
									5afa23b4a4
								
							
						
					
					
						commit
						76515504d5
					
				
					 18 changed files with 8 additions and 137 deletions
				
			
		|  | @ -1,3 +1,8 @@ | |||
| Sat Aug  9 11:02:07 2014  SHIBATA Hiroshi  <shibata.hiroshi@gmail.com> | ||||
| 
 | ||||
| 	* lib/irb.rb: removed commented-out code. | ||||
| 	* lib/irb/**/*.rb: ditto. | ||||
| 
 | ||||
| Sat Aug  9 10:35:30 2014  Laurent Arnoud  <laurent@spkdev.net> | ||||
| 
 | ||||
| 	* lib/cmath.rb: fixed indent. [fix GH-696] | ||||
|  |  | |||
|  | @ -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. | ||||
|  |  | |||
|  | @ -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} | ||||
|  |  | |||
|  | @ -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 | ||||
|  |  | |||
|  | @ -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: | ||||
|  |  | |||
|  | @ -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 | ||||
| 
 | ||||
|  |  | |||
|  | @ -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 | ||||
|  |  | |||
|  | @ -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 | ||||
|  |  | |||
|  | @ -17,7 +17,6 @@ module IRB | |||
| 
 | ||||
|     # Creates a new JobManager object | ||||
|     def initialize | ||||
|       # @jobs = [[thread, irb],...] | ||||
|       @jobs = [] | ||||
|       @current_job = nil | ||||
|     end | ||||
|  |  | |||
|  | @ -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 | ||||
|  |  | |||
|  | @ -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]], | ||||
|  |  | |||
|  | @ -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] = [] | ||||
|  |  | |||
|  | @ -117,7 +117,6 @@ module IRB | |||
|     def gets | ||||
|       print @prompt | ||||
|       l = @io.gets | ||||
| #      print @prompt, l | ||||
|       l | ||||
|     end | ||||
| 
 | ||||
|  |  | |||
|  | @ -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 | ||||
|  |  | |||
|  | @ -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 | ||||
|  |  | |||
|  | @ -186,7 +186,6 @@ module RubyToken | |||
|     [:TkRSHFT,      TkOp,   ">>"], | ||||
|     [:TkCOLON2,     TkOp], | ||||
|     [:TkCOLON3,     TkOp], | ||||
| #   [:OPASGN,	    TkOp],               # +=, -=  etc. # | ||||
|     [:TkASSOC,      TkOp,   "=>"], | ||||
|     [:TkQUESTION,   TkOp,   "?"],	 #? | ||||
|     [:TkCOLON,      TkOp,   ":"],        #: | ||||
|  |  | |||
|  | @ -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 | ||||
| 
 | ||||
|  |  | |||
|  | @ -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 | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 hsbt
						hsbt