From c190e308f88b429aebefca7ce9e3162b0d0dd7b5 Mon Sep 17 00:00:00 2001 From: Username404-59 Date: Thu, 1 Apr 2021 15:32:31 +0200 Subject: [PATCH] Remove separator tokens, and move a boolean variable. --- src/etc/lexer.cpp | 7 ++----- src/headers/lex.hpp | 1 - 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/etc/lexer.cpp b/src/etc/lexer.cpp index 418594e..184109f 100644 --- a/src/etc/lexer.cpp +++ b/src/etc/lexer.cpp @@ -4,10 +4,6 @@ using namespace std; vector 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& lex(const string& in) { + bool longLex = false; pair generated; for (const char& current : in) { if (!longLex) { @@ -39,7 +36,7 @@ vector& 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) { diff --git a/src/headers/lex.hpp b/src/headers/lex.hpp index a5924b1..c1997ff 100644 --- a/src/headers/lex.hpp +++ b/src/headers/lex.hpp @@ -11,7 +11,6 @@ struct tok { SQUOTE, STRING, IDENTIFIER, - SEPARATOR, UNEXPECTED }; type toktype;