aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rdoc/ruby_lex.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rdoc/ruby_lex.rb')
-rw-r--r--lib/rdoc/ruby_lex.rb22
1 files changed, 9 insertions, 13 deletions
diff --git a/lib/rdoc/ruby_lex.rb b/lib/rdoc/ruby_lex.rb
index e772e660e0..11ac8da85c 100644
--- a/lib/rdoc/ruby_lex.rb
+++ b/lib/rdoc/ruby_lex.rb
@@ -102,10 +102,10 @@ class RDoc::RubyLex
@exp_line_no = @line_no = 1
@here_readed = []
@readed = []
+ @current_readed = @readed
@rests = []
@seek = 0
- @here_header = false
@indent = 0
@indent_stack = []
@lex_state = :EXPR_BEG
@@ -161,7 +161,7 @@ class RDoc::RubyLex
end
readed = @readed.join("")
- @readed = []
+ @readed.clear
readed
end
@@ -171,13 +171,9 @@ class RDoc::RubyLex
@rests.push nil unless buf_input
end
c = @rests.shift
- if @here_header
- @here_readed.push c
- else
- @readed.push c
- end
+ @current_readed.push c
@seek += 1
- if c == "\n"
+ if c == "\n".freeze
@line_no += 1
@char_no = 0
else
@@ -283,7 +279,7 @@ class RDoc::RubyLex
@indent_stack = []
@lex_state = :EXPR_BEG
@space_seen = false
- @here_header = false
+ @current_readed = @readed
@continue = false
prompt
@@ -462,8 +458,8 @@ class RDoc::RubyLex
@indent_stack.pop
end
end
- @here_header = false
- @here_readed = []
+ @current_readed = @readed
+ @here_readed.clear
Token(TkNL)
end
@@ -1021,7 +1017,7 @@ class RDoc::RubyLex
doc = '"'
end
- @here_header = false
+ @current_readed = @readed
while l = gets
l = l.sub(/(:?\r)?\n\z/, "\n")
if (indent ? l.strip : l.chomp) == quoted
@@ -1038,7 +1034,7 @@ class RDoc::RubyLex
doc << '"'
end
- @here_header = true
+ @current_readed = @here_readed
@here_readed.concat reserve
while ch = reserve.pop
ungetc ch