From a222e8a165ad7c53640d10c916362bab7c1c8f9c Mon Sep 17 00:00:00 2001 From: Username404-59 Date: Tue, 6 Jul 2021 14:32:50 +0200 Subject: [PATCH] Fix the characters placed next to identifiers/numbers being skipped in lexer.cpp. --- src/etc/lexer.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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; }