bin/rucy2rdoc in rucy-0.1.6 vs bin/rucy2rdoc in rucy-0.1.7

- old
+ new

@@ -24,15 +24,15 @@ end end def parse_functions (lines) re = %r{ - (?:RUBY_)?DEF(\d+|N|_ALLOC)\( (\w+) \s* ((?:\, \s* \w+)*) \s* \) \s* + (?:RUCY_)?DEF(\d+|N|_ALLOC)\( (\w+) \s* ((?:\, \s* \w+)*) \s* \) \s* (\{ \s* .*? \}) \s* - (?:RUBY_)?END + (?:RUCY_)?END }mx process_lines lines, re do |all, type, name, params, body| type = '-1' if type == 'N' params.gsub! /\,/, ', VALUE' params = '' unless params @@ -40,11 +40,11 @@ params.gsub! /^\,\s*/, '' else params = 'VALUE self' + params end @funs[name] = { - :type => type, + :type => type, :params => params, :body => body } "VALUE #{name}(#{params})\n#{body}" end @@ -70,11 +70,11 @@ (?: (\w+) \s* \. )? \s* (define_(?:module|class)) \s* \( \s* (\"\w+\") \s* (?: \, \s* (\w+) )? \s* \) \s* ; }mx process_lines lines, re do |all, var, recv, define, name, super_| define += '_under' if recv - recv += ", " if recv + recv += ', ' if recv super_ = 'rb_cObject' if !super_ && define =~ /class/ super_ = ', ' + super_ if super_ "#{var} = rb_#{define}(#{recv}#{name}#{super_});" end end @@ -83,10 +83,13 @@ re = %r{ (\w+) \s* \. \s* (define_\w+) \s* \( \s* (?: (\"\w+(?:\=|\?\!)?\") \s* \, \s* )? (\w+) \s* \) \s* ; }mx process_lines lines, re do |all, obj, define, symbol, name| - type = @funs[name][:type] + fun = @funs[name] + next unless fun + + type = fun[:type] if type == '_ALLOC' "rb_#{define}(#{obj}, #{name});" else "rb_#{define}(#{obj}, #{symbol}, RUBY_METHOD_FUNC(#{name}), #{type});" end