summaryrefslogtreecommitdiffhomepage
path: root/lib/yard/mruby/handlers/header/function_handler.rb
blob: 9b982589ef5b432b92e4394cd26b1777ac971962 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
module YARD::MRuby::Handlers::Header
  class FunctionHandler < Base
    MATCH = /
      MRB_(API|INLINE)\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, prefix, _, name, *args|
        register FunctionObject.new(header, name) do |obj|
        end
      end
    end
  end
end