Added YARD::Parser::CParser#find_override_comments #177
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This method is used when the body of a Ruby method (but really its corresponding C function) is not found (in the cases in my code it is because they are defined in C macros). In existing (your) code, it is referenced in comments in parser/c_parser.rb, under find_method_body. I un-commented these, changing the calling syntax for find_override_comment. I then borrowed the gist of find_override_comment from RDoc (just as most of this file is borrowed from RDoc), tweaking the arguments etc to use your more OO-approach. The muscle of this method is the Regex, which is taken directly from RDoc. The first regex matches something like:
The second matches the same without the class explicitly written.
I added a test C source file, spec/parser/examples/override.c.txt. It is taken from my GMP bindings, a C Extension: http://github.com/srawlins/gmp. It contains some Ruby methods (but really, their associated C functions) with and without bodies visible to YARD. For example, GMP::Z#+ and GMP::Z#add! have visible function bodies, and GMP::Z#neg and GMP::Z#neg! do not. So these examples contain comments like:
for a visible-bodied method, and:
for an invisible-bodied method. YARD should seek out both.
I added tests to spec/parser/c_parser_spec.rb
You mentioned the spec/parser specs are weak. I should look at spec/handler instead. I had already written these. I would enjoy writing more specs if I knew exactly where to put them... it looks like method_handler_spec.rb ?
Let me know where you want to go from here.