Append characters directly instead of creating a new string in the default case of lexer.cpp

This commit is contained in:
Username404 2021-09-14 20:22:42 +02:00
parent 44e160ebf9
commit 95d6b2239a
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
1 changed files with 1 additions and 1 deletions

View File

@ -36,7 +36,7 @@ vector<tok> lex(const string& in)
const bool isString = currentCharType == STRING; const bool isString = currentCharType == STRING;
if (isTypeString && (i == in.size() - 1 && not isString)) throw tok::LexerException("A never ending string was found", lineNumber); if (isTypeString && (i == in.size() - 1 && not isString)) throw tok::LexerException("A never ending string was found", lineNumber);
if ((currentCharType == type || isTypeString) && !isString) { if ((currentCharType == type || isTypeString) && !isString) {
formedString += string(1, in[i]); formedString += in[i];
} else { } else {
if (not isTypeString) --i; if (not isTypeString) --i;
resVal.emplace_back(type, formedString, lineNumber); resVal.emplace_back(type, formedString, lineNumber);