Remove separator tokens, and move a boolean variable.
This commit is contained in:
parent
b37250492a
commit
c190e308f8
|
@ -4,10 +4,6 @@ using namespace std;
|
|||
|
||||
vector<tok> resVal;
|
||||
|
||||
void separate() {resVal.emplace_back(tok::SEPARATOR, "");}
|
||||
|
||||
bool longLex = false;
|
||||
|
||||
tok::type getIdentifierCharType(const char& Char) {
|
||||
if (isalpha(Char)) return tok::IDENTIFIER;
|
||||
else if (isdigit(Char)) return tok::NUMBER;
|
||||
|
@ -17,6 +13,7 @@ tok::type getIdentifierCharType(const char& Char) {
|
|||
|
||||
vector<tok>& lex(const string& in)
|
||||
{
|
||||
bool longLex = false;
|
||||
pair<tok::type, string> generated;
|
||||
for (const char& current : in) {
|
||||
if (!longLex) {
|
||||
|
@ -39,7 +36,7 @@ vector<tok>& lex(const string& in)
|
|||
case '<': resVal.emplace_back(tok::RCOMP, "<"); break;
|
||||
case '\'': resVal.emplace_back(tok::SQUOTE, "\'"); break;
|
||||
case ' ': case '\t': case '\r':
|
||||
case '\n': separate(); break;
|
||||
case '\n': break;
|
||||
default: {
|
||||
tok::type type = getIdentifierCharType(current);
|
||||
switch (type) {
|
||||
|
|
|
@ -11,7 +11,6 @@ struct tok {
|
|||
SQUOTE,
|
||||
STRING,
|
||||
IDENTIFIER,
|
||||
SEPARATOR,
|
||||
UNEXPECTED
|
||||
};
|
||||
type toktype;
|
||||
|
|
Loading…
Reference in New Issue