-
Notifications
You must be signed in to change notification settings - Fork 283
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement +[NSRegularExpression escapedPatternForString:] and -[NSString enumerateSubstringsInRange:options:usingBlock] #370
Conversation
Source/NSString.m
Outdated
NSUInteger end; | ||
// contains the index of the first character of the terminator of the line containing the end of aRange. | ||
NSUInteger contentsEnd; | ||
NSRange currentLocationRange = (NSRange){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use NSMakeRange(currentLocation, 0);
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a stylistic choice? I find
(NSRange){
.location = currentLocation,
.length = 0,
}
more readable, but I can change this if this is the standard style or if it causes problems with old compilers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As Richard wrote, changing this and a lot of other style difference would be great.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fredkiefer I see in a lot of other places in the code the use of (NSRange){location, length}
. Is this also an issue, or are there cases in which the (NSRange){location, length}
syntax is applicable?
Apple's Swift implementations:
See also CoreFoundation: |
I believe a15fa66 has solved many of the stylistic issues. |
// However, valid words seem to be UBRK_WORD_NONE, and invalid words | ||
// seem to be UBRK_WORD_NONE_LIMIT. | ||
isValidSubstring = ruleStatus != UBRK_WORD_NONE_LIMIT; | ||
NSLog(@"Status for position %d (%d): %d", (int)currentLocation, (int)ubrk_current(breakIterator), (int) ruleStatus); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you planing to leave these log statements in? In that case you should turn them into debug logs.
Apart from the NSLog statements this looks fine for me now. |
This has been outstanding for a while ... I'll tweak any minor remaining issues. |
Sorry, I've been very busy. You can remove the log statements; I don't think they'd be useful for anyone debugging other than me. |
No description provided.