Fix the characters placed next to identifiers/numbers being skipped in lexer.cpp.

This commit is contained in:
Username404-59 2021-07-06 14:32:50 +02:00
parent 46a3964596
commit a222e8a165
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
1 changed files with 5 additions and 2 deletions

View File

@ -32,16 +32,19 @@ vector<tok> 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;
}