Fix the characters placed next to identifiers/numbers being skipped in lexer.cpp.
This commit is contained in:
parent
46a3964596
commit
a222e8a165
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue