Rdoc bug

To Whom It May Concern:

$ ruby --version
ruby 1.8.4 (2005-12-24) [i686-linux]
$ rdoc --version
RDoc V1.0.1 - 20041108

— BEGIN rdoctest.rb —
class A
def foo
end

def bar
end

end

class B
def baz
# This line causes the rdoc breakage…
# That is, everything below it is not documented.
/^/
# This version is alright, though.
# %r{^}
# This version breaks it, too.
# %r{^}
# As does this:
# “^”
# And this:
# ‘^’
end

def foz
end

end

class C
def boo
end

def far
end

end
— END rdoctest.rb —

— expected: —
$ rdoc doctest.rb

                     doctest.rb: c..c..c..

Generating HTML…

Files: 1
Classes: 3
Modules: 0
Methods: 6
Elapsed: 0.088s

— actual: —
$ rdoc doctest.rb

                     doctest.rb: c..c.

Generating HTML…

Files: 1
Classes: 2
Modules: 0
Methods: 3
Elapsed: 0.075s

Hello.

It seems that rdoc should not treat \ as escape character
inside regurar expression and single quoted string.

Does this work?

I haven’t read all rdoc parser’s code, so this is just hack.

I’ll test this on make install-doc later.

Index: parse_rb.rb

RCS file: /src/ruby/lib/rdoc/parsers/parse_rb.rb,v
retrieving revision 1.41
diff -u -w -b -p -r1.41 parse_rb.rb
— parse_rb.rb 18 Feb 2006 15:35:32 -0000 1.41
+++ parse_rb.rb 27 Feb 2006 07:53:07 -0000
@@ -560,7 +560,7 @@ class RubyLex
“q” => “’”,
“Q” => “”",
“x” => “`”,

  • “r” => “/”,
  • “r” => “/”,
    “w” => “]”
    }

@@ -575,7 +575,7 @@ class RubyLex
“’” => TkSTRING,
“”" => TkSTRING,
“`” => TkXSTRING,

  • “/” => TkREGEXP,
  • “/” => TkREGEXP,
    “]” => TkDSTRING
    }
    Ltype2Token.default = TkSTRING
    @@ -583,7 +583,7 @@ class RubyLex
    DLtype2Token = {
    “”" => TkDSTRING,
    “`” => TkDXSTRING,
  • “/” => TkDREGEXP,
  • “/” => TkDREGEXP,
    }

def lex_init()
@@ -1230,7 +1230,7 @@ class RubyLex
else
ungetc(ch)
end

  • elsif ch == ‘\’ #’
  • elsif @ltype != “’” && @ltype != “/” and ch == ‘\’ #’
    str << read_escape
    end
    end

///////////////////////////////////////////

class A
def foo
end

def bar
end

end

class B
def baz
# Probably this is fixed
# /^/
# Probably this is fixed
# %r{^}
# Is this valid string?
# “^”
# Probably this is fixed
# ‘^’
end

def foz
end

end

class C
def boo
end

def far
end

end

Hello.

It seems that rdoc should not treat \ as escape character
inside regurar expression and single quoted string.

Does this work?

I haven’t read all rdoc parser’s code, so this is just hack.

I’ll test this on make install-doc later.

Sorry, I’ll cancel this patch. Mr. Ishizuka (Author of irb) pointed
out this fix is not right fix. I’ll reconsider after irb’s similer
bug is fixed.

Hello.

It seems that rdoc should not treat \ as escape character
inside regurar expression and single quoted string.

Does this work?

I haven’t read all rdoc parser’s code, so this is just hack.

I’ll test this on make install-doc later.

I have tested. I found some difference between before and after applied
my patch
(all difference are related to cgi), but CGI::Html3 is markes as
:nodoc:, so probably this
comes from the bug you reported (I found regular expression containing \
in cgi.rb…
That should break the parse-process after that)

Following files were not generated.

usr/share/ri/1.9/system/CGI/Cookie/cdesc-Cookie.yaml
usr/share/ri/1.9/system/CGI/Cookie/new-c.yaml
usr/share/ri/1.9/system/CGI/Cookie/parse-c.yaml
usr/share/ri/1.9/system/CGI/Cookie/secure%3d-i.yaml
usr/share/ri/1.9/system/CGI/Cookie/to_s-i.yaml
usr/share/ri/1.9/system/CGI/Html3/cdesc-Html3.yaml
usr/share/ri/1.9/system/CGI/Html4/cdesc-Html4.yaml
usr/share/ri/1.9/system/CGI/Html4Fr/cdesc-Html4Fr.yaml
usr/share/ri/1.9/system/CGI/Html4Tr/cdesc-Html4Tr.yaml
usr/share/ri/1.9/system/CGI/HtmlExtension/a-i.yaml
usr/share/ri/1.9/system/CGI/HtmlExtension/base-i.yaml
usr/share/ri/1.9/system/CGI/HtmlExtension/blockquote-i.yaml
usr/share/ri/1.9/system/CGI/HtmlExtension/caption-i.yaml
usr/share/ri/1.9/system/CGI/HtmlExtension/cdesc-HtmlExtension.yaml
usr/share/ri/1.9/system/CGI/HtmlExtension/checkbox-i.yaml
usr/share/ri/1.9/system/CGI/HtmlExtension/checkbox_group-i.yaml
usr/share/ri/1.9/system/CGI/HtmlExtension/file_field-i.yaml
usr/share/ri/1.9/system/CGI/HtmlExtension/form-i.yaml
usr/share/ri/1.9/system/CGI/HtmlExtension/hidden-i.yaml
usr/share/ri/1.9/system/CGI/HtmlExtension/html-i.yaml
usr/share/ri/1.9/system/CGI/HtmlExtension/image_button-i.yaml
usr/share/ri/1.9/system/CGI/HtmlExtension/img-i.yaml
usr/share/ri/1.9/system/CGI/HtmlExtension/multipart_form-i.yaml
usr/share/ri/1.9/system/CGI/HtmlExtension/password_field-i.yaml
usr/share/ri/1.9/system/CGI/HtmlExtension/popup_menu-i.yaml
usr/share/ri/1.9/system/CGI/HtmlExtension/radio_button-i.yaml
usr/share/ri/1.9/system/CGI/HtmlExtension/radio_group-i.yaml
usr/share/ri/1.9/system/CGI/HtmlExtension/reset-i.yaml
usr/share/ri/1.9/system/CGI/HtmlExtension/scrolling_list-i.yaml
usr/share/ri/1.9/system/CGI/HtmlExtension/submit-i.yaml
usr/share/ri/1.9/system/CGI/HtmlExtension/text_field-i.yaml
usr/share/ri/1.9/system/CGI/HtmlExtension/textarea-i.yaml
usr/share/ri/1.9/system/CGI/QueryExtension/%5b%5d-i.yaml
usr/share/ri/1.9/system/CGI/QueryExtension/MorphingBody/cdesc-MorphingBody.yaml
usr/share/ri/1.9/system/CGI/QueryExtension/MorphingBody/convert_body-i.yaml
usr/share/ri/1.9/system/CGI/QueryExtension/MorphingBody/extract-i.yaml
usr/share/ri/1.9/system/CGI/QueryExtension/MorphingBody/new-c.yaml
usr/share/ri/1.9/system/CGI/QueryExtension/MorphingBody/path-i.yaml
usr/share/ri/1.9/system/CGI/QueryExtension/MorphingBody/print-i.yaml
usr/share/ri/1.9/system/CGI/QueryExtension/MorphingBody/rewind-i.yaml
usr/share/ri/1.9/system/CGI/QueryExtension/Value/cdesc-Value.yaml
usr/share/ri/1.9/system/CGI/QueryExtension/cdesc-QueryExtension.yaml
usr/share/ri/1.9/system/CGI/QueryExtension/has_key%3f-i.yaml
usr/share/ri/1.9/system/CGI/QueryExtension/include%3f-i.yaml
usr/share/ri/1.9/system/CGI/QueryExtension/initialize_query-i.yaml
usr/share/ri/1.9/system/CGI/QueryExtension/key%3f-i.yaml
usr/share/ri/1.9/system/CGI/QueryExtension/keys-i.yaml
usr/share/ri/1.9/system/CGI/QueryExtension/multipart%3f-i.yaml
usr/share/ri/1.9/system/CGI/QueryExtension/params%3d-i.yaml
usr/share/ri/1.9/system/CGI/QueryExtension/raw_cookie-i.yaml
usr/share/ri/1.9/system/CGI/QueryExtension/raw_cookie2-i.yaml
usr/share/ri/1.9/system/CGI/QueryExtension/read_from_cmdline-i.yaml
usr/share/ri/1.9/system/CGI/QueryExtension/read_multipart-i.yaml
usr/share/ri/1.9/system/CGI/TagMaker/cdesc-TagMaker.yaml
usr/share/ri/1.9/system/CGI/escape_element-c.yaml
usr/share/ri/1.9/system/CGI/header-i.yaml
usr/share/ri/1.9/system/CGI/new-c.yaml
usr/share/ri/1.9/system/CGI/out-i.yaml
usr/share/ri/1.9/system/CGI/parse-c.yaml
usr/share/ri/1.9/system/CGI/pretty-c.yaml
usr/share/ri/1.9/system/CGI/print-i.yaml
usr/share/ri/1.9/system/CGI/rfc1123_date-c.yaml
usr/share/ri/1.9/system/CGI/unescape_element-c.yaml

Hello.

bug is fixed.
This bug was fixed by Mr. Ishizuka. Thank you for report.