Skip to content
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

Merged
merged 4 commits into from
May 12, 2024

Conversation

ethanc8
Copy link
Contributor

@ethanc8 ethanc8 commented Feb 5, 2024

No description provided.

@ethanc8 ethanc8 requested a review from rfm as a code owner February 5, 2024 18:38
Source/NSString.m Outdated Show resolved Hide resolved
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){
Copy link
Member

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); ?

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Contributor Author

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?

Source/NSString.m Outdated Show resolved Hide resolved
@ethanc8
Copy link
Contributor Author

ethanc8 commented Feb 5, 2024

@ethanc8
Copy link
Contributor Author

ethanc8 commented Feb 18, 2024

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);
Copy link
Member

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.

@fredkiefer
Copy link
Member

Apart from the NSLog statements this looks fine for me now.

@rfm rfm merged commit 1fdf639 into gnustep:master May 12, 2024
6 of 7 checks passed
@rfm
Copy link
Contributor

rfm commented May 12, 2024

This has been outstanding for a while ... I'll tweak any minor remaining issues.

@ethanc8
Copy link
Contributor Author

ethanc8 commented May 12, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants