yard_ext.rb in ray-0.0.1 vs yard_ext.rb in ray-0.1.0.pre1
- old
+ new
@@ -17,17 +17,11 @@
end
class CustomCParser < YARD::Parser::CParser
include YARD
- def parse
- super
- parse_constants
- end
-
private
-
def find_method_body(object, func_name, content = @content)
case content
when %r"((?>/\*.*?\*/\s*))(?:(?:static|SWIGINTERN)\s+)?(?:intern\s+)?VALUE\s+#{func_name}
\s*(\([^)]*\))([^;]|$)"xm
comment, params = $1, $2
@@ -59,31 +53,9 @@
else
# No body, but might still have an override comment
# comment = find_override_comment(object)
comment = nil
object.docstring = parse_comments(object, comment) if comment
- end
- end
-
- def handle_constants(type, var_name, const_name, definition)
- namespace = @namespaces[var_name]
- obj = CodeObjects::ConstantObject.new(namespace, const_name)
- obj.value = definition
- end
-
- def parse_constants
- @content.scan(%r{\Wrb_define_
- ( variable |
- readonly_variable |
- const |
- global_const | )
- \s*\(
- (?:\s*(\w+),)?
- \s*"(\w+)",
- \s*(.*?)\s*\)\s*;
- }xm) do |type, var_name, const_name, definition|
- var_name = "rb_cObject" if !var_name or var_name == "rb_mKernel"
- handle_constants type, var_name, const_name, definition
end
end
end
YARD::Parser::SourceParser.register_parser_type(:c, CustomCParser,