mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-11 01:06:01 +03: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
Notes:
sideshowbarker
2024-07-18 09:26:07 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/97f7132b822 Pull-request: https://github.com/SerenityOS/serenity/pull/8606
@ -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…
Reference in New Issue
Block a user