Problem using RDoc programatically

Sorry about the big ASCII dump, but this is what I get when trying to
require 'rdoc/rdoc'. Any ideas?

irb(main):001:0> require 'rdoc/rdoc'
E:/Ruby/lib/ruby/1.8/rdoc/parsers/parse_rb.rb:32: warning: already
initialized constant EXPR_BEG
  [several more such warnings, and then...]
NameError: uninitialized constant RubyToken::AlreadyDefinedToken
        from E:/Ruby/lib/ruby/1.8/rdoc/parsers/parse_rb.rb:274:in
`def_token'
        from E:/Ruby/lib/ruby/1.8/rdoc/parsers/parse_rb.rb:301
        from E:/Ruby/lib/ruby/1.8/rdoc/parsers/parse_rb.rb:300:in
`each'
        from E:/Ruby/lib/ruby/1.8/rdoc/parsers/parse_rb.rb:300
          [from ...]
        from (irb):1
irb(main):002:0> VERSION
=> "1.8.2"

I'm able to run "rdoc" the command OK. I don't see why the above
shouldn't work, because it's the first non transitional-hack line in
that command.

Thanks,
Gavin

This seems to be some strange interaction between IRB and RDoc: the
module RubyTokens for parsing Ruby are defined similarly in two
different files (in my case C:\ruby\lib\ruby\1.8\irb\ruby-token.rb and
C:\ruby\lib\ruby\1.8\rdoc\parsers\parse_rb.rb.) When defining the
tokens the module makes sure they aren't already defined (apparently a
good idea in this case), but unfortunately the exception that is
thrown on duplicate tokens (AlreadyDefinedToken) isn't defined until
line 434 of parse_rb.rb. There is something else going on, but I'm too
tired to try to dig into it now.

The question is, why is identical code defined in two places (with
only slight differences?)

Ryan

···

On 10/7/05, Gavin Sinclair <gsinclair@gmail.com> wrote:

Sorry about the big ASCII dump, but this is what I get when trying to
require 'rdoc/rdoc'. Any ideas?

Ryan Leavengood wrote:

···

On 10/7/05, Gavin Sinclair <gsinclair@gmail.com> wrote:
> Sorry about the big ASCII dump, but this is what I get when trying to
> require 'rdoc/rdoc'. Any ideas?

This seems to be some strange interaction between IRB and RDoc: [...]
tired to try to dig into it now.

Thanks for that. I guess I should have tried in a small program. IRB
is _too_ convenient sometimes!

Cheers,
Gavin