Append characters directly instead of creating a new string in the default case of lexer.cpp
This commit is contained in:
parent
44e160ebf9
commit
95d6b2239a
|
@ -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);
|
||||||
|
|
Loading…
Reference in New Issue