Inherits from NSObject
Declared in GBCommentComponentsProvider.h
GBCommentComponentsProvider.m

Overview

Provides comment keywords and helpers for the rest of the application.

The main responsibility of the class is to determine if a string contains special section definition. In addition, they also return section parameters. This encapsulates keywords and sections handling and simplifies the rest of the application.

Tasks

Initialization & disposal

  • + provider Returns a new autoreleased GBCommentComponentsProvider instance.

Parameters

Lists definitions

  •   orderedListRegex Returns the regex used for matching ordered lists with capture 1 containing lists indent and capture 2 string value. property
  •   unorderedListRegex Returns the regex used for matching unordered lists with capture 1 containing list indent and capture 2 string value. property

Sections definitions

  •   warningSectionRegex Returns the regex used for matching warning section with capture 1 containing description. property
  •   bugSectionRegex Returns the regex used for matching bug section with capture 1 containing description. property
  •   exampleSectionRegex Returns the regex used for matching example section with capture 1 containing whitespace prefix and capture 2 example text. property

Method specific definitions

  •   methodGroupRegex Returns the regex used for matching method groups with capture 1 containing section name. property
  •   argumentsMatchingRegex Returns the regex used for matching different method parameter descriptions within the paragraph. property
  •   nextArgumentRegex Returns the regex used for finding next method parameter description within the paragraph. property
  •   parameterDescriptionRegex Returns the regex used for matching method parameter description with capture 1 containing parameter name and capture 2 description. property
  •   returnDescriptionRegex Returns the regex used for matching method return description with capture 1 containing description. property
  •   exceptionDescriptionRegex Returns the regex used for matching method exception description with capture 1 containing exception name and capture 2 description. property
  •   crossReferenceRegex Returns the regex used for matching cross reference directive with capture 1 containing link. property

Cross references definitions

Common definitions

  •   newLineRegex Returns the regex containing all possible symbols for matching new lines. property

Properties

argumentsMatchingRegex

Returns the regex used for matching different method parameter descriptions within the paragraph.

@property (readonly) NSString *argumentsMatchingRegex

Declared In

GBCommentComponentsProvider.h

bugSectionRegex

Returns the regex used for matching bug section with capture 1 containing description.

@property (readonly) NSString *bugSectionRegex

Declared In

GBCommentComponentsProvider.h

crossReferenceMarkersTemplate

Sets cross reference markers.

@property (copy) NSString *crossReferenceMarkersTemplate

Discussion

