summaryrefslogtreecommitdiff
path: root/lib/rdoc/parsers/parse_rb.rb
diff options
context:
space:
mode:
authordave <dave@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-05-26 05:02:55 +0000
committerdave <dave@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-05-26 05:02:55 +0000
commitea63eef678a0e4a5a3cd7455ad579b3d65dac99b (patch)
tree54f5fcc84da211510a05d89feb26afd3924fbf9d /lib/rdoc/parsers/parse_rb.rb
parentad4d4e3eddaf3032a0864a5f919aa65f519c7712 (diff)
Allow "do" after "for". Fix up css for standalone code window
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@6407 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rdoc/parsers/parse_rb.rb')
-rw-r--r--lib/rdoc/parsers/parse_rb.rb19
1 files changed, 18 insertions, 1 deletions
diff --git a/lib/rdoc/parsers/parse_rb.rb b/lib/rdoc/parsers/parse_rb.rb
index 8a23b6881f..bd2414826c 100644
--- a/lib/rdoc/parsers/parse_rb.rb
+++ b/lib/rdoc/parsers/parse_rb.rb
@@ -1675,7 +1675,15 @@ module RDoc
"line #{tk.line_no}" if $DEBUG
skip_optional_do_after_expression
- when TkCASE, TkDO, TkIF, TkUNLESS, TkBEGIN, TkFOR
+ # 'for' is trickier
+ when TkFOR
+ nest += 1
+ puts "FOUND #{tk.class} in #{container.name}, nest = #{nest}, " +
+ "line #{tk.line_no}" if $DEBUG
+ skip_for_variable
+ skip_optional_do_after_expression
+
+ when TkCASE, TkDO, TkIF, TkUNLESS, TkBEGIN
nest += 1
puts "Found #{tk.class} in #{container.name}, nest = #{nest}, " +
"line #{tk.line_no}" if $DEBUG
@@ -2046,6 +2054,15 @@ module RDoc
res
end
+ # skip the var [in] part of a 'for' statement
+ def skip_for_variable
+ skip_tkspace(false)
+ tk = get_tk
+ skip_tkspace(false)
+ tk = get_tk
+ unget_tk(tk) unless tk.kind_of?(TkIN)
+ end
+
# while, until, and for have an optional
def skip_optional_do_after_expression
skip_tkspace(false)