56 lines
967 B
C++
56 lines
967 B
C++
#ifndef ACPA_TOKEN_H
|
|
#define ACPA_TOKEN_H
|
|
|
|
#include <vector>
|
|
#include <string>
|
|
|
|
enum class TokenType {
|
|
COMMA, // ,
|
|
SEMI, // ;
|
|
LB, // {
|
|
RB, // }
|
|
LP, // (
|
|
RP, // )
|
|
LT, // <
|
|
RT, // >
|
|
ASSIGN, // =
|
|
DOT, // .
|
|
COLON, // :
|
|
SCOPE, // ::
|
|
IMPLY, // ->
|
|
STRUCT, // struct
|
|
FN, // Fn
|
|
RETURN, // return
|
|
TYPEOF, // typeof
|
|
PUBLIC, // public
|
|
ID, // identifier
|
|
EXCEED
|
|
};
|
|
|
|
std::string token_mp[] = {",",
|
|
";",
|
|
"{",
|
|
"}",
|
|
"(",
|
|
")",
|
|
"<",
|
|
">",
|
|
"=",
|
|
".",
|
|
":",
|
|
"::",
|
|
"->",
|
|
"struct",
|
|
"Fn",
|
|
"return",
|
|
"typeof",
|
|
"public",
|
|
"ID"};
|
|
|
|
struct Token {
|
|
int line;
|
|
TokenType type;
|
|
std::string s;
|
|
};
|
|
|
|
#endif |