1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:58:12 +00:00

LibRegex: Store 'String' matches inside the bytecode

Also removes an unnecessary 'length' argument (StringView has a length!)
This commit is contained in:
AnotherTest 2020-12-06 17:02:03 +03:30 committed by Andreas Kling
parent 6b4281c3aa
commit 19bf7734a4
3 changed files with 22 additions and 12 deletions

View file

@ -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;
}