瀏覽代碼

LibJS: Properly consume escaped backslash in regex literal

Matthew Olsson 5 年之前
父節點
當前提交
cc7462daeb
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      Libraries/LibJS/Lexer.cpp

+ 1 - 1
Libraries/LibJS/Lexer.cpp

@@ -485,7 +485,7 @@ Token Lexer::next()
                     break;
                 }
 
-                if (match('\\', '/') || match('\\', '[') || (m_regex_is_in_character_class && match('\\', ']')))
+                if (match('\\', '/') || match('\\', '[') || match('\\', '\\') || (m_regex_is_in_character_class && match('\\', ']')))
                     consume();
                 consume();
             }