mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 08:24:58 +00:00
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:
parent
daa6d99e6e
commit
97f7132b82
1 changed files with 6 additions and 3 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue