summaryrefslogtreecommitdiffhomepage
path: root/lib/yard/mruby/handlers/c/header/function_handler.rb
diff options
context:
space:
mode:
authorSeba Gamboa <[email protected]>2015-09-29 11:51:21 -0300
committerSeba Gamboa <[email protected]>2015-09-29 11:51:21 -0300
commitd034793bd327d78aba0d99d719336d597e2413b0 (patch)
tree3b4527efc2d554ddea6cd4c28b71edf85b9d2e7c /lib/yard/mruby/handlers/c/header/function_handler.rb
parent5c3e2565132aa2b0141580c2caabbe2c6a8c2470 (diff)
downloadyard-mruby-d034793bd327d78aba0d99d719336d597e2413b0.tar.gz
yard-mruby-d034793bd327d78aba0d99d719336d597e2413b0.zip
Handle return types
Diffstat (limited to 'lib/yard/mruby/handlers/c/header/function_handler.rb')
-rw-r--r--lib/yard/mruby/handlers/c/header/function_handler.rb15
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/yard/mruby/handlers/c/header/function_handler.rb b/lib/yard/mruby/handlers/c/header/function_handler.rb
index 6bdb8a6..11f8efc 100644
--- a/lib/yard/mruby/handlers/c/header/function_handler.rb
+++ b/lib/yard/mruby/handlers/c/header/function_handler.rb
@@ -1,8 +1,11 @@
module YARD::MRuby::Handlers::C::Header
class FunctionHandler < Base
MATCH = /
- MRB_(API|INLINE)\s+((\w+\s+)+)(\w+)\s*\(
+ MRB_(API|INLINE)\s+
+ ((struct\s+)?\w+(\s*\*)?)\s*
+ ((\w+\s+)+)?(\w+)\s*\(
/mx
+ #\(([\w\*,]*)\)
handles MATCH
statement_class ToplevelStatement
@@ -14,11 +17,19 @@ module YARD::MRuby::Handlers::C::Header
def handle_function(statement)
header = self.header(statement.file)
- statement.source.scan(MATCH) do |type, prefix, _, name, *args|
+["API", "mrb_value", nil, nil, nil, nil, "sample_api_method"]
+ statement.source.scan(MATCH) do |type, retype, _,_,_,_, name, *args|
+ puts args.inspect
register FunctionObject.new(header, name) do |obj|
if statement.comments
register_docstring(obj, statement.comments.source, statement)
end
+
+ if retype != 'void'
+ obj.add_tag(YARD::Tags::Tag.new(:return,"", "")) unless obj.has_tag?(:return)
+ obj.tag(:return).types = [retype]
+ end
+
end
end
end