Strange rdoc error with :section:

M

Michael Neumann

Hi,

I very like the new section feature of rdoc...

But when I use it with the newest version of ruby from CVS (ruby 1.9.0
(2004-11-26) [i386-dragonfly1.1]) and the following file:

#file: rdoc-test.rb

# :section: Test

def test
end

I get the following error:

rdoc-test.rb:

RDoc failure in rdoc-test.rb at or around line 3 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/mneumann/Programs/usr/lib/ruby/1.9/rdoc/markup/simple_markup/preprocess.rb:21:in
`gsub!': string modified (RuntimeError)
from
/home/mneumann/Programs/usr/lib/ruby/1.9/rdoc/markup/simple_markup/preprocess.rb:21:in
`handle'
from
/home/mneumann/Programs/usr/lib/ruby/1.9/rdoc/parsers/parse_rb.rb:2287:in
`look_for_directives_in'
from
/home/mneumann/Programs/usr/lib/ruby/1.9/rdoc/parsers/parse_rb.rb:1561:in
`parse_toplevel_statements'


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

This seems to be a very strange Ruby error.
With the following patch the problem goes away... but I really don't
understand why.

===================================================================
RCS file: /var/cvs/src/ruby/lib/rdoc/markup/simple_markup/preprocess.rb,v
retrieving revision 1.3
diff -u -r1.3 preprocess.rb
--- rdoc/markup/simple_markup/preprocess.rb 19 Feb 2004 03:23:51
-0000 1.3
+++ rdoc/markup/simple_markup/preprocess.rb 25 Nov 2004 23:03:04 -0000
@@ -18,7 +18,7 @@
# as |directive, param|

def handle(text)
- text.gsub!(/^([ \t#]*):(\w+):\s*(.+)?\n/) do
+ text.dup.gsub!(/^([ \t#]*):(\w+):\s*(.+)?\n/) do

prefix = $1
directive = $2.downcase



Regards,

Michael
 
D

Dave Thomas

I very like the new section feature of rdoc...

But when I use it with the newest version of ruby from CVS (ruby 1.9.0
(2004-11-26) [i386-dragonfly1.1]) and the following file:

RDoc failure in rdoc-test.rb at or around line 3 column 0

Wow - I see that too. Must be some new checking added to gsub. Rather
than dup the string, I think I've fixed it by simply terminating the
loop early in the case where it comes across :section: (the handling is
special, because I want to force the comment to appear in the section
header, and not as the comment for any subsequent class or method).
Anyway, the lastest CVS should fix it (but I'd appreciate any
feedback).


Cheers

Dave
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

[RDOC] sections bug? 1
[ANN] RDoc 3 6
Help with RDoc error 3
[ANN] rdoc 2.1.0 Released 24
[ANN] rdoc 2.5 Released 7
RDoc --template error 1
Getting Started w Ruby on MacOSX -- ri/RDoc error 3
Rdoc Hooks ! 1

Members online

Forum statistics

Threads
473,992
Messages
2,570,220
Members
46,807
Latest member
ryef

Latest Threads

Top