Bug #1037: RDoc 2.2.2 crashes on comments beginning with '##'
http://redmine.ruby-lang.org/issues/show/1037

Author: Suraj Kurapati
Status: Open, Priority: Normal
Category: lib, Target version: 1.9.1 RC2
Reproducible Version: 1.9.1 RC2

RDoc 2.2.2 (which is bundled with Ruby 1.9.1-rc2) crashes 
when processing comments that begin with two '##' comment 
characters.  Please observe:

> ./ruby --version
ruby 1.9.1p0 (2009-01-20 revision 21700) [i686-linux]

> rdoc --version
rdoc 2.2.2

> cat foo
#!/usr/bin/ruby -w

##
# this is a comment

this_is_some_code


> ./ruby bin/rdoc foo --op foo-out

foo: 

RDoc failure in dummy.rb at or around line 7 column
0

Before reporting this, could you check that the file you're documenting
compiles cleanly--RDoc is not a full Ruby parser, and gets confused easily if
fed invalid programs.

The internal error was:

/home/sun/app/ruby19/lib/ruby/1.9.1/rdoc/parser/ruby.rb:2049:in `parse_meta_method': undefined method `top_level' for #<RDoc::TopLevel:0x4688856 "foo" modules: [] classes: []> (NoMethodError)
	from /home/sun/app/ruby19/lib/ruby/1.9.1/rdoc/parser/ruby.rb:2445:in `parse_statements'
	from /home/sun/app/ruby19/lib/ruby/1.9.1/rdoc/parser/ruby.rb:2540:in `parse_toplevel_statements'
	from /home/sun/app/ruby19/lib/ruby/1.9.1/rdoc/parser/ruby.rb:2706:in `block (2 levels) in scan'

##################################

In contrast, when I do NOT use a double '##' RDoc is OK:

##################################


> cat bar
#!/usr/bin/ruby -w

#
# this is a comment

this_is_some_code


> ./ruby bin/rdoc bar --op bar-out

bar: 
Generating HTML...

Files:   1
Classes: 0
Modules: 0
Methods: 0
Elapsed: 0.0s

##################################

Thanks for your consideration.


----------------------------------------
http://redmine.ruby-lang.org