Closed thomasfinch closed 6 years ago
Hopefully it's as easy as fixing the regex filtering for %properties here https://github.com/theos/theos/blob/master/bin/logos.pl#L566: /\G%property\s*(?:\((\s*\w+\s*(?:,\s*(?:\w|\=|:)+\s*)*)\))?\s*((?:\w+\s+\**)+)(\w+)\s*;/gc
, ((?:\w+\s+\**)+)(\w+)
being the main part to change.
It might also be beneficial to support more than just \w+
named properties.
This might be a suitable replacement for that part ([a-zA-Z_$][\w$]*(?:\s*[a-zA-Z_$][\w$]*)*(?:\s*\*+)?)\s*(\b[a-zA-Z_$][\w$]*+)
such that the resulting regex would be /\G%property\s*(?:\((\s*\w+\s*(?:,\s*(?:\w|\=|:)+\s*)*)\))?\s*([a-zA-Z_$][\w$]*(?:\s*[a-zA-Z_$][\w$]*)*(?:\s*\*+)*)\s*(\b[a-zA-Z_$][\w$]*+)\s*;/gc
. It's awkwardly longer because \w
matches [a-zA-Z0-9_]
but you can't start symbols with a number so I used [a-zA-Z_$]
as first character and [\w$]
for the following ($
is a valid character in symbols).
These should match:
%property (retain, getter=string2) NSString *string;
%property NSString *string;
%property NSNumber* number;
%property NSSet * set2;
%property BOOL bool;
%property struct dirent _dir;
%property char **list;
%property char2 **list2;
%property char_3 **list_3;
%property char$4 **list$4;
%property char5$ * *list5$;
While these shouldn't match:
%property 2 broken;
%property 2NSString* string;
%property NSNumber* 2number;
%property 2NSSet* 2set;
To compare, current version vs this version
The %property declaration breaks depending on the position of the asterisk in the declaration, ex.
%property (copy) NSObject* myObj
doesn't work but%property (copy) NSObject *myObj
does.What are the steps to reproduce this issue?
%property (copy) NSObject* myObj;
%end
Output of the second perl command (after change):
Any other comments?
This happens regardless of the class being hooked, the object type, or the property type.
What versions of software are you using?
Operating System: Mac OS 10.12.3
Toolchain Version: Not quite sure what this means, but using theos commit
e94545975dda0c669bbcbed1eba0d7382ba49389
(current master head), clang 800.0.42.1SDK Version: iOS 10.2 SDK, Xcode 8.2.1