aboutsummaryrefslogtreecommitdiffstats
path: root/lib/irb/ruby-lex.rb
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-08-09 02:02:58 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-08-09 02:02:58 +0000
commit76515504d552d3677f81539c29ed5f558f0dc4f0 (patch)
treeef35eaabde005fe0350b8ac955a63a4cebaa1cdc /lib/irb/ruby-lex.rb
parent5afa23b4a46b55667d8f1c6e4490dfb315c8616f (diff)
downloadruby-76515504d552d3677f81539c29ed5f558f0dc4f0.tar.gz
* 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
Diffstat (limited to 'lib/irb/ruby-lex.rb')
-rw-r--r--lib/irb/ruby-lex.rb44
1 files changed, 2 insertions, 42 deletions
diff --git a/lib/irb/ruby-lex.rb b/lib/irb/ruby-lex.rb
index 8bb7edbbaf..06665af089 100644
--- a/lib/irb/ruby-lex.rb
+++ b/lib/irb/ruby-lex.rb
@@ -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