summaryrefslogtreecommitdiff
path: root/lib/rdoc/parser/ruby_tools.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rdoc/parser/ruby_tools.rb')
-rw-r--r--lib/rdoc/parser/ruby_tools.rb24
1 files changed, 9 insertions, 15 deletions
diff --git a/lib/rdoc/parser/ruby_tools.rb b/lib/rdoc/parser/ruby_tools.rb
index 40ea517c4d..1f621cd32e 100644
--- a/lib/rdoc/parser/ruby_tools.rb
+++ b/lib/rdoc/parser/ruby_tools.rb
@@ -25,10 +25,12 @@ module RDoc::Parser::RubyTools
tk = @scanner[@scanner_point]
@scanner_point += 1
@read.push tk[:text]
+ puts "get_tk1 => #{tk.inspect}" if $TOKEN_DEBUG
end
else
@read.push @unget_read.shift
tk = @tokens.shift
+ puts "get_tk2 => #{tk.inspect}" if $TOKEN_DEBUG
end
if tk == nil || :on___end__ == tk[:kind]
@@ -109,27 +111,17 @@ module RDoc::Parser::RubyTools
@scanner_point = 0
end
- ##
- # Skips whitespace tokens including newlines
-
- def skip_tkspace
- tokens = []
-
- while (tk = get_tk) and (:on_sp == tk[:kind] or :on_nl == tk[:kind] or :on_ignored_nl == tk[:kind]) do
- tokens.push(tk)
- end
-
- unget_tk(tk)
- tokens
+ def tk_nl?(tk)
+ :on_nl == tk[:kind] or :on_ignored_nl == tk[:kind]
end
##
- # Skips whitespace tokens excluding newlines
+ # Skips whitespace tokens including newlines if +skip_nl+ is true
- def skip_tkspace_without_nl
+ def skip_tkspace(skip_nl = true)
tokens = []
- while (tk = get_tk) and :on_sp == tk[:kind] do
+ while (tk = get_tk) and (:on_sp == tk[:kind] or (skip_nl and tk_nl?(tk))) do
tokens.push(tk)
end
@@ -163,3 +155,5 @@ module RDoc::Parser::RubyTools
end
end
+
+