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;
|
case '\n': break;
|
||||||
default: {
|
default: {
|
||||||
tok::type type = getIdentifierCharType(current);
|
tok::type type = getIdentifierCharType(current);
|
||||||
|
bool isTypeString = (type == tok::STRING);
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case tok::UNEXPECTED: break;
|
case tok::UNEXPECTED: break;
|
||||||
case tok::STRING: ++i;
|
case tok::STRING: ++i;
|
||||||
case tok::IDENTIFIER: case tok::NUMBER: {
|
case tok::IDENTIFIER: case tok::NUMBER: {
|
||||||
string formedString;
|
string formedString;
|
||||||
for (;i < in.size(); ++i) {
|
for (;i < in.size(); ++i) {
|
||||||
bool isString = getIdentifierCharType(in[i]) == tok::STRING;
|
tok::type currentCharType = getIdentifierCharType(in[i]);
|
||||||
if ((getIdentifierCharType(in[i]) == type || type == tok::STRING) && !isString) {
|
bool isString = currentCharType == tok::STRING;
|
||||||
|
if ((currentCharType == type || isTypeString) && !isString) {
|
||||||
formedString += string(1, in[i]);
|
formedString += string(1, in[i]);
|
||||||
} else {
|
} else {
|
||||||
|
if (not isTypeString) --i;
|
||||||
resVal.emplace_back(type, formedString);
|
resVal.emplace_back(type, formedString);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user