summaryrefslogtreecommitdiffhomepage
path: root/lib/yard/mruby/handlers/c/header/define_handler.rb
blob: 1a061dbdefa2e27e84e453f16442c881b803bd7e (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::C::Header
  class DefineHandler < Base
    MATCH = /
      \#\s*define\s*(\w+)
    /mx

    handles MATCH
    statement_class YARD::MRuby::Parser::C::DirectiveStatement

    process do
      header = self.header(statement.file)

      statement.declaration.scan(MATCH) do |match|
        register DefineObject.new(header, match.first) do |obj|
          if statement.comments
            register_docstring(obj, statement.comments.source, statement)
          end
        end
      end

    end
  end
end