From: APTX Date: Sat, 7 Mar 2026 04:55:51 +0000 (+0900) Subject: Fix AniAdd lexer X-Git-Url: https://gitweb.tyo.aptx.org/?a=commitdiff_plain;h=cf4a1ce5a60a75c2e44822597edb51a7a4eb4de9;p=anidbudpclient.git Fix AniAdd lexer The new regex engine matches the regex slightly differently leading to splitting quoted string on spaces in some cases. Also fixes compiling with PARSER_DEBUG enabled. --- diff --git a/renameparser/AniAdd/lexer.cpp b/renameparser/AniAdd/lexer.cpp index b3606ab..b12a7d7 100644 --- a/renameparser/AniAdd/lexer.cpp +++ b/renameparser/AniAdd/lexer.cpp @@ -37,7 +37,7 @@ bool Lexer::next() return false; } #ifdef PARSER_DEBUG - QString m = rx.cap(); + QString m = m_last_match.captured(0); qDebug() << "TOKEN=" << m; #endif m_pos += m_last_match.capturedLength(); @@ -131,7 +131,8 @@ void Lexer::staticInit() staticInitialised = true; } -const char *Lexer::regexp = ":=|=|%|\\?|:|\\$|,|\\(|\\)|\\[|\\]|\\{|\\}|\\n|else|if|(:?//|#)[^\\n]*\\n|[^\"\\[\\]:= {}(),%$?\\n]+|\"[^\"]*\"|'[^']*'"; +const char *Lexer::regexp = + ":=|=|%|\\?|:|\\$|,|\\(|\\)|\\[|\\]|\\{|\\}|\\n|else|if|(:?//|#)[^\\n]*\\n|\"[^\"]*\"|'[^']*'|[^\"\\[\\]:= {}(),%$?\\n]+"; QRegularExpression Lexer::rx(Lexer::regexp); QMap Lexer::tokenMap;