From e9ce6362afb88a667243cff605a8f0fde49dd07e Mon Sep 17 00:00:00 2001 From: Username404 Date: Tue, 10 Aug 2021 13:54:50 +0200 Subject: [PATCH] Add a DOT token to lex.hpp, and only use the enum characters. --- src/etc/lexer.cpp | 3 ++- src/headers/lex.hpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/etc/lexer.cpp b/src/etc/lexer.cpp index d7e4d83..61c02bd 100644 --- a/src/etc/lexer.cpp +++ b/src/etc/lexer.cpp @@ -19,7 +19,8 @@ vector lex(const string& in) case TAG: case DEFINE: case LPAR: case RPAR: case LBRACE: case RBRACE: case LBRACKET: case RBRACKET: case PLUS: case HYPHEN: case LCOMP: case RCOMP: - case '$': case '\'': resVal.emplace_back(static_cast(current), string(1, current)); + case DOT: case DOLLAR_SIGN: case SQUOTE: + resVal.emplace_back(static_cast(current), string(1, current)); [[likely]] case ' ': case '\t': case '\r': [[likely]] case '\n': break; default: { diff --git a/src/headers/lex.hpp b/src/headers/lex.hpp index e07d724..bdaa676 100644 --- a/src/headers/lex.hpp +++ b/src/headers/lex.hpp @@ -12,7 +12,7 @@ struct tok { }; enum type: const unsigned short { UNEXPECTED = std::numeric_limits::max() + 1, IDENTIFIER, NUMBER, ALPHACHAR, - DEFINE = '=', TAG = '#', DOLLAR_SIGN = '$', + DEFINE = '=', TAG = '#', DOLLAR_SIGN = '$', DOT = '.', PLUS = '+', LPAR = '(', LBRACE = '{', LBRACKET = '[', RPAR = ')', RBRACE = '}', RBRACKET = ']', HYPHEN = '-', LCOMP = '>', RCOMP = '<',