objective-c-parser
objective-c-parser copied to clipboard
Faile parse when return object
#import <Foundation/Foundation.h>
@protocol Ponies, Foo;
@interface BasicName : NSObject
//decode error
- (NSString *)basicMethodOne:(NSInteger)argOne AndArgTwo:(NSString *)argTwo;
//decode error
- (int *)demo1:(NSInteger)argOne AndArgTwo:(NSString *)argTwo;
- (NSInteger)basicMethodOne;
@end
my simple patch:
index.js:
const methodDeclarationRegex = /([+-]\s*\([^;]+)(?:\s*;)/g;
const matchReturnType = /(?:[+-]\s*\(\s*)(.+?)(?:\s*\)\s*\w+\s*[;:])/;
const argumentsRegex = /\s?\(((?:\w|\s|\*|\<|\>)*)\)((?:\w)*)\s?/g;
test.h
#import <Foundation/Foundation.h>
@protocol Ponies, Foo;
@interface BasicName : NSObject
//decode error
- ( some_spec1 some_spec2 some_spec3 NSString * )basicMethodOne:(NSInteger)argOne AndArgTwo:(some_spec1 some_spec2 some_spec3 NSString *)argTwo;
//decode error
- (int *)demo1:(NSInteger)argOne AndArgTwo:(NSString *)argTwo;
- (NSInteger )basicMethodOne;
@end
Thank you for filing this @qokelate would you be so kind to open a PR with this fix and a test case for it? :)