expr: Use Basic Posix regular expressions

Dr.POSIX requires expr to use BREs, so let's use BREs.
Fixes #8506.
This commit is contained in:
Ali Mohammad Pur 2021-07-10 13:19:47 +04:30 committed by Andreas Kling
parent daa6d99e6e
commit 97f7132b82
Notes: sideshowbarker 2024-07-18 09:26:07 +09:00

View File

@ -441,14 +441,17 @@ private:
void ensure_regex() const
{
if (!m_compiled_regex)
m_compiled_regex = make<regex::Regex<PosixExtended>>(m_pos_or_chars->string());
if (!m_compiled_regex) {
m_compiled_regex = make<regex::Regex<PosixBasic>>(m_pos_or_chars->string());
if (m_compiled_regex->parser_result.error != regex::Error::NoError)
fail("Regex error: {}", regex::get_error_string(m_compiled_regex->parser_result.error));
}
}
StringOperation m_op { StringOperation::Substring };
NonnullOwnPtr<Expression> m_str;
OwnPtr<Expression> m_pos_or_chars, m_length;
mutable OwnPtr<regex::Regex<PosixExtended>> m_compiled_regex;
mutable OwnPtr<regex::Regex<PosixBasic>> m_compiled_regex;
};
NonnullOwnPtr<Expression> Expression::parse(Queue<StringView>& args, Precedence prec)