method
parse_file
v1_9_3_392 -
Show latest stable
- Class:
RDoc::RDoc
parse_file(filename)public
Parses filename and returns an RDoc::TopLevel
# File lib/rdoc/rdoc.rb, line 316
def parse_file filename
if defined?(Encoding) then
encoding = @options.encoding
filename = filename.encode encoding
end
@stats.add_file filename
content = RDoc::Encoding.read_file filename, encoding
return unless content
top_level = RDoc::TopLevel.new filename
parser = RDoc::Parser.for top_level, filename, content, @options, @stats
return unless parser
parser.scan
# restart documentation for the classes & modules found
top_level.classes_or_modules.each do |cm|
cm.done_documenting = false
end
top_level
rescue => e
$stderr.puts Before reporting this, could you check that the file you're documentinghas proper syntax: #{Gem.ruby} -c #{filename}RDoc is not a full Ruby parser and will fail when fed invalid ruby programs.The internal error was:\t(#{e.class}) #{e.message}
$stderr.puts e.backtrace.join("\n\t") if $DEBUG_RDOC
raise e
nil
end Related methods
- Instance methods
- document
- error
- gather_files
- generate
- handle_pipe
- install_siginfo_handler
- list_files_in_directory
- normalized_file_list
- output_flag_file
- parse_dot_doc_file
- parse_file
- parse_files
- remove_siginfo_handler
- remove_unparseable
- setup_output_dir
- update_output_dir
- Class methods
- add_generator
- current
- current=
- new
- reset