summaryrefslogtreecommitdiffhomepage
path: root/lib/yard/mruby/handlers/c/source/symbol_handler.rb
blob: a1e3caa8b5d7aaeea66c7d5d2c8e187b6f19b4fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
module YARD::MRuby::Handlers::C::Source
  # Keeps track of function bodies for symbol lookup during MRuby method declarations
  class SymbolHandler < Base

    MATCH = /
      mrb_value\s*(\w+)\s*\(\s*mrb_state\s*\*\s*\w+,\s*mrb_value\s*\w+\s*\)
    /mx

    handles MATCH
    statement_class ToplevelStatement

    process do
      symbols[statement.source[MATCH, 1]] = statement
    end
  end
end