class YARD::Handlers::C::Base
Constants
- ERROR_CLASS_NAMES
-
Generated by update_error_map.rb (Copy+past results)
Public Class Methods
Source
# File lib/yard/handlers/c/base.rb, line 10 def self.handles?(statement, processor) processor.globals.cruby_processed_files ||= {} processor.globals.cruby_processed_files[processor.file] = true src = statement.respond_to?(:declaration) ? statement.declaration : statement.source handlers.any? do |a_handler| statement_class >= statement.class && case a_handler when String src == a_handler when Regexp src =~ a_handler end end end
@return [Boolean] whether the handler handles this statement
Source
# File lib/yard/handlers/c/base.rb, line 28 def self.statement_class(type = nil) if type @statement_class = type else (defined?(@statement_class) && @statement_class) || Statement end end
Public Instance Methods
Source
# File lib/yard/handlers/c/base.rb, line 77 def ensure_variable_defined!(var, max_retries = 1) retries = 0 object = nil loop do object = namespace_for_variable(var) break unless object.is_a?(Proxy) raise NamespaceMissingError, object if retries > max_retries log.debug "Missing namespace variable #{var} in file `#{parser.file}', moving it to the back of the line." parser.parse_remaining_files retries += 1 end object end
Source
# File lib/yard/handlers/c/base.rb, line 64 def namespace_for_variable(var) return namespaces[var] if namespaces[var] # The global variables for Ruby's core error classes does not # represent their Ruby name. So we need to look up these names. name = ERROR_CLASS_NAMES[var] return P(name) if name # Otherwise the name is inferred from the C variable name. var = remove_var_prefix(var) var.empty? ? nil : P(var) end
Source
# File lib/yard/handlers/c/base.rb, line 94 def namespaces globals.cruby_namespaces ||= {} end
Source
# File lib/yard/handlers/c/base.rb, line 60 def override_comments globals.cruby_override_comments ||= [] end
Source
# File lib/yard/handlers/c/base.rb, line 104 def parse_block(opts = {}) return if !statement.block || statement.block.empty? push_state(opts) do parser.process(statement.block) end end
@group Parsing an Inner Block
Source
# File lib/yard/handlers/c/base.rb, line 113 def process_file(file, object) file = File.cleanpath(file) return if processed_files[file] processed_files[file] = file begin log.debug "Processing embedded call to C source #{file}..." globals.ordered_parser.files.delete(file) if globals.ordered_parser parser.process(Parser::C::CParser.new(File.read(file), file).parse) rescue Errno::ENOENT log.warn "Missing source file `#{file}' when parsing #{object}" end end
@group Processing other files
Source
# File lib/yard/handlers/c/base.rb, line 98 def processed_files globals.cruby_processed_files ||= {} end
Source
# File lib/yard/handlers/c/base.rb, line 38 def register_docstring(object, docstring = nil, stmt = nil) super(object, docstring, stmt) if docstring end
@group Registering objects
Calls superclass method
YARD::Handlers::Base#register_docstring
Source
# File lib/yard/handlers/c/base.rb, line 42 def register_file_info(object, file = nil, line = nil, comments = nil) super(object, file, line, comments) if file end
Calls superclass method
YARD::Handlers::Base#register_file_info
Source
# File lib/yard/handlers/c/base.rb, line 46 def register_source(object, source = nil, type = nil) super(object, source, type) if source end
Calls superclass method
YARD::Handlers::Base#register_source
Source
# File lib/yard/handlers/c/base.rb, line 50 def register_visibility(object, visibility = nil) super(object, visibility) if visibility end
Calls superclass method
YARD::Handlers::Base#register_visibility
Source
# File lib/yard/handlers/c/base.rb, line 56 def symbols globals.cruby_symbols ||= {} end
@group Looking up Symbol and Var Values
Private Instance Methods
Source
# File lib/yard/handlers/c/base.rb, line 158 def remove_var_prefix(var) var.gsub(/^rb_[mc]|^[a-z_]+/, '') end