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

expr: improve the GNU compat #7167

Closed
wants to merge 5 commits into from
Closed

Conversation

sylvestre
Copy link
Contributor

@sargas wdyt ?

Copy link

GNU testsuite comparison:

Congrats! The gnu test tests/misc/stdbuf is no longer failing!

Comment on lines +77 to +83
#[derive(Debug, PartialEq)]
enum BraceContent {
Valid,
Invalid,
Unmatched(BraceType),
RegexTooBig,
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Somehow I don't understand the purpose of this enum. With the exception of Valid, its variants are already defined as variants in ExprError.

Comment on lines +145 to +156
match check_posix_regex_errors(&re_string) {
BraceContent::Invalid => match is_valid_curly_content(&re_string) {
Err(ExprError::InvalidBraceContent) => {
return Err(ExprError::InvalidBraceContent)
}
Ok(()) => unreachable!(),
Err(err) => return Err(err),
},
BraceContent::Unmatched(brace) => return Err(ExprError::UnmatchedBrace(brace)),
BraceContent::Valid => {}
BraceContent::RegexTooBig => return Err(ExprError::RegexTooBig),
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's related to my previous comment about BraceContent: I think the creation of the errors could be done in check_posix_regex_errors, thus not needing BraceContent.

@@ -716,21 +739,6 @@ mod test {
assert_eq!(result.eval_as_string(), "");
}

#[test]
fn starting_stars_become_escaped() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this functionality removed with this PR?

("", None) => {
// Empty repeating pattern
invalid_content_error = true;
fn check_posix_regex_errors(s: &str) -> BraceContent {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean to remove the doc? I wanted to be explicit about the reason why this is needed (vs seeing what errors we get from Oniguruma)

@@ -700,10 +727,6 @@ mod test {
AstNode::parse(&["(", "42"]),
Err(ExprError::ExpectedClosingBraceAfter("42".to_string()))
);
assert_eq!(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this removed?

@sylvestre sylvestre closed this by deleting the head repository Feb 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants