You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// NOTE: This method must not be called during bracket and repetition parsing!
206
206
// FIXME: Add assertion for that?
207
207
auto type = m_parser_state.current_token.type();
208
-
return (type == TokenType::Char
208
+
return ((type == TokenType::Char && m_parser_state.current_token.value() != "\\"sv) // NOTE: Backslash will only be matched as 'char' if it does not form a valid escape.
209
209
|| type == TokenType::Comma
210
210
|| type == TokenType::Slash
211
211
|| type == TokenType::EqualSign
@@ -529,8 +529,23 @@ bool PosixBasicParser::parse_one_char_or_collation_element(ByteCode& bytecode, s
529
529
back(2);
530
530
}
531
531
532
+
if (match(TokenType::Char)) {
533
+
auto ch = consume().value()[0];
534
+
if (ch == '\\') {
535
+
if (m_parser_state.regex_options.has_flag_set(AllFlags::Extra))
536
+
returnset_error(Error::InvalidPattern);
537
+
538
+
// This was \<ORD_CHAR>, the spec does not define any behaviour for this but glibc regex ignores it - and so do we.
0 commit comments