mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 12:05:15 +00:00
LibRegex: Do not return an Optional from Regex::Matcher::execute
The code path that could return an optional no longer exists as of
commit: a962ee020a
This commit is contained in:
parent
27d3de1f17
commit
3729fd06fa
Notes:
sideshowbarker
2024-07-17 19:46:36 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/3729fd06fab Pull-request: https://github.com/SerenityOS/serenity/pull/12295
2 changed files with 9 additions and 14 deletions
|
@ -216,14 +216,12 @@ RegexResult Matcher<Parser>::match(Vector<RegexStringView> const& views, Optiona
|
|||
|
||||
auto success = execute(input, state, temp_operations);
|
||||
// This success is acceptable only if it doesn't read anything from the input (input length is 0).
|
||||
if (state.string_position <= view_index) {
|
||||
if (success.has_value() && success.value()) {
|
||||
operations = temp_operations;
|
||||
if (!match_count) {
|
||||
// Nothing was *actually* matched, so append an empty match.
|
||||
append_match(input, state, view_index);
|
||||
++match_count;
|
||||
}
|
||||
if (success && (state.string_position <= view_index)) {
|
||||
operations = temp_operations;
|
||||
if (!match_count) {
|
||||
// Nothing was *actually* matched, so append an empty match.
|
||||
append_match(input, state, view_index);
|
||||
++match_count;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -251,10 +249,7 @@ RegexResult Matcher<Parser>::match(Vector<RegexStringView> const& views, Optiona
|
|||
state.repetition_marks.clear();
|
||||
|
||||
auto success = execute(input, state, operations);
|
||||
if (!success.has_value())
|
||||
return { false, 0, {}, {}, {}, operations };
|
||||
|
||||
if (success.value()) {
|
||||
if (success) {
|
||||
succeeded = true;
|
||||
|
||||
if (input.regex_options.has_flag_set(AllFlags::MatchNotEndOfLine) && state.string_position == input.view.length()) {
|
||||
|
@ -417,7 +412,7 @@ private:
|
|||
};
|
||||
|
||||
template<class Parser>
|
||||
Optional<bool> Matcher<Parser>::execute(MatchInput const& input, MatchState& state, size_t& operations) const
|
||||
bool Matcher<Parser>::execute(MatchInput const& input, MatchState& state, size_t& operations) const
|
||||
{
|
||||
BumpAllocatedLinkedList<MatchState> states_to_try_next;
|
||||
size_t recursion_level = 0;
|
||||
|
|
|
@ -74,7 +74,7 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
Optional<bool> execute(MatchInput const& input, MatchState& state, size_t& operations) const;
|
||||
bool execute(MatchInput const& input, MatchState& state, size_t& operations) const;
|
||||
|
||||
Regex<Parser> const* m_pattern;
|
||||
typename ParserTraits<Parser>::OptionsType const m_regex_options;
|
||||
|
|
Loading…
Add table
Reference in a new issue