summaryrefslogtreecommitdiff
path: root/lib/irb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/irb')
-rw-r--r--lib/irb/cmd/chws.rb4
-rw-r--r--lib/irb/cmd/fork.rb6
-rw-r--r--lib/irb/cmd/help.rb2
-rw-r--r--lib/irb/cmd/load.rb8
-rw-r--r--lib/irb/cmd/nop.rb6
-rw-r--r--lib/irb/cmd/pushws.rb4
-rw-r--r--lib/irb/cmd/subirb.rb4
-rw-r--r--lib/irb/completion.rb26
-rw-r--r--lib/irb/context.rb12
-rw-r--r--lib/irb/ext/change-ws.rb10
-rw-r--r--lib/irb/ext/history.rb8
-rw-r--r--lib/irb/ext/loader.rb10
-rw-r--r--lib/irb/ext/math-mode.rb4
-rw-r--r--lib/irb/ext/multi-irb.rb12
-rw-r--r--lib/irb/ext/save-history.rb4
-rw-r--r--lib/irb/ext/tracer.rb8
-rw-r--r--lib/irb/ext/use-loader.rb6
-rw-r--r--lib/irb/ext/workspaces.rb4
-rw-r--r--lib/irb/extend-command.rb16
-rw-r--r--lib/irb/frame.rb4
-rw-r--r--lib/irb/help.rb2
-rw-r--r--lib/irb/init.rb8
-rw-r--r--lib/irb/input-method.rb12
-rw-r--r--lib/irb/lc/error.rb4
-rw-r--r--lib/irb/lc/ja/error.rb4
-rw-r--r--lib/irb/locale.rb10
-rw-r--r--lib/irb/notifier.rb14
-rw-r--r--lib/irb/output-method.rb6
-rw-r--r--lib/irb/ruby-lex.rb90
-rw-r--r--lib/irb/ruby-token.rb16
-rw-r--r--lib/irb/slex.rb36
-rw-r--r--lib/irb/version.rb2
-rw-r--r--lib/irb/workspace.rb14
-rw-r--r--lib/irb/ws-for-case-2.rb4
-rw-r--r--lib/irb/xmp.rb2
35 files changed, 191 insertions, 191 deletions
diff --git a/lib/irb/cmd/chws.rb b/lib/irb/cmd/chws.rb
index c2db7e5d91..e225b52585 100644
--- a/lib/irb/cmd/chws.rb
+++ b/lib/irb/cmd/chws.rb
@@ -1,12 +1,12 @@
#
-# change-ws.rb -
+# change-ws.rb -
# $Release Version: 0.9.5$
# $Revision$
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
# --
#
-#
+#
#
require "irb/cmd/nop.rb"
diff --git a/lib/irb/cmd/fork.rb b/lib/irb/cmd/fork.rb
index 6f4133c047..534f13f56a 100644
--- a/lib/irb/cmd/fork.rb
+++ b/lib/irb/cmd/fork.rb
@@ -1,12 +1,12 @@
#
-# fork.rb -
+# fork.rb -
# $Release Version: 0.9.5 $
# $Revision$
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
# --
#
-#
+#
#
@RCS_ID='-$Id$-'
@@ -17,7 +17,7 @@ module IRB
class Fork<Nop
def execute(&block)
pid = send ExtendCommand.irb_original_method_name("fork")
- unless pid
+ unless pid
class<<self
alias_method :exit, ExtendCommand.irb_original_method_name('exit')
end
diff --git a/lib/irb/cmd/help.rb b/lib/irb/cmd/help.rb
index e1f47e2c97..146acdfa81 100644
--- a/lib/irb/cmd/help.rb
+++ b/lib/irb/cmd/help.rb
@@ -5,7 +5,7 @@
#
# --
#
-#
+#
#
require 'rdoc/ri/driver'
diff --git a/lib/irb/cmd/load.rb b/lib/irb/cmd/load.rb
index cda9a053fe..5988b7bbd1 100644
--- a/lib/irb/cmd/load.rb
+++ b/lib/irb/cmd/load.rb
@@ -1,12 +1,12 @@
#
-# load.rb -
+# load.rb -
# $Release Version: 0.9.5$
# $Revision$
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
# --
#
-#
+#
#
require "irb/cmd/nop.rb"
@@ -25,7 +25,7 @@ module IRB
class Require<Nop
include IrbLoader
-
+
def execute(file_name)
# return ruby_require(file_name) unless IRB.conf[:USE_LOADER]
@@ -44,7 +44,7 @@ module IRB
when /\.(so|o|sl)$/
return ruby_require(file_name)
end
-
+
begin
irb_load(f = file_name + ".rb")
$".push f
diff --git a/lib/irb/cmd/nop.rb b/lib/irb/cmd/nop.rb
index 0b68098d4f..873c0f43f4 100644
--- a/lib/irb/cmd/nop.rb
+++ b/lib/irb/cmd/nop.rb
@@ -1,17 +1,17 @@
#
-# nop.rb -
+# nop.rb -
# $Release Version: 0.9.5$
# $Revision$
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
# --
#
-#
+#
#
module IRB
module ExtendCommand
class Nop
-
+
@RCS_ID='-$Id$-'
def self.execute(conf, *opts)
diff --git a/lib/irb/cmd/pushws.rb b/lib/irb/cmd/pushws.rb
index b5b41501af..a82939f39d 100644
--- a/lib/irb/cmd/pushws.rb
+++ b/lib/irb/cmd/pushws.rb
@@ -1,12 +1,12 @@
#
-# change-ws.rb -
+# change-ws.rb -
# $Release Version: 0.9.5$
# $Revision$
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
# --
#
-#
+#
#
require "irb/cmd/nop.rb"
diff --git a/lib/irb/cmd/subirb.rb b/lib/irb/cmd/subirb.rb
index 5eccf9f2c1..bf41ec50cc 100644
--- a/lib/irb/cmd/subirb.rb
+++ b/lib/irb/cmd/subirb.rb
@@ -1,13 +1,13 @@
#!/usr/local/bin/ruby
#
-# multi.rb -
+# multi.rb -
# $Release Version: 0.9.5$
# $Revision$
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
# --
#
-#
+#
#
require "irb/cmd/nop.rb"
diff --git a/lib/irb/completion.rb b/lib/irb/completion.rb
index 26339f217d..a31bee0c76 100644
--- a/lib/irb/completion.rb
+++ b/lib/irb/completion.rb
@@ -1,5 +1,5 @@
#
-# irb/completor.rb -
+# irb/completor.rb -
# $Release Version: 0.9$
# $Revision$
# by Keiju ISHITSUKA(keiju@ishitsuka.com)
@@ -15,16 +15,16 @@ module IRB
ReservedWords = [
"BEGIN", "END",
- "alias", "and",
- "begin", "break",
+ "alias", "and",
+ "begin", "break",
"case", "class",
"def", "defined", "do",
"else", "elsif", "end", "ensure",
- "false", "for",
- "if", "in",
- "module",
+ "false", "for",
+ "if", "in",
+ "module",
"next", "nil", "not",
- "or",
+ "or",
"redo", "rescue", "retry", "return",
"self", "super",
"then", "true",
@@ -32,10 +32,10 @@ module IRB
"when", "while",
"yield",
]
-
+
CompletionProc = proc { |input|
bind = IRB.conf[:MAIN_CONTEXT].workspace.binding
-
+
# puts "input: #{input}"
case input
@@ -63,7 +63,7 @@ module IRB
candidates = Proc.instance_methods.collect{|m| m.to_s}
candidates |= Hash.instance_methods.collect{|m| m.to_s}
select_message(receiver, message, candidates)
-
+
when /^(:[^:.]*)$/
# Symbol
if Symbol.respond_to?(:all_symbols)
@@ -137,7 +137,7 @@ module IRB
gv = eval("global_variables", bind).collect{|m| m.to_s}
lv = eval("local_variables", bind).collect{|m| m.to_s}
cv = eval("self.class.constants", bind).collect{|m| m.to_s}
-
+
if (gv | lv | cv).include?(receiver)
# foo.func and foo is local var.
candidates = eval("#{receiver}.methods", bind).collect{|m| m.to_s}
@@ -157,7 +157,7 @@ module IRB
rescue Exception
name = ""
end
- next if name != "IRB::Context" and
+ next if name != "IRB::Context" and
/^(IRB|SLex|RubyLex|RubyToken)/ =~ name
candidates.concat m.instance_methods(false).collect{|x| x.to_s}
}
@@ -177,7 +177,7 @@ module IRB
else
candidates = eval("methods | private_methods | local_variables | self.class.constants", bind).collect{|m| m.to_s}
-
+
(candidates|ReservedWords).grep(/^#{Regexp.quote(input)}/)
end
}
diff --git a/lib/irb/context.rb b/lib/irb/context.rb
index e2ab05a341..a3f5e5a79c 100644
--- a/lib/irb/context.rb
+++ b/lib/irb/context.rb
@@ -6,7 +6,7 @@
#
# --
#
-#
+#
#
require "irb/workspace"
@@ -45,7 +45,7 @@ module IRB
@ignore_eof = IRB.conf[:IGNORE_EOF]
@back_trace_limit = IRB.conf[:BACK_TRACE_LIMIT]
-
+
self.prompt_mode = IRB.conf[:PROMPT_MODE]
if IRB.conf[:SINGLE_IRB] or !defined?(JobManager)
@@ -90,7 +90,7 @@ module IRB
@output_method = StdioOutputMethod.new
end
- @verbose = IRB.conf[:VERBOSE]
+ @verbose = IRB.conf[:VERBOSE]
@echo = IRB.conf[:ECHO]
if @echo.nil?
@echo = true
@@ -106,7 +106,7 @@ module IRB
attr_accessor :workspace
attr_reader :thread
attr_accessor :io
-
+
attr_accessor :irb
attr_accessor :ap_name
attr_accessor :rc
@@ -141,7 +141,7 @@ module IRB
def verbose?
if @verbose.nil?
- if defined?(ReadlineInputMethod) && @io.kind_of?(ReadlineInputMethod)
+ if defined?(ReadlineInputMethod) && @io.kind_of?(ReadlineInputMethod)
false
elsif !STDIN.tty? or @io.kind_of?(FileInputMethod)
true
@@ -179,7 +179,7 @@ module IRB
@auto_indent_mode = IRB.conf[:AUTO_INDENT]
end
end
-
+
def inspect?
@inspect_mode.nil? or @inspect_mode
end
diff --git a/lib/irb/ext/change-ws.rb b/lib/irb/ext/change-ws.rb
index 217d4a58ef..3ae1eab7a4 100644
--- a/lib/irb/ext/change-ws.rb
+++ b/lib/irb/ext/change-ws.rb
@@ -1,12 +1,12 @@
#
-# irb/ext/cb.rb -
+# irb/ext/cb.rb -
# $Release Version: 0.9.5$
# $Revision$
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
# --
#
-#
+#
#
module IRB
@@ -22,12 +22,12 @@ module IRB
def change_workspace(*_main)
if _main.empty?
- @workspace = home_workspace
+ @workspace = home_workspace
return main
end
-
+
@workspace = WorkSpace.new(_main[0])
-
+
if !(class<<main;ancestors;end).include?(ExtendCommandBundle)
main.extend ExtendCommandBundle
end
diff --git a/lib/irb/ext/history.rb b/lib/irb/ext/history.rb
index a12700ce19..9142146c42 100644
--- a/lib/irb/ext/history.rb
+++ b/lib/irb/ext/history.rb
@@ -1,12 +1,12 @@
#
-# history.rb -
+# history.rb -
# $Release Version: 0.9.5$
# $Revision$
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
# --
#
-#
+#
#
module IRB
@@ -56,7 +56,7 @@ module IRB
end
def size(size)
- if size != 0 && size < @size
+ if size != 0 && size < @size
@contents = @contents[@size - size .. @size]
end
@size = size
@@ -78,7 +78,7 @@ module IRB
@contents.push [no, val]
@contents.shift if @size != 0 && @contents.size > @size
end
-
+
alias real_inspect inspect
def inspect
diff --git a/lib/irb/ext/loader.rb b/lib/irb/ext/loader.rb
index 2d4400caef..cee8f51cc9 100644
--- a/lib/irb/ext/loader.rb
+++ b/lib/irb/ext/loader.rb
@@ -1,12 +1,12 @@
#
-# loader.rb -
+# loader.rb -
# $Release Version: 0.9.5$
# $Revision$
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
# --
#
-#
+#
#
@@ -44,7 +44,7 @@ module IRB
irb.suspend_name(path, File.basename(path)) do
irb.suspend_input_method(FileInputMethod.new(path)) do
|back_io|
- irb.signal_status(:IN_LOAD) do
+ irb.signal_status(:IN_LOAD) do
if back_io.kind_of?(FileInputMethod)
irb.eval_input
else
@@ -61,7 +61,7 @@ module IRB
def load_file(path, priv = nil)
irb.suspend_name(path, File.basename(path)) do
-
+
if priv
ws = WorkSpace.new(Module.new)
else
@@ -70,7 +70,7 @@ module IRB
irb.suspend_workspace(ws) do
irb.suspend_input_method(FileInputMethod.new(path)) do
|back_io|
- irb.signal_status(:IN_LOAD) do
+ irb.signal_status(:IN_LOAD) do
# p irb.conf
if back_io.kind_of?(FileInputMethod)
irb.eval_input
diff --git a/lib/irb/ext/math-mode.rb b/lib/irb/ext/math-mode.rb
index 450a21eff7..370fab229d 100644
--- a/lib/irb/ext/math-mode.rb
+++ b/lib/irb/ext/math-mode.rb
@@ -1,12 +1,12 @@
#
-# math-mode.rb -
+# math-mode.rb -
# $Release Version: 0.9.5$
# $Revision$
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
# --
#
-#
+#
#
require "mathn"
diff --git a/lib/irb/ext/multi-irb.rb b/lib/irb/ext/multi-irb.rb
index d32d41ff95..5085a3f272 100644
--- a/lib/irb/ext/multi-irb.rb
+++ b/lib/irb/ext/multi-irb.rb
@@ -6,7 +6,7 @@
#
# --
#
-#
+#
#
IRB.fail CantShiftToMultiIrbMode unless defined?(Thread)
require "thread"
@@ -66,7 +66,7 @@ module IRB
IRB.fail IrbAlreadyDead unless th.alive?
th.exit
end
- end
+ end
def search(key)
job = case key
@@ -123,8 +123,8 @@ module IRB
t_status = "exited"
end
ary.push format("#%d->%s on %s (%s: %s)",
- i,
- irb.context.irb_name,
+ i,
+ irb.context.irb_name,
irb.context.main,
th,
t_status)
@@ -143,14 +143,14 @@ module IRB
IRB.JobManager.irb(Thread.current).context
end
- # invoke multi-irb
+ # invoke multi-irb
def IRB.irb(file = nil, *main)
workspace = WorkSpace.new(*main)
parent_thread = Thread.current
Thread.start do
begin
irb = Irb.new(workspace, file)
- rescue
+ rescue
print "Subirb can't start with context(self): ", workspace.main.inspect, "\n"
print "return to main irb\n"
Thread.pass
diff --git a/lib/irb/ext/save-history.rb b/lib/irb/ext/save-history.rb
index 88610fe9c9..4d53844d5f 100644
--- a/lib/irb/ext/save-history.rb
+++ b/lib/irb/ext/save-history.rb
@@ -1,13 +1,13 @@
#!/usr/local/bin/ruby
#
-# save-history.rb -
+# save-history.rb -
# $Release Version: 0.9.5$
# $Revision$
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
# --
#
-#
+#
#
require "readline"
diff --git a/lib/irb/ext/tracer.rb b/lib/irb/ext/tracer.rb
index df954af20b..6728c46137 100644
--- a/lib/irb/ext/tracer.rb
+++ b/lib/irb/ext/tracer.rb
@@ -1,12 +1,12 @@
#
-# irb/lib/tracer.rb -
+# irb/lib/tracer.rb -
# $Release Version: 0.9.5$
# $Revision$
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
# --
#
-#
+#
#
require "tracer"
@@ -43,7 +43,7 @@ module IRB
alias __evaluate__ evaluate
def evaluate(context, statements, file = nil, line = nil)
if context.use_tracer? && file != nil && line != nil
- Tracer.on
+ Tracer.on
begin
__evaluate__(context, statements, file, line)
ensure
@@ -57,4 +57,4 @@ module IRB
IRB.initialize_tracer
end
-
+
diff --git a/lib/irb/ext/use-loader.rb b/lib/irb/ext/use-loader.rb
index 3836275fcd..b643dd099e 100644
--- a/lib/irb/ext/use-loader.rb
+++ b/lib/irb/ext/use-loader.rb
@@ -1,12 +1,12 @@
#
-# use-loader.rb -
+# use-loader.rb -
# $Release Version: 0.9.5$
# $Revision$
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
# --
#
-#
+#
#
require "irb/cmd/load"
@@ -30,7 +30,7 @@ module IRB
class Context
IRB.conf[:USE_LOADER] = false
-
+
def use_loader
IRB.conf[:USE_LOADER]
end
diff --git a/lib/irb/ext/workspaces.rb b/lib/irb/ext/workspaces.rb
index f3ae8d1ae8..654b8118ea 100644
--- a/lib/irb/ext/workspaces.rb
+++ b/lib/irb/ext/workspaces.rb
@@ -1,12 +1,12 @@
#
-# push-ws.rb -
+# push-ws.rb -
# $Release Version: 0.9.5$
# $Revision$
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
# --
#
-#
+#
#
module IRB
diff --git a/lib/irb/extend-command.rb b/lib/irb/extend-command.rb
index 2816f35116..61a43e4a78 100644
--- a/lib/irb/extend-command.rb
+++ b/lib/irb/extend-command.rb
@@ -1,12 +1,12 @@
#
-# irb/extend-command.rb - irb extend command
+# irb/extend-command.rb - irb extend command
# $Release Version: 0.9.5$
# $Revision$
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
# --
#
-#
+#
#
module IRB
#
@@ -89,15 +89,15 @@ module IRB
[:irb_load, :Load, "irb/cmd/load"],
[:irb_require, :Require, "irb/cmd/load"],
- [:irb_source, :Source, "irb/cmd/load",
+ [:irb_source, :Source, "irb/cmd/load",
[:source, NO_OVERRIDE]],
[:irb, :IrbCommand, "irb/cmd/subirb"],
- [:irb_jobs, :Jobs, "irb/cmd/subirb",
+ [:irb_jobs, :Jobs, "irb/cmd/subirb",
[:jobs, NO_OVERRIDE]],
- [:irb_fg, :Foreground, "irb/cmd/subirb",
+ [:irb_fg, :Foreground, "irb/cmd/subirb",
[:fg, NO_OVERRIDE]],
- [:irb_kill, :Kill, "irb/cmd/subirb",
+ [:irb_kill, :Kill, "irb/cmd/subirb",
[:kill, OVERRIDE_PRIVATE_ONLY]],
[:irb_help, :Help, "irb/cmd/help",
@@ -161,9 +161,9 @@ module IRB
(override == NO_OVERRIDE) && !respond_to?(to, true)
target = self
(class<<self;self;end).instance_eval{
- if target.respond_to?(to, true) &&
+ if target.respond_to?(to, true) &&
!target.respond_to?(EXCB.irb_original_method_name(to), true)
- alias_method(EXCB.irb_original_method_name(to), to)
+ alias_method(EXCB.irb_original_method_name(to), to)
end
alias_method to, from
}
diff --git a/lib/irb/frame.rb b/lib/irb/frame.rb
index 8a5d0696fb..8814b47a9d 100644
--- a/lib/irb/frame.rb
+++ b/lib/irb/frame.rb
@@ -1,12 +1,12 @@
#
-# frame.rb -
+# frame.rb -
# $Release Version: 0.9$
# $Revision$
# by Keiju ISHITSUKA(Nihon Rational Software Co.,Ltd)
#
# --
#
-#
+#
#
require "e2mmap"
diff --git a/lib/irb/help.rb b/lib/irb/help.rb
index 2b064d5d6d..cae9c8a832 100644
--- a/lib/irb/help.rb
+++ b/lib/irb/help.rb
@@ -6,7 +6,7 @@
#
# --
#
-#
+#
#
require 'irb/magic-file'
diff --git a/lib/irb/init.rb b/lib/irb/init.rb
index 62c862a1c3..8f88802f5d 100644
--- a/lib/irb/init.rb
+++ b/lib/irb/init.rb
@@ -6,7 +6,7 @@
#
# --
#
-#
+#
#
module IRB
@@ -20,7 +20,7 @@ module IRB
IRB.load_modules
unless @CONF[:PROMPT][@CONF[:PROMPT_MODE]]
- IRB.fail(UndefinedPromptMode, @CONF[:PROMPT_MODE])
+ IRB.fail(UndefinedPromptMode, @CONF[:PROMPT_MODE])
end
end
@@ -112,7 +112,7 @@ module IRB
# @CONF[:LC_MESSAGES] = "en"
@CONF[:LC_MESSAGES] = Locale.new
-
+
@CONF[:DEBUG_LEVEL] = 1
end
@@ -246,7 +246,7 @@ module IRB
yield proc{|rc| rc == "rc" ? irbrc : irbrc+rc}
end
if home = ENV["HOME"]
- yield proc{|rc| home+"/.irb#{rc}"}
+ yield proc{|rc| home+"/.irb#{rc}"}
end
home = Dir.pwd
yield proc{|rc| home+"/.irb#{rc}"}
diff --git a/lib/irb/input-method.rb b/lib/irb/input-method.rb
index 0b22d9ca74..9c3d682c66 100644
--- a/lib/irb/input-method.rb
+++ b/lib/irb/input-method.rb
@@ -6,13 +6,13 @@
#
# --
#
-#
+#
#
require 'irb/src_encoding'
require 'irb/magic-file'
module IRB
- #
+ #
# InputMethod
# StdioInputMethod
# FileInputMethod
@@ -28,7 +28,7 @@ module IRB
attr_reader :file_name
attr_accessor :prompt
-
+
def gets
IRB.fail NotImplementedError, "gets"
end
@@ -38,7 +38,7 @@ module IRB
false
end
end
-
+
class StdioInputMethod < InputMethod
def initialize
super
@@ -70,7 +70,7 @@ module IRB
@stdin.external_encoding
end
end
-
+
class FileInputMethod < InputMethod
def initialize(file)
super
@@ -97,7 +97,7 @@ module IRB
begin
require "readline"
class ReadlineInputMethod < InputMethod
- include Readline
+ include Readline
def initialize
super
diff --git a/lib/irb/lc/error.rb b/lib/irb/lc/error.rb
index acfa22c2af..ed7d0361fe 100644
--- a/lib/irb/lc/error.rb
+++ b/lib/irb/lc/error.rb
@@ -1,12 +1,12 @@
#
-# irb/lc/error.rb -
+# irb/lc/error.rb -
# $Release Version: 0.9.5$
# $Revision$
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
# --
#
-#
+#
#
require "e2mmap"
diff --git a/lib/irb/lc/ja/error.rb b/lib/irb/lc/ja/error.rb
index dc0345e6df..c73b640637 100644
--- a/lib/irb/lc/ja/error.rb
+++ b/lib/irb/lc/ja/error.rb
@@ -1,12 +1,12 @@
# -*- coding: utf-8 -*-
-# irb/lc/ja/error.rb -
+# irb/lc/ja/error.rb -
# $Release Version: 0.9.5$
# $Revision$
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
# --
#
-#
+#
#
require "e2mmap"
diff --git a/lib/irb/locale.rb b/lib/irb/locale.rb
index d4e2a0244a..9c96d15525 100644
--- a/lib/irb/locale.rb
+++ b/lib/irb/locale.rb
@@ -6,7 +6,7 @@
#
# --
#
-#
+#
#
module IRB
class Locale
@@ -30,7 +30,7 @@ module IRB
def initialize(locale = nil)
@lang = @territory = @encoding_name = @modifier = nil
- @locale = locale || ENV["IRB_LANG"] || ENV["LC_MESSAGES"] || ENV["LC_ALL"] || ENV["LANG"] || "C"
+ @locale = locale || ENV["IRB_LANG"] || ENV["LC_MESSAGES"] || ENV["LC_ALL"] || ENV["LANG"] || "C"
if m = LOCALE_NAME_RE.match(@locale)
@lang, @territory, @encoding_name, @modifier = m[:language], m[:territory], m[:codeset], m[:modifier]
@@ -50,7 +50,7 @@ module IRB
def String(mes)
mes = super(mes)
if @encoding
- mes.encode(@encoding)
+ mes.encode(@encoding)
else
mes
end
@@ -109,7 +109,7 @@ module IRB
end
alias toplevel_load load
-
+
def load(file, priv=nil)
dir = File.dirname(file)
dir = "" if dir == "."
@@ -125,7 +125,7 @@ module IRB
return real_load(lc_path, priv) if lc_path
end
raise LoadError, "No such file to load -- #{file}"
- end
+ end
def real_load(path, priv)
src = MagicFile.open(path){|f| f.read}
diff --git a/lib/irb/notifier.rb b/lib/irb/notifier.rb
index 51f10ff398..f76fc8040c 100644
--- a/lib/irb/notifier.rb
+++ b/lib/irb/notifier.rb
@@ -1,12 +1,12 @@
#
-# notifier.rb - output methods used by irb
+# notifier.rb - output methods used by irb
# $Release Version: 0.9.5$
# $Revision$
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
# --
#
-#
+#
#
require "e2mmap"
@@ -15,16 +15,16 @@ require "irb/output-method"
module IRB
module Notifier
extend Exception2MessageMapper
- def_exception :ErrUndefinedNotifier,
+ def_exception :ErrUndefinedNotifier,
"undefined notifier level: %d is specified"
- def_exception :ErrUnrecognizedLevel,
+ def_exception :ErrUnrecognizedLevel,
"unrecognized notifier level: %s is specified"
def def_notifier(prefix = "", output_method = StdioOutputMethod.new)
CompositeNotifier.new(prefix, output_method)
end
module_function :def_notifier
-
+
class AbstructNotifier
def initialize(prefix, base_notifier)
@prefix = prefix
@@ -112,7 +112,7 @@ module IRB
def initialize(base, level, prefix)
super(prefix, base)
-
+
@level = level
end
@@ -121,7 +121,7 @@ module IRB
def <=>(other)
@level <=> other.level
end
-
+
def notify?
@base_notifier.level >= self
end
diff --git a/lib/irb/output-method.rb b/lib/irb/output-method.rb
index 301af7210e..bbfc072536 100644
--- a/lib/irb/output-method.rb
+++ b/lib/irb/output-method.rb
@@ -1,12 +1,12 @@
#
-# output-method.rb - optput methods used by irb
+# output-method.rb - optput methods used by irb
# $Release Version: 0.9.5$
# $Revision$
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
# --
#
-#
+#
#
require "e2mmap"
@@ -39,7 +39,7 @@ module IRB
# <minimum field width> (\*|\*[1-9][0-9]*\$|[1-9][0-9]*)
# <precision>.(\*|\*[1-9][0-9]*\$|[1-9][0-9]*|)?
# #<length modifier>(hh|h|l|ll|L|q|j|z|t)
- # <conversion specifier>[diouxXeEfgGcsb%]
+ # <conversion specifier>[diouxXeEfgGcsb%]
def parse_printf_format(format, opts)
return format, opts if $1.size % 2 == 1
end
diff --git a/lib/irb/ruby-lex.rb b/lib/irb/ruby-lex.rb
index b21f0d34f8..13b101ffc8 100644
--- a/lib/irb/ruby-lex.rb
+++ b/lib/irb/ruby-lex.rb
@@ -6,7 +6,7 @@
#
# --
#
-#
+#
#
require "e2mmap"
@@ -20,12 +20,12 @@ class RubyLex
def_exception(:AlreadyDefinedToken, "Already defined token(%s)")
def_exception(:TkReading2TokenNoKey, "key nothing(key='%s')")
def_exception(:TkSymbol2TokenNoKey, "key nothing(key='%s')")
- def_exception(:TkReading2TokenDuplicateError,
+ def_exception(:TkReading2TokenDuplicateError,
"key duplicate(token_n='%s', key='%s')")
def_exception(:SyntaxError, "%s")
def_exception(:TerminateLineInput, "Terminate Line Input")
-
+
include RubyToken
class << self
@@ -53,7 +53,7 @@ class RubyLex
@lex_state = EXPR_BEG
@space_seen = false
@here_header = false
-
+
@continue = false
@line = ""
@@ -91,7 +91,7 @@ class RubyLex
else
@base_char_no += @readed.size
end
-
+
readed = @readed.join("")
@readed = []
readed
@@ -111,7 +111,7 @@ class RubyLex
end
@seek += 1
if c == "\n"
- @line_no += 1
+ @line_no += 1
@char_no = 0
else
@char_no += 1
@@ -148,10 +148,10 @@ class RubyLex
c2 = @here_readed.pop
end
c = c2 unless c
- @rests.unshift c #c =
+ @rests.unshift c #c =
@seek -= 1
if c == "\n"
- @line_no -= 1
+ @line_no -= 1
if idx = @readed.reverse.index("\n")
@char_no = @readed.size - idx
else
@@ -216,14 +216,14 @@ class RubyLex
@lex_state = EXPR_BEG
@space_seen = false
@here_header = false
-
+
@continue = false
prompt
@line = ""
@exp_line_no = @line_no
end
-
+
def each_top_level_statement
initialize_input
catch(:TERM_INPUT) do
@@ -297,7 +297,7 @@ class RubyLex
# Tracer.off
tk
end
-
+
ENINDENT_CLAUSE = [
"case", "class", "def", "do", "for", "if",
"module", "unless", "until", "while", "begin" #, "when"
@@ -314,7 +314,7 @@ class RubyLex
"W" => "]",
"s" => ":"
}
-
+
PERCENT_PAREN = {
"{" => "}",
"[" => "]",
@@ -354,7 +354,7 @@ class RubyLex
end
@OP.def_rule("=begin",
- proc{|op, io| @prev_char_no == 0 && peek(0) =~ /\s/}) do
+ proc{|op, io| @prev_char_no == 0 && peek(0) =~ /\s/}) do
|op, io|
@ltype = "="
until getc == "\n"; end
@@ -374,8 +374,8 @@ class RubyLex
else
@continue = false
@lex_state = EXPR_BEG
- until (@indent_stack.empty? ||
- [TkLPAREN, TkLBRACK, TkLBRACE,
+ until (@indent_stack.empty? ||
+ [TkLPAREN, TkLBRACK, TkLBRACE,
TkfLPAREN, TkfLBRACK, TkfLBRACE].include?(@indent_stack.last))
@indent_stack.pop
end
@@ -385,9 +385,9 @@ class RubyLex
Token(TkNL)
end
- @OP.def_rules("*", "**",
- "=", "==", "===",
- "=~", "<=>",
+ @OP.def_rules("*", "**",
+ "=", "==", "===",
+ "=~", "<=>",
"<", "<=",
">", ">=", ">>") do
|op, io|
@@ -455,7 +455,7 @@ class RubyLex
@lex_state = EXPR_BEG;
Token(TkQUESTION)
else
- if (ch == '\\')
+ if (ch == '\\')
read_escape
end
@lex_state = EXPR_END
@@ -469,8 +469,8 @@ class RubyLex
@lex_state = EXPR_BEG
Token(op)
end
-
- @OP.def_rules("+=", "-=", "*=", "**=",
+
+ @OP.def_rules("+=", "-=", "*=", "**=",
"&=", "|=", "^=", "<<=", ">>=", "||=", "&&=") do
|op, io|
@lex_state = EXPR_BEG
@@ -529,7 +529,7 @@ class RubyLex
lex_int2
end
-
+
def lex_int2
@OP.def_rules("]", "}", ")") do
|op, io|
@@ -572,7 +572,7 @@ class RubyLex
Token(TkOPASGN, "/") #/)
elsif @lex_state == EXPR_ARG and @space_seen and peek(0) !~ /\s/
identify_string(op)
- else
+ else
@lex_state = EXPR_BEG
Token("/") #/)
end
@@ -588,7 +588,7 @@ class RubyLex
# @lex_state = EXPR_BEG
# Token(OP_ASGN, :^)
# end
-
+
@OP.def_rules(",") do
|op, io|
@lex_state = EXPR_BEG
@@ -598,8 +598,8 @@ class RubyLex
@OP.def_rules(";") do
|op, io|
@lex_state = EXPR_BEG
- until (@indent_stack.empty? ||
- [TkLPAREN, TkLBRACK, TkLBRACE,
+ until (@indent_stack.empty? ||
+ [TkLPAREN, TkLBRACK, TkLBRACE,
TkfLPAREN, TkfLBRACK, TkfLBRACE].include?(@indent_stack.last))
@indent_stack.pop
end
@@ -617,7 +617,7 @@ class RubyLex
@lex_state = EXPR_BEG
Token("~")
end
-
+
@OP.def_rule("(") do
|op, io|
@indent += 1
@@ -718,7 +718,7 @@ class RubyLex
end
end
- # @OP.def_rule("def", proc{|op, io| /\s/ =~ io.peek(0)}) do
+ # @OP.def_rule("def", proc{|op, io| /\s/ =~ io.peek(0)}) do
# |op, io|
# @indent += 1
# @lex_state = EXPR_FNAME
@@ -739,13 +739,13 @@ class RubyLex
printf "MATCH: end %s: %s\n", op, io.inspect if RubyLex.debug?
t
end
-
+
p @OP if RubyLex.debug?
end
-
+
def identify_gvar
@lex_state = EXPR_END
-
+
case ch = getc
when /[~_*$?!@\/\\;,=:<>".]/ #"
Token(TkGVAR, "$" + ch)
@@ -761,12 +761,12 @@ class RubyLex
ungetc
ungetc
identify_identifier
- else
+ else
ungetc
Token("$")
end
end
-
+
def identify_identifier
token = ""
if peek(0) =~ /[$@]/
@@ -781,7 +781,7 @@ class RubyLex
token.concat ch
end
ungetc
-
+
if (ch == "!" || ch == "?") && token[0,1] =~ /\w/ && peek(0) != "="
token.concat getc
end
@@ -799,7 +799,7 @@ class RubyLex
@lex_state = EXPR_END
return Token(TkIVAR, token)
end
-
+
if @lex_state != EXPR_DOT
print token, "\n" if RubyLex.debug?
@@ -927,7 +927,7 @@ class RubyLex
@lex_state = EXPR_END
Token(Ltype2Token[lt])
end
-
+
def identify_quotation
ch = getc
if lt = PERCENT_LTYPE[ch]
@@ -968,10 +968,10 @@ class RubyLex
match = /[0-7_]/
when /[89]/
RubyLex.fail SyntaxError, "Invalid octal digit"
- else
+ else
return Token(TkINTEGER)
end
-
+
len0 = true
non_digit = false
while ch = getc
@@ -999,7 +999,7 @@ class RubyLex
end
return Token(TkINTEGER)
end
-
+
type = TkINTEGER
allow_point = true
allow_e = true
@@ -1042,7 +1042,7 @@ class RubyLex
end
Token(type)
end
-
+
def identify_string(ltype, quoted = ltype)
@ltype = ltype
@quoted = quoted
@@ -1063,7 +1063,7 @@ class RubyLex
elsif ch == '\\' #'
read_escape
end
- if PERCENT_PAREN.values.include?(@quoted)
+ if PERCENT_PAREN.values.include?(@quoted)
if PERCENT_PAREN[ch] == @quoted
nest += 1
elsif ch == @quoted
@@ -1087,7 +1087,7 @@ class RubyLex
@lex_state = EXPR_END
end
end
-
+
def identify_comment
@ltype = "#"
@@ -1103,7 +1103,7 @@ class RubyLex
end
return Token(TkCOMMENT)
end
-
+
def read_escape
case ch = getc
when "\n", "\r", "\f"
@@ -1120,7 +1120,7 @@ class RubyLex
break
end
end
-
+
when "x"
2.times do
case ch = getc
@@ -1149,7 +1149,7 @@ class RubyLex
read_escape
end
else
- # other characters
+ # other characters
end
end
end
diff --git a/lib/irb/ruby-token.rb b/lib/irb/ruby-token.rb
index 30a94b043c..9eb3bc1739 100644
--- a/lib/irb/ruby-token.rb
+++ b/lib/irb/ruby-token.rb
@@ -1,12 +1,12 @@
#
-# irb/ruby-token.rb - ruby tokens
+# irb/ruby-token.rb - ruby tokens
# $Release Version: 0.9.5$
# $Revision$
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
# --
#
-#
+#
#
module RubyToken
EXPR_BEG = :EXPR_BEG
@@ -21,7 +21,7 @@ module RubyToken
if !defined?(Symbol)
Symbol = Integer
end
-
+
class Token
def initialize(seek, line_no, char_no)
@seek = seek
@@ -84,7 +84,7 @@ module RubyToken
if (tk = TkReading2Token[token]).nil?
IRB.fail TkReading2TokenNoKey, token
end
- tk = Token(tk[0], value)
+ tk = Token(tk[0], value)
if tk.kind_of?(TkOp)
tk.name = token
end
@@ -93,8 +93,8 @@ module RubyToken
if (tk = TkSymbol2Token[token]).nil?
IRB.fail TkSymbol2TokenNoKey, token
end
- return Token(tk[0], value)
- else
+ return Token(tk[0], value)
+ else
if (token.ancestors & [TkId, TkVal, TkOPASGN, TkUnknownChar]).empty?
token.new(@prev_seek, @prev_line_no, @prev_char_no)
else
@@ -194,7 +194,7 @@ module RubyToken
[:TkASSOC, TkOp, "=>"],
[:TkQUESTION, TkOp, "?"], #?
[:TkCOLON, TkOp, ":"], #:
-
+
[:TkfLPAREN], # func( #
[:TkfLBRACK], # func[ #
[:TkfLBRACE], # func{ #
@@ -250,7 +250,7 @@ module RubyToken
IRB.fail AlreadyDefinedToken, token_n
end
token_c = eval("class #{token_n} < #{super_token}; end; #{token_n}")
-
+
if reading
if TkReading2Token[reading]
IRB.fail TkReading2TokenDuplicateError, token_n, reading
diff --git a/lib/irb/slex.rb b/lib/irb/slex.rb
index c8b40c6878..6b3d1f37e3 100644
--- a/lib/irb/slex.rb
+++ b/lib/irb/slex.rb
@@ -6,7 +6,7 @@
#
# --
#
-#
+#
#
require "e2mmap"
@@ -24,20 +24,20 @@ module IRB
D_WARN = DOUT::def_notifier(1, "Warn: ")
D_DEBUG = DOUT::def_notifier(2, "Debug: ")
D_DETAIL = DOUT::def_notifier(4, "Detail: ")
-
+
DOUT.level = Notifier::D_NOMSG
def initialize
@head = Node.new("")
end
-
+
def def_rule(token, preproc = nil, postproc = nil, &block)
D_DETAIL.pp token
postproc = block if block_given?
node = create(token, preproc, postproc)
end
-
+
def def_rules(*tokens, &block)
if block_given?
p = block
@@ -46,18 +46,18 @@ module IRB
def_rule(token, nil, p)
end
end
-
+
def preproc(token, proc)
node = search(token)
node.preproc=proc
end
-
- #要チェック?
+
+ #要チェック?
def postproc(token)
node = search(token, proc)
node.postproc=proc
end
-
+
def search(token)
@head.search(token.split(//))
end
@@ -65,7 +65,7 @@ module IRB
def create(token, preproc = nil, postproc = nil)
@head.create_subnode(token.split(//), preproc, postproc)
end
-
+
def match(token)
case token
when Array
@@ -78,14 +78,14 @@ module IRB
D_DETAIL.exec_if{D_DEATIL.printf "match end: %s:%s\n", ret, token.inspect}
ret
end
-
+
def inspect
format("<SLex: @head = %s>", @head.inspect)
end
#----------------------------------------------------------------------
#
- # class Node -
+ # class Node -
#
#----------------------------------------------------------------------
class Node
@@ -99,7 +99,7 @@ module IRB
attr_accessor :preproc
attr_accessor :postproc
-
+
def search(chrs, opt = nil)
return self if chrs.empty?
ch = chrs.shift
@@ -114,7 +114,7 @@ module IRB
end
end
end
-
+
def create_subnode(chrs, preproc = nil, postproc = nil)
if chrs.empty?
if @postproc
@@ -127,7 +127,7 @@ module IRB
end
return self
end
-
+
ch = chrs.shift
if node = @Tree[ch]
if chrs.empty?
@@ -161,7 +161,7 @@ module IRB
# chrs: String
# character array
# io must have getc()/ungetc(); and ungetc() must be
- # able to be called arbitrary number of times.
+ # able to be called arbitrary number of times.
#
def match(chrs, op = "")
D_DETAIL.print "match>: ", chrs, "op:", op, "\n"
@@ -254,14 +254,14 @@ if $0 == __FILE__
print "1: ", tr.inspect, "\n"
tr.def_rule("==") {print "==\n"}
print "2: ", tr.inspect, "\n"
-
+
print "case 1:\n"
print tr.match("="), "\n"
print "case 2:\n"
print tr.match("=="), "\n"
print "case 3:\n"
print tr.match("=>"), "\n"
-
+
when "2"
tr = SLex.new
print "0: ", tr.inspect, "\n"
@@ -269,7 +269,7 @@ if $0 == __FILE__
print "1: ", tr.inspect, "\n"
tr.def_rule("==", proc{false}) {print "==\n"}
print "2: ", tr.inspect, "\n"
-
+
print "case 1:\n"
print tr.match("="), "\n"
print "case 2:\n"
diff --git a/lib/irb/version.rb b/lib/irb/version.rb
index 32ecf940cf..a9ccc1ce95 100644
--- a/lib/irb/version.rb
+++ b/lib/irb/version.rb
@@ -6,7 +6,7 @@
#
# --
#
-#
+#
#
module IRB
diff --git a/lib/irb/workspace.rb b/lib/irb/workspace.rb
index 7c95106c39..1b88914a84 100644
--- a/lib/irb/workspace.rb
+++ b/lib/irb/workspace.rb
@@ -1,12 +1,12 @@
#
-# irb/workspace-binding.rb -
+# irb/workspace-binding.rb -
# $Release Version: 0.9.5$
# $Revision$
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
# --
#
-#
+#
#
module IRB
class WorkSpace
@@ -21,7 +21,7 @@ module IRB
case IRB.conf[:CONTEXT_MODE]
when 0 # binding in proc on TOPLEVEL_BINDING
@binding = eval("proc{binding}.call",
- TOPLEVEL_BINDING,
+ TOPLEVEL_BINDING,
__FILE__,
__LINE__)
when 1 # binding in loaded file
@@ -37,7 +37,7 @@ EOF
when 2 # binding in loaded file(thread use)
unless defined? BINDING_QUEUE
require "thread"
-
+
IRB.const_set("BINDING_QUEUE", SizedQueue.new(1))
Thread.abort_on_exception = true
Thread.start do
@@ -49,7 +49,7 @@ EOF
when 3 # binging in function on TOPLEVEL_BINDING(default)
@binding = eval("def irb_binding; binding; end; irb_binding",
- TOPLEVEL_BINDING,
+ TOPLEVEL_BINDING,
__FILE__,
__LINE__ - 3)
end
@@ -63,7 +63,7 @@ EOF
when Module
@binding = eval("IRB.conf[:__MAIN__].module_eval('binding', __FILE__, __LINE__)", @binding, __FILE__, __LINE__)
else
- begin
+ begin
@binding = eval("IRB.conf[:__MAIN__].instance_eval('binding', __FILE__, __LINE__)", @binding, __FILE__, __LINE__)
rescue TypeError
IRB.fail CantChangeBinding, @main.inspect
@@ -79,7 +79,7 @@ EOF
def evaluate(context, statements, file = __FILE__, line = __LINE__)
eval(statements, @binding, file, line)
end
-
+
# error message manipulator
def filter_backtrace(bt)
case IRB.conf[:CONTEXT_MODE]
diff --git a/lib/irb/ws-for-case-2.rb b/lib/irb/ws-for-case-2.rb
index 24c5fd5aa8..d7db90c96b 100644
--- a/lib/irb/ws-for-case-2.rb
+++ b/lib/irb/ws-for-case-2.rb
@@ -1,12 +1,12 @@
#
-# irb/ws-for-case-2.rb -
+# irb/ws-for-case-2.rb -
# $Release Version: 0.9.5$
# $Revision$
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
# --
#
-#
+#
#
while true
diff --git a/lib/irb/xmp.rb b/lib/irb/xmp.rb
index af87b48887..1a58026f45 100644
--- a/lib/irb/xmp.rb
+++ b/lib/irb/xmp.rb
@@ -6,7 +6,7 @@
#
# --
#
-#
+#
#
require "irb"