Sha256: f5357e8e8df585eee09131a7fc346224f79d173cf58c9d956ed7b81f9bc81b52

Contents?: true

Size: 784 Bytes

Versions: 3

Compression:

Stored size: 784 Bytes

Contents

module YARD::MRuby::Handlers::C::Header
  class FunctionHandler < Base
    MATCH = /
      MRB_(API|INLINE)\s+
      ((struct\s+)?\w+(\s*\*)?)\s*
      ((\w+\s+)+)?(\w+)\s*
      \(([\w\s\*,\.]*)\)
    /mx

    handles MATCH
    statement_class ToplevelStatement

    process do
      handle_function(statement)
    end

    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
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
yard-mruby-0.2.2 lib/yard/mruby/handlers/c/header/function_handler.rb
yard-mruby-0.2.1 lib/yard/mruby/handlers/c/header/function_handler.rb
yard-mruby-0.2.0 lib/yard/mruby/handlers/c/header/function_handler.rb