diff options
| author | Seba Gamboa <[email protected]> | 2015-09-29 15:05:35 -0300 |
|---|---|---|
| committer | Seba Gamboa <[email protected]> | 2015-09-29 15:05:35 -0300 |
| commit | a2ce558f0243077d152c6a703e737a68f9a3f301 (patch) | |
| tree | c44b4807fc108dcb1d99316a633153a781e70244 /lib/yard/mruby | |
| parent | e7711181c85641561a6ee8cef5dcb7710608f4f2 (diff) | |
| download | yard-mruby-a2ce558f0243077d152c6a703e737a68f9a3f301.tar.gz yard-mruby-a2ce558f0243077d152c6a703e737a68f9a3f301.zip | |
Support variadic arguments in functions
Diffstat (limited to 'lib/yard/mruby')
| -rw-r--r-- | lib/yard/mruby/code_objects/function_object.rb | 4 | ||||
| -rw-r--r-- | lib/yard/mruby/handlers/c/header/function_handler.rb | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/yard/mruby/code_objects/function_object.rb b/lib/yard/mruby/code_objects/function_object.rb index 4609a21..725428e 100644 --- a/lib/yard/mruby/code_objects/function_object.rb +++ b/lib/yard/mruby/code_objects/function_object.rb @@ -37,7 +37,7 @@ module YARD::MRuby::CodeObjects # @return [Array<Array(String, String)>] a list of parameter names followed # by their default values (or nil) def parameters - parameter_types.map{|t| [t.name, nil] } + parameter_types.map{|t| [(t.type == '...' ? '...' : t.name), nil] } end def parameter_types @@ -49,7 +49,7 @@ module YARD::MRuby::CodeObjects return if parameters.match /^\s*void\s*$/ parameters.split(',').each do |parameter| - parameter.scan(/((?:const\s+)?(?:struct\s+)?\w+(?:\s*\*)?)\s*(\w+)?/) do |type,name| + parameter.scan(/((?:const\s+)?(?:struct\s+)?(?:\w+|\.\.\.)(?:\s*\*)?)\s*(\w+)?/) do |type,name| @parameter_types << ParameterType.new(type,name) end end diff --git a/lib/yard/mruby/handlers/c/header/function_handler.rb b/lib/yard/mruby/handlers/c/header/function_handler.rb index 3d401a8..52ce583 100644 --- a/lib/yard/mruby/handlers/c/header/function_handler.rb +++ b/lib/yard/mruby/handlers/c/header/function_handler.rb @@ -4,7 +4,7 @@ module YARD::MRuby::Handlers::C::Header MRB_(API|INLINE)\s+ ((struct\s+)?\w+(\s*\*)?)\s* ((\w+\s+)+)?(\w+)\s* - \(([\w\s\*,]*)\) + \(([\w\s\*,\.]*)\) /mx handles MATCH |
