summaryrefslogtreecommitdiff
path: root/lib/irb/slex.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-03-06 03:56:38 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-03-06 03:56:38 +0000
commit287a34ae0dfc23e4158f67cb7783d239f202c368 (patch)
tree5e35d5b41aae961b37cf6632f60c42f51c7aa775 /lib/irb/slex.rb
parent9b52ae2e6491bb5d6c59e1799449f6268baf6f89 (diff)
* {ext,lib,test}/**/*.rb: removed trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/irb/slex.rb')
-rw-r--r--lib/irb/slex.rb36
1 files changed, 18 insertions, 18 deletions
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"