mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-24 13:35:12 +00:00
LibRegex: Allow syntax characters (except ']') without escapes in classes
e.g. `[:]`
This commit is contained in:
parent
b45f3ea0f8
commit
158fe9d9ca
Notes:
sideshowbarker
2024-07-19 01:11:09 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/158fe9d9ca1 Pull-request: https://github.com/SerenityOS/serenity/pull/4198 Reviewed-by: https://github.com/awesomekling Reviewed-by: https://github.com/bugaevc
1 changed files with 3 additions and 6 deletions
|
@ -297,9 +297,6 @@ ALWAYS_INLINE bool PosixExtendedParser::parse_bracket_expression(ByteCode& stack
|
|||
return set_error(Error::InvalidRange);
|
||||
}
|
||||
|
||||
} else if (match(TokenType::Char) || match(TokenType::Period) || match(TokenType::Asterisk) || match(TokenType::EscapeSequence) || match(TokenType::Plus)) {
|
||||
values.append({ CharacterCompareType::Char, (ByteCodeValueType)*consume().value().characters_without_null_termination() });
|
||||
|
||||
} else if (match(TokenType::Circumflex)) {
|
||||
auto t = consume();
|
||||
|
||||
|
@ -385,9 +382,9 @@ ALWAYS_INLINE bool PosixExtendedParser::parse_bracket_expression(ByteCode& stack
|
|||
// closing bracket expression
|
||||
break;
|
||||
}
|
||||
} else
|
||||
// nothing matched, this is a failure, as at least the closing bracket must match...
|
||||
return set_error(Error::MismatchingBracket);
|
||||
} else {
|
||||
values.append({ CharacterCompareType::Char, (ByteCodeValueType)skip() });
|
||||
}
|
||||
|
||||
// check if range expression has to be completed...
|
||||
if (values.size() >= 3 && values.at(values.size() - 2).type == CharacterCompareType::RangeExpressionDummy) {
|
||||
|
|
Loading…
Add table
Reference in a new issue