GBObjectiveCParser Class Reference
Inherits from | NSObject |
Declared in | GBObjectiveCParser.h GBObjectiveCParser.m |
Overview
Implements Objective-C source code parser.
The main responsibility of this class is encapsulation of Objective-C source code parsing into in-memory representation. As we're only parsing a small subset of Objective-C and even then we don't need to handle much specifics beyond recognizing different classes, variables, methods etc., overall the parsing process is quite simple. Basically we use ParseKit's PKTokenizer
to split given input string into tokens and then traverse the list of tokens to get the data we need.
Tasks
Initialization & disposal
-
+ parserWithSettingsProvider:
Returns autoreleased parser to work with the givenGBApplicationSettingsProvider
implementor. -
– initWithSettingsProvider:
Initializes the parser to work with the givenGBApplicationSettingsProvider
implementor.
Parsing handling
-
– parseObjectsFromString:sourceFile:toStore:
Parses all objects from the given string.
Class Methods
parserWithSettingsProvider:
Returns autoreleased parser to work with the given GBApplicationSettingsProvider
implementor.
+ (id)parserWithSettingsProvider:(id)settingsProvider
Parameters
- settingsProvider
- Application-wide settings provider to use for checking parameters.
Return Value
Returns initialized instance or nil
if initialization fails.
Discussion
This is the designated initializer.
Exceptions
- NSException
- Thrown if the given application is
nil
.
Declared In
GBObjectiveCParser.h
Instance Methods
initWithSettingsProvider:
Initializes the parser to work with the given GBApplicationSettingsProvider
implementor.
- (id)initWithSettingsProvider:(id)settingsProvider
Parameters
- settingsProvider
- Application-wide settings provider to use for checking parameters.
Return Value
Returns initialized instance or nil
if initialization fails.
Discussion
This is the designated initializer.
Exceptions
- NSException
- Thrown if the given application is
nil
.
Declared In
GBObjectiveCParser.h
parseObjectsFromString:sourceFile:toStore:
Parses all objects from the given string.
- (void)parseObjectsFromString:(NSString *)input sourceFile:(NSString *)filename toStore:(id)store
Parameters
- input
- The input string to parse from.
- filename
- The name of the file including extension.
- store
- Store into which the objects should be added.
Discussion
The method adds all detected objects to the given store.
Exceptions
- NSException
- Thrown if the given input or store is
nil
.
Declared In
GBObjectiveCParser.h