-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtokenMaps.h
31 lines (29 loc) · 923 Bytes
/
tokenMaps.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#pragma once
#include <map>
#include <string>
#include "token.h"
static std::map<char, TokenType> charToToken = {
{'=', TokenType::T_ASSIGN},
{'+', TokenType::T_PLUS},
{'-', TokenType::T_MINUS},
{';', TokenType::T_SEMI},
{'(', TokenType::T_LPAREN},
{')', TokenType::T_RPAREN},
{'{', TokenType::T_LCURLY},
{'}', TokenType::T_RCURLY},
{',', TokenType::T_COMMA},
{'<', TokenType::T_LESSTHAN},
{'>', TokenType::T_GREATERTHAN},
};
static std::map<std::string, TokenType> stringToToken = {
{"int", TokenType::T_INT},
{"return", TokenType::T_RETURN},
{"char", TokenType::T_CHAR},
{"while", TokenType::T_WHILE},
{"if", TokenType::T_IF},
{"else", TokenType::T_ELSE},
{"void", TokenType::T_VOID},
{"NESWAITFORFRAME", TokenType::T_NES_WAITFORFRAME},
{"NESSETSPRITEX", TokenType::T_NES_SETSPRITEX},
{"NESSETSPRITEY", TokenType::T_NES_SETSPRITEY},
};