The given string should include optional prefix, followed by %@ and lastly optional suffix. If either prefix or suffix isn't allowed, just pass %@. At the runtime, %@ is replaced by the actual regex for mathching particular cross reference type - actually the whole string becomes the regex for matching cross reference, therefore prefix and suffix can be arbitrary regex expressions themselves! On the other hand, this imposes some limitations to what can be used for them:

  • Prefix and suffix must not contain any capturing components as this will break matching code (you can still include groups, but make sure any open parenthesis is marked as non-capturing like this: (?!
  • Prefix must not contain any marker used for formatting such as *, _ or combinations. This is actually not checked, but in such case results may be not what you wanted.

Important: Note that the given string must contain exactly one %@ marker. If none is included cross references will not be matched during runtime. If more than one is included, unpredicted behavior may occur. So take care!

Important: This value must be set before accessing any cross reference regex property! The accessors prepare and cache the value on first usage. From then on, cached value is returned, so any change is not propagated!

Declared In

GBCommentComponentsProvider.h

crossReferenceRegex

Returns the regex used for matching cross reference directive with capture 1 containing link.

@property (readonly) NSString *crossReferenceRegex

Declared In

GBCommentComponentsProvider.h

exampleSectionRegex

Returns the regex used for matching example section with capture 1 containing whitespace prefix and capture 2 example text.

@property (readonly) NSString *exampleSectionRegex

Declared In

GBCommentComponentsProvider.h

exceptionDescriptionRegex

Returns the regex used for matching method exception description with capture 1 containing exception name and capture 2 description.

@property (readonly) NSString *exceptionDescriptionRegex

Declared In

GBCommentComponentsProvider.h

methodGroupRegex

Returns the regex used for matching method groups with capture 1 containing section name.

@property (readonly) NSString *methodGroupRegex

Declared In

GBCommentComponentsProvider.h

newLineRegex

Returns the regex containing all possible symbols for matching new lines.

@property (readonly) NSString *newLineRegex

Declared In

GBCommentComponentsProvider.h

nextArgumentRegex

Returns the regex used for finding next method parameter description within the paragraph.

@property (readonly) NSString *nextArgumentRegex

Declared In

GBCommentComponentsProvider.h

orderedListRegex

Returns the regex used for matching ordered lists with capture 1 containing lists indent and capture 2 string value.

@property (readonly) NSString *orderedListRegex

Declared In

GBCommentComponentsProvider.h

parameterDescriptionRegex

Returns the regex used for matching method parameter description with capture 1 containing parameter name and capture 2 description.

@property (readonly) NSString *parameterDescriptionRegex

Declared In

GBCommentComponentsProvider.h

returnDescriptionRegex

Returns the regex used for matching method return description with capture 1 containing description.

@property (readonly) NSString *returnDescriptionRegex

Declared In

GBCommentComponentsProvider.h

unorderedListRegex

Returns the regex used for matching unordered lists with capture 1 containing list indent and capture 2 string value.

@property (readonly) NSString *unorderedListRegex

Declared In

GBCommentComponentsProvider.h

warningSectionRegex

Returns the regex used for matching warning section with capture 1 containing description.

@property (readonly) NSString *warningSectionRegex

Declared In

GBCommentComponentsProvider.h

Class Methods

provider

Returns a new autoreleased GBCommentComponentsProvider instance.

+ (id)provider

Declared In

GBCommentComponentsProvider.h

Instance Methods

categoryCrossReferenceRegex:

Returns the regex used for matching (possible) category cross reference with capture 1 containing category name.

- (NSString *)categoryCrossReferenceRegex:(BOOL)templated

Parameters

templated
If YES templated regex is returned, otherwise pure one.

Return Value

Returns the regex used for matching cross reference.

Discussion

The result of the method depends on the templated value: if the value is YES, the string includes template from crossReferenceMarkersTemplate, otherwise it only contains "pure" regex. The first option should be used for in-text cross references detection, while the second for crossReferenceRegex matching.

Declared In

GBCommentComponentsProvider.h

localMemberCrossReferenceRegex:

Returns the regex used for matching (possible) local member cross reference with capture 1 containing member name.

- (NSString *)localMemberCrossReferenceRegex:(BOOL)templated

Parameters

templated
If YES templated regex is returned, otherwise pure one.

Return Value

Returns the regex used for matching cross reference.

Discussion

The result of the method depends on the templated value: if the value is YES, the string includes template from crossReferenceMarkersTemplate, otherwise it only contains "pure" regex. The first option should be used for in-text cross references detection, while the second for crossReferenceRegex matching.

Declared In

GBCommentComponentsProvider.h

objectCrossReferenceRegex:

Returns the regex used for matching (possible) class or protocol cross reference with capture 1 containing object name.

- (NSString *)objectCrossReferenceRegex:(BOOL)templated

Parameters

templated
If YES templated regex is returned, otherwise pure one.

Return Value

Returns the regex used for matching cross reference.

Discussion

The result of the method depends on the templated value: if the value is YES, the string includes template from crossReferenceMarkersTemplate, otherwise it only contains "pure" regex. The first option should be used for in-text cross references detection, while the second for crossReferenceRegex matching.

Declared In

GBCommentComponentsProvider.h

remoteMemberCrossReferenceRegex:

Returns the regex used for matching (possible) remote member cross references with capture 1 containing object name and capture 2 member name.

- (NSString *)remoteMemberCrossReferenceRegex:(BOOL)templated

Parameters

templated
If YES templated regex is returned, otherwise pure one.

Return Value

Returns the regex used for matching cross reference.

Discussion

The result of the method depends on the templated value: if the value is YES, the string includes template from crossReferenceMarkersTemplate, otherwise it only contains "pure" regex. The first option should be used for in-text cross references detection, while the second for crossReferenceRegex matching.

Declared In

GBCommentComponentsProvider.h

urlCrossReferenceRegex:

Returns the regex used for matching URL cross reference with caption 1 contining the URL itself.

- (NSString *)urlCrossReferenceRegex:(BOOL)templated

Parameters

templated
If YES templated regex is returned, otherwise pure one.

Return Value

Returns the regex used for matching cross reference.

Discussion

The result of the method depends on the templated value: if the value is YES, the string includes template from crossReferenceMarkersTemplate, otherwise it only contains "pure" regex. The first option should be used for in-text cross references detection, while the second for crossReferenceRegex matching.

Declared In

GBCommentComponentsProvider.h