dbachrach/OCUDL

Regex based literals

Opened this issue · 4 comments

It would be interesting to do:

PhoneNumber* num = $(555-666-7777);

This would also allow the NSUUID literal to be simplified to not require "uuid" at the end.

This could solve the b vs kb issue as well.

How would you feel about breaking the current prefix / suffix stuff?

Replacing it with regex? I don't think it needs to break the prefix suffix stuff. Those would still be supported:

[[OCUDLManager defaultManager] registerPrefix:@"#" forClass:[UIColor class]];
// can just be a helper which does:
[[OCUDLManager defaultManager] registerRegex:@"^#" forClass:[UIColor class]];

A better regex for UIColor would capture the # and 3-6 hex characters to be more precise, but I don't think regex has to break prefix/suffix.

That is true and that is what I've been working on. I think I've just come up with a solution. Going to try it now