From f8fd784619fd1b17802bc173cdadebd6a3c26918 Mon Sep 17 00:00:00 2001 From: Ilya Trubachev Date: Tue, 30 Aug 2022 12:44:08 +0300 Subject: [PATCH] fix lexer for regexps Signed-off-by: Ilya Trubachev --- lexer/lexer.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lexer/lexer.cpp b/lexer/lexer.cpp index 880527188..7849aa756 100644 --- a/lexer/lexer.cpp +++ b/lexer/lexer.cpp @@ -1110,6 +1110,11 @@ RegExpFlags Lexer::ScanRegExpFlags() RegExp Lexer::ScanRegExp() { + // for proper handling such regexps as /=/ + if (GetToken().Type() == lexer::TokenType::PUNCTUATOR_DIVIDE_EQUAL) { + Iterator().Backward(1); + } + GetToken().type_ = TokenType::LITERAL_REGEXP; const auto patternStart = Iterator().Index(); -- Gitee