diff --git a/src/etc/lexer.cpp b/src/etc/lexer.cpp index 4a54ce3..bc58ca9 100644 --- a/src/etc/lexer.cpp +++ b/src/etc/lexer.cpp @@ -32,16 +32,19 @@ vector lex(const string& in) case '\n': break; default: { tok::type type = getIdentifierCharType(current); + bool isTypeString = (type == tok::STRING); switch (type) { case tok::UNEXPECTED: break; case tok::STRING: ++i; case tok::IDENTIFIER: case tok::NUMBER: { string formedString; for (;i < in.size(); ++i) { - bool isString = getIdentifierCharType(in[i]) == tok::STRING; - if ((getIdentifierCharType(in[i]) == type || type == tok::STRING) && !isString) { + tok::type currentCharType = getIdentifierCharType(in[i]); + bool isString = currentCharType == tok::STRING; + if ((currentCharType == type || isTypeString) && !isString) { formedString += string(1, in[i]); } else { + if (not isTypeString) --i; resVal.emplace_back(type, formedString); break; }