From b4e10279d25839c101d92beb8462f7282b482229 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=A6=E5=87=8C=E6=B1=90?= Date: Thu, 19 Dec 2024 17:58:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86=E4=B8=8D=E8=83=BD?= =?UTF-8?q?=E6=AD=A3=E7=A1=AE=E5=A4=84=E7=90=86=E5=AD=97=E7=AC=A6=E3=80=81?= =?UTF-8?q?=E5=AD=97=E7=AC=A6=E4=B8=B2=E4=B8=AD=E7=9A=84'=E5=92=8C"?= =?UTF-8?q?=E5=AD=97=E7=AC=A6=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/LexicalAnalysis.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/utils/LexicalAnalysis.h b/utils/LexicalAnalysis.h index f26da0c..01d3ddf 100644 --- a/utils/LexicalAnalysis.h +++ b/utils/LexicalAnalysis.h @@ -206,7 +206,8 @@ private: !maybeOperatorOrDelimiterWith2Letters(preprocessedText[currentIndex])) { if(preprocessedText[currentIndex] == '\"') { currentToken += preprocessedText[currentIndex++]; - while(preprocessedText[currentIndex] != '\"') { + while(currentIndex < preprocessedText.length()) { + if(preprocessedText[currentIndex] == '\"' && preprocessedText[currentIndex - 1] != '\\') break; currentToken += preprocessedText[currentIndex++]; } currentToken += preprocessedText[currentIndex++]; @@ -215,7 +216,8 @@ private: } if(preprocessedText[currentIndex] == '\'') { currentToken += preprocessedText[currentIndex++]; - while(preprocessedText[currentIndex] != '\'') { + while(currentIndex < preprocessedText.length()) { + if(preprocessedText[currentIndex] == '\'' && preprocessedText[currentIndex - 1] != '\\') break; currentToken += preprocessedText[currentIndex++]; } currentToken += preprocessedText[currentIndex++];