mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	
							parent
							
								
									ecfa8dcdba
								
							
						
					
					
						commit
						79af8ce6d7
					
				
					 2 changed files with 5 additions and 1 deletions
				
			
		|  | @ -64,6 +64,7 @@ module IRB # :nodoc: | ||||||
|         on_alias_error:     [[RED, REVERSE],          ALL], |         on_alias_error:     [[RED, REVERSE],          ALL], | ||||||
|         on_class_name_error:[[RED, REVERSE],          ALL], |         on_class_name_error:[[RED, REVERSE],          ALL], | ||||||
|         on_param_error:     [[RED, REVERSE],          ALL], |         on_param_error:     [[RED, REVERSE],          ALL], | ||||||
|  |         on___end__:         [[GREEN],                 ALL], | ||||||
|       } |       } | ||||||
|     rescue NameError |     rescue NameError | ||||||
|       # Give up highlighting Ripper-incompatible older Ruby |       # Give up highlighting Ripper-incompatible older Ruby | ||||||
|  | @ -120,6 +121,7 @@ module IRB # :nodoc: | ||||||
|         symbol_state = SymbolState.new |         symbol_state = SymbolState.new | ||||||
|         colored = +'' |         colored = +'' | ||||||
|         length = 0 |         length = 0 | ||||||
|  |         end_seen = false | ||||||
| 
 | 
 | ||||||
|         scan(code, allow_last_error: !complete) do |token, str, expr| |         scan(code, allow_last_error: !complete) do |token, str, expr| | ||||||
|           # IRB::ColorPrinter skips colorizing fragments with any invalid token |           # IRB::ColorPrinter skips colorizing fragments with any invalid token | ||||||
|  | @ -138,10 +140,11 @@ module IRB # :nodoc: | ||||||
|             end |             end | ||||||
|           end |           end | ||||||
|           length += str.bytesize |           length += str.bytesize | ||||||
|  |           end_seen = true if token == :on___end__ | ||||||
|         end |         end | ||||||
| 
 | 
 | ||||||
|         # give up colorizing incomplete Ripper tokens |         # give up colorizing incomplete Ripper tokens | ||||||
|         if length != code.bytesize |         unless end_seen or length == code.bytesize | ||||||
|           return Reline::Unicode.escape_for_print(code) |           return Reline::Unicode.escape_for_print(code) | ||||||
|         end |         end | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -66,6 +66,7 @@ module TestIRB | ||||||
|         "\t" => "\t", # not ^I |         "\t" => "\t", # not ^I | ||||||
|         "foo(*%W(bar))" => "foo(*#{RED}#{BOLD}%W(#{CLEAR}#{RED}bar#{CLEAR}#{RED}#{BOLD})#{CLEAR})", |         "foo(*%W(bar))" => "foo(*#{RED}#{BOLD}%W(#{CLEAR}#{RED}bar#{CLEAR}#{RED}#{BOLD})#{CLEAR})", | ||||||
|         "$stdout" => "#{GREEN}#{BOLD}$stdout#{CLEAR}", |         "$stdout" => "#{GREEN}#{BOLD}$stdout#{CLEAR}", | ||||||
|  |         "__END__" => "#{GREEN}__END__#{CLEAR}", | ||||||
|       } |       } | ||||||
| 
 | 
 | ||||||
|       # specific to Ruby 2.7+ |       # specific to Ruby 2.7+ | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Nobuyoshi Nakada
						Nobuyoshi Nakada