mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-31 13:19:05 +00:00
LibRegex: Store 'String' matches inside the bytecode
Also removes an unnecessary 'length' argument (StringView has a length!)
This commit is contained in:
parent
6b4281c3aa
commit
19bf7734a4
Notes:
sideshowbarker
2024-07-19 01:02:01 +09:00
Author: https://github.com/alimpfard
Commit: 19bf7734a4
Pull-request: https://github.com/SerenityOS/serenity/pull/4333
3 changed files with 22 additions and 12 deletions
|
@ -430,7 +430,7 @@ ALWAYS_INLINE bool PosixExtendedParser::parse_sub_expression(ByteCode& stack, si
|
|||
if (length > 1) {
|
||||
// last character is inserted into 'bytecode' for duplication symbol handling
|
||||
auto new_length = length - ((match_repetition_symbol() && length > 1) ? 1 : 0);
|
||||
stack.insert_bytecode_compare_string(start_token.value(), new_length);
|
||||
stack.insert_bytecode_compare_string({ start_token.value().characters_without_null_termination(), new_length });
|
||||
}
|
||||
|
||||
if ((match_repetition_symbol() && length > 1) || length == 1) // Create own compare opcode for last character before duplication symbol
|
||||
|
@ -1099,7 +1099,7 @@ bool ECMA262Parser::parse_atom_escape(ByteCode& stack, size_t& match_length_mini
|
|||
}
|
||||
match_length_minimum += maybe_length.value();
|
||||
|
||||
stack.insert_bytecode_compare_named_reference(name, name.length());
|
||||
stack.insert_bytecode_compare_named_reference(name);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue