summaryrefslogtreecommitdiffhomepage
path: root/lib/yard/mruby/handlers/c/header/function_handler.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/yard/mruby/handlers/c/header/function_handler.rb')
-rw-r--r--lib/yard/mruby/handlers/c/header/function_handler.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/yard/mruby/handlers/c/header/function_handler.rb b/lib/yard/mruby/handlers/c/header/function_handler.rb
new file mode 100644
index 0000000..6bdb8a6
--- /dev/null
+++ b/lib/yard/mruby/handlers/c/header/function_handler.rb
@@ -0,0 +1,26 @@
+module YARD::MRuby::Handlers::C::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|
+ if statement.comments
+ register_docstring(obj, statement.comments.source, statement)
+ end
+ end
+ end
+ end
+ end
+end