Bug #1037

RDoc 2.2.2 crashes on comments beginning with '##'

Added by sunaku (Suraj Kurapati) over 3 years ago. Updated about 1 year ago.

[ruby-core:21511]
Status:Closed Start date:01/22/2009
Priority:Normal Due date:
Assignee:- % Done:

0%

Category:lib
Target version:1.9.2
ruby -v:-

Description

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.

History

Updated by yugui (Yuki Sonoda) over 3 years ago

  • Target version changed from 1.9.1 RC2 to 1.9.1

Updated by sunaku (Suraj Kurapati) over 3 years ago

This bug has been fixed in the RDoc 2.3.0 gem.

Updated by sunaku (Suraj Kurapati) over 3 years ago

If Ruby 1.9 will use RDoc 2.3.0 instead of RDoc 2.2.2, then this bug can be closed.  Thanks.

Updated by yugui (Yuki Sonoda) over 3 years ago

  • Target version changed from 1.9.1 to 1.9.2
  • ruby -v set to -

Updated by matz (Yukihiro Matsumoto) over 3 years ago

  • Status changed from Open to Closed

Also available in: Atom PDF