Problem using RDoc programatically

G

Gavin Sinclair

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
 
R

Ryan Leavengood

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: 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
 
G

Gavin Sinclair

Ryan said:
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
 

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

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top