Class: YARD::MRuby::Handlers::C::Header::FunctionHandler

Inherits:
Base
  • Object
show all
Defined in:
lib/yard/mruby/handlers/c/header/function_handler.rb

Constant Summary collapse

MATCH =
/
  MRB_(API|INLINE)\s+
  ((struct\s+)?\w+(\s*\*)?)\s*
  ((\w+\s+)+)?(\w+)\s*
  \(([\w\s\*,\.]*)\)
/mx

Constants included from CodeObjects

CodeObjects::HEADERS_ROOT

Instance Method Summary collapse

Methods inherited from Base

#header, #headers

Instance Method Details

#handle_function(statement) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/yard/mruby/handlers/c/header/function_handler.rb', line 17

def handle_function(statement)
  header = self.header(statement.file)

  statement.source.scan(MATCH) do |type, retype, _,_,_,_, name, parameters|
    register FunctionObject.new(header, name) do |obj|
      if statement.comments
        register_docstring(obj, statement.comments.source, statement)
      end

      obj.return_type = retype
      obj.parse_parameter_types(parameters)

    end
  end
end