Skip to content

Commit

Permalink
Merge pull request #195 from jerryhjones/master
Browse files Browse the repository at this point in the history
Description-less @param fix, headerdoc preprocessing update & tokens template fox. Thanks to @JerryJones. Closes #195.
  • Loading branch information
tomaz committed Mar 2, 2012
2 parents d0b2c17 + aea9a05 commit 5a7b3d8
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 9 deletions.
8 changes: 6 additions & 2 deletions Parsing/GBTokenizer.m
Original file line number Diff line number Diff line change
Expand Up @@ -302,10 +302,14 @@ - (NSString *)lineByPreprocessingHeaderDocDirectives:(NSString *)line {

// Remove the entire line when it contains @method or property or class.
line = [line stringByReplacingOccurrencesOfRegex:@"(?m:@(protocol|method|property|class).*$)" withString:@""];

// Remove unsupported headerDoc words.
line = [line stringByReplacingOccurrencesOfRegex:@"(?m:^\\s*@(discussion|abstract))\\s?" withString:@"\n"];


// Remove unsupported Doxygen words.
line = [line stringByReplacingOccurrencesOfRegex:@"(?m:^\\s*@(brief))\\s?" withString:@""];
line = [line stringByReplacingOccurrencesOfRegex:@"(?m:^\\s*@(details))\\s?" withString:@"\n"];

// Replace methodgroup with name.
line = [line stringByReplacingOccurrencesOfRegex:@"(?:@(methodgroup|group))" withString:@"@name"];
return line;
Expand Down
47 changes: 41 additions & 6 deletions Processing/GBCommentsProcessor.m
Original file line number Diff line number Diff line change
Expand Up @@ -314,10 +314,17 @@ - (BOOL)processParamBlockInString:(NSString *)string lines:(NSArray *)lines bloc
// Get data from captures. Index 1 is directive, index 2 name, index 3 description text.
NSString *name = [components objectAtIndex:2];
NSString *description = [components objectAtIndex:3];
NSString *prefix = [string substringToIndex:[string rangeOfString:description].location];
NSRange range = [string rangeOfString:description];
NSString *prefix = nil;
if (range.location < [string length]) {
prefix = [string substringToIndex:range.location];
} else {
prefix = @"";
}

GBLogDebug(@"- Registering parameter %@ description %@ at %@...", name, [description normalizedDescription], self.currentSourceInfo);
[self reserveShortDescriptionFromLines:lines range:shortRange removePrefix:prefix];

// Prepare object representation from the description and register the parameter to the comment.
GBCommentArgument *argument = [GBCommentArgument argumentWithName:name sourceInfo:self.currentSourceInfo];
GBCommentComponent *component = [self commentComponentByPreprocessingString:description withFlags:0];
Expand All @@ -333,7 +340,14 @@ - (BOOL)processExceptionBlockInString:(NSString *)string lines:(NSArray *)lines
// Get data from captures. Index 1 is directive, index 2 name, index 3 description text.
NSString *name = [components objectAtIndex:2];
NSString *description = [components objectAtIndex:3];
NSString *prefix = [string substringToIndex:[string rangeOfString:description].location];
NSRange range = [string rangeOfString:description];
NSString *prefix = nil;
if (range.location < [string length]) {
prefix = [string substringToIndex:range.location];
} else {
prefix = @"";
}

GBLogDebug(@"- Registering exception %@ description %@ at %@...", name, [description normalizedDescription], self.currentSourceInfo);
[self reserveShortDescriptionFromLines:lines range:shortRange removePrefix:prefix];

Expand All @@ -351,7 +365,14 @@ - (BOOL)processAvailabilityBlockInString:(NSString *)string lines:(NSArray *)lin

// Get data from captures. Index 1 is directive, index 2 description text.
NSString *description = [components objectAtIndex:2];
NSString *prefix = [string substringToIndex:[string rangeOfString:description].location];
NSRange range = [string rangeOfString:description];
NSString *prefix = nil;
if (range.location < [string length]) {
prefix = [string substringToIndex:range.location];
} else {
prefix = @"";
}

GBLogDebug(@"- Registering availability description %@ at %@...", [description normalizedDescription], self.currentSourceInfo);
[self reserveShortDescriptionFromLines:lines range:shortRange removePrefix:prefix];

Expand All @@ -367,7 +388,14 @@ - (BOOL)processReturnBlockInString:(NSString *)string lines:(NSArray *)lines blo

// Get data from captures. Index 1 is directive, index 2 description text.
NSString *description = [components objectAtIndex:2];
NSString *prefix = [string substringToIndex:[string rangeOfString:description].location];
NSRange range = [string rangeOfString:description];
NSString *prefix = nil;
if (range.location < [string length]) {
prefix = [string substringToIndex:range.location];
} else {
prefix = @"";
}

GBLogDebug(@"- Registering return description %@ at %@...", [description normalizedDescription], self.currentSourceInfo);
[self reserveShortDescriptionFromLines:lines range:shortRange removePrefix:prefix];

Expand All @@ -383,7 +411,14 @@ - (BOOL)processRelatedBlockInString:(NSString *)string lines:(NSArray *)lines bl

// Get data from captures. Index 1 is directive, index 2 reference.
NSString *reference = [components objectAtIndex:2];
NSString *prefix = [string substringToIndex:[string rangeOfString:reference].location];
NSRange range = [string rangeOfString:reference];
NSString *prefix = nil;
if (range.location < [string length]) {
prefix = [string substringToIndex:range.location];
} else {
prefix = @"";
}

GBLogDebug(@"- Registering related symbol %@ at %@...", reference, self.currentSourceInfo);
[self reserveShortDescriptionFromLines:lines range:shortRange removePrefix:prefix];

Expand Down
2 changes: 1 addition & 1 deletion Templates/docset/Contents/Resources/tokens-template.xml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,6 @@ Section MethodDeclaration
EndSection

Section GBCommentComponentsList
{{#components}}{{&textValue}}{{/components}}
{{#components}}{{textValue}}{{/components}}
EndSection

0 comments on commit 5a7b3d8

Please sign in to comment.