objective-c-parser icon indicating copy to clipboard operation
objective-c-parser copied to clipboard

Faile parse when return object

Open qokelate opened this issue 5 years ago • 2 comments

#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

qokelate avatar Sep 19 '20 03:09 qokelate

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

qokelate avatar Sep 19 '20 03:09 qokelate

Thank you for filing this @qokelate would you be so kind to open a PR with this fix and a test case for it? :)

DanielMSchmidt avatar Sep 21 '20 13:09 DanielMSchmidt