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++];