Add a DOT token to lex.hpp, and only use the enum characters.

This commit is contained in:
Username404 2021-08-10 13:54:50 +02:00
parent 7a23e31dea
commit e9ce6362af
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
2 changed files with 3 additions and 2 deletions

View File

@ -19,7 +19,8 @@ vector<tok> 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<tok::type>(current), string(1, current));
case DOT: case DOLLAR_SIGN: case SQUOTE:
resVal.emplace_back(static_cast<tok::type>(current), string(1, current));
[[likely]] case ' ': case '\t': case '\r':
[[likely]] case '\n': break;
default: {

View File

@ -12,7 +12,7 @@ struct tok {
};
enum type: const unsigned short {
UNEXPECTED = std::numeric_limits<unsigned char>::max() + 1, IDENTIFIER, NUMBER, ALPHACHAR,
DEFINE = '=', TAG = '#', DOLLAR_SIGN = '$',
DEFINE = '=', TAG = '#', DOLLAR_SIGN = '$', DOT = '.',
PLUS = '+', LPAR = '(', LBRACE = '{', LBRACKET = '[', RPAR = ')',
RBRACE = '}', RBRACKET = ']',
HYPHEN = '-', LCOMP = '>', RCOMP = '<',