Use a switch-case expression instead of an if statement in lexer.cpp.
This commit is contained in:
parent
d3d951d843
commit
8772be9d5c
|
@ -63,9 +63,14 @@ vector<tok>& lex(const string& in)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
tok::type currentType = getIdentifierCharType(current);
|
tok::type currentType = getIdentifierCharType(current);
|
||||||
if ((currentType == tok::STRING) || ((currentType == tok::UNEXPECTED) && ((generated.first == tok::IDENTIFIER) || (generated.first == tok::NUMBER)))) {
|
switch (currentType) {
|
||||||
|
case tok::UNEXPECTED: if ((generated.first == currentType) || (generated.first == tok::STRING)) break;
|
||||||
|
case tok::STRING: {
|
||||||
longLex = false;
|
longLex = false;
|
||||||
} else generated.second.append(string(1, current));
|
break;
|
||||||
|
}
|
||||||
|
default: generated.second.append(string(1, current)); break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Test
|
/* Test
|
||||||
|
|
Loading…
Reference in New Issue