new(top_level, file_name, content, options, stats)
public
Prepares for parsing a C file. See RDoc::Parser#initialize for details on
the arguments.
Show source
def initialize top_level, file_name, content, options, stats
super
@known_classes = RDoc::KNOWN_CLASSES.dup
@content = handle_tab_width handle_ifdefs_in @content
@file_dir = File.dirname @file_name
@classes = load_variable_map :c_class_variables
@singleton_classes = load_variable_map :c_singleton_class_variables
@methods = Hash.new { |h, f| h[f] = Hash.new { |i, m| i[m] = [] } }
@missing_dependencies = {}
@enclosure_dependencies = Hash.new { |h, k| h[k] = [] }
@enclosure_dependencies.instance_variable_set :@missing_dependencies,
@missing_dependencies
@enclosure_dependencies.extend TSort
def @enclosure_dependencies.tsort_each_node &block
each_key(&block)
rescue TSort::Cyclic => e
cycle_vars = e.message.scan(/"(.*?)"/).flatten
cycle = cycle_vars.sort.map do |var_name|
delete var_name
var_name, type, mod_name, = @missing_dependencies[var_name]
"#{type} #{mod_name} (#{var_name})"
end.join ', '
warn "Unable to create #{cycle} due to a cyclic class or module creation"
retry
end
def @enclosure_dependencies.tsort_each_child node, &block
fetch(node, []).each(&block)
end
end