Skip to content

#pragma mark - with a math expression causes an assert to fail. #140

Closed
cmkilger opened this Issue Sep 14, 2011 · 2 comments

2 participants

@cmkilger

The following code fails at GBMethodData.m:37. Removing the "-" from the #pragma mark or adding anything besides whitespace between the closing parenthesis and the semicolon make it pass.

@implementation SomeClass

#pragma mark -

- (int) negativeTen {
    return -(10);
}

@end
@tomaz
Owner
tomaz commented Sep 14, 2011

appledoc probably takes the minus (from #pragma) and tries to evaluate method, then encountering a second minus (from actual method) and fails. Will take a look.

@tomaz
Owner
tomaz commented Dec 9, 2011

From my testing, using #pragma mark - will omit the first method after, as reported in #156. Am investigating it right now - if it's quick fix, I'll do it, otherwise it'll have to wait...

@tomaz tomaz added a commit that closed this issue Dec 9, 2011
@tomaz Implemented `#pragma mark -` handling. Closes #140 and #156.
The problem was in appledoc interpreting `-` after `#pragma mark` as start of instance method definiton/declaration and as it failed to match open parenthesis after, it skipped the rest of unmatched symbols until next match was found. This effectively resulted in first method or property after the pragma being skipped. The fix herein should handle these situations...

**Implementation note:** Note that the code first goes on and tries to match a method (due to minus sign). Method matching code was updated so that it skips repeating minus and plus until followed by an open parenthesis. This covered methods after pragma, but property definition still remained problematic. Although method matching properly exits once it finds `@property` token, the token is consumed before giving a chance of matching a property. Hence the code had to be updated to prevent consuming. This successfully parsed the property, however property matching code reset comments. So a class level flag was introduced that is set inside method matching code and is checked before resetting comment when parsing property; if flag is set, comments are not reset, otherwise they are. Not the prettiest solution, but (seems) to work...
9cbc232
@tomaz tomaz closed this in 9cbc232 Dec 9, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.