# Rdoc bug

**URL:** <https://www.ruby-forum.com/t/rdoc-bug/73905>\
**Category:** Ruby\
**Created:** [February 26, 2006, 9:23pm UTC](https://www.ruby-forum.com/t/rdoc-bug/73905 "2006-02-26T21:23:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![pistos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/76d3ee/32.png) [@pistos](https://www.ruby-forum.com/u/pistos)\
**Post date:** [February 26, 2006, 9:23pm UTC](https://www.ruby-forum.com/t/rdoc-bug/73905/1 "2006-02-26T21:23:51Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pistos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/76d3ee/32.png) [@pistos](https://www.ruby-forum.com/u/pistos)\
**Post date:** [February 27, 2006, 9:07am UTC](https://www.ruby-forum.com/t/rdoc-bug/73905/2 "2006-02-27T09:07:16Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pistos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/76d3ee/32.png) [@pistos](https://www.ruby-forum.com/u/pistos)\
**Post date:** [February 27, 2006, 3:18pm UTC](https://www.ruby-forum.com/t/rdoc-bug/73905/3 "2006-02-27T15:18:30Z")

</div>

> 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.

---

<div class="post-metadata">

**Author:** ![pistos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/76d3ee/32.png) [@pistos](https://www.ruby-forum.com/u/pistos)\
**Post date:** [February 27, 2006, 10:14am UTC](https://www.ruby-forum.com/t/rdoc-bug/73905/4 "2006-02-27T10:14:09Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pistos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/76d3ee/32.png) [@pistos](https://www.ruby-forum.com/u/pistos)\
**Post date:** [February 28, 2006, 4:30pm UTC](https://www.ruby-forum.com/t/rdoc-bug/73905/5 "2006-02-28T16:30:05Z")

</div>

Hello.

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