summaryrefslogtreecommitdiffhomepage
path: root/lib/yard/mruby/handlers/c/symbol_handler.rb
blob: 8f24b93bc8521e88469e33055066aed820f5205c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
module YARD::MRuby::Handlers::C
  # 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