-
Notifications
You must be signed in to change notification settings - Fork 2
/
token.cpp
75 lines (74 loc) · 2.18 KB
/
token.cpp
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#include "token.h"
std::string Token::getKindName() const
{
switch (kind)
{
default:
case TokenKind::unknown:
return "unknown";
case TokenKind::s_comment:
return "s_comment";
case TokenKind::lm_comment:
return "lm_comment";
case TokenKind::rm_comment:
return "rm_comment";
case TokenKind::identifier:
return "identifier";
case TokenKind::numeric_constant:
return "numeric_constant";
case TokenKind::eof:
return "eof";
case TokenKind::l_paren:
return "l_paren";
case TokenKind::r_paren:
return "r_paren";
case TokenKind::l_brace:
return "l_brace";
case TokenKind::r_brace:
return "r_brace";
case TokenKind::star:
return "tar";
case TokenKind::plus:
return "plus";
case TokenKind::minus:
return "minus";
case TokenKind::minusequal:
return "minuesequal";
case TokenKind::exclaimequal:
return "exclaimequal";
case TokenKind::slash:
return "lash";
case TokenKind::less:
return "less";
case TokenKind::lessless:
return "lessless";
case TokenKind::lessequal:
return "lessequal";
case TokenKind::greater:
return "greater";
case TokenKind::greatergreater:
return "greatergreater";
case TokenKind::greaterequal:
return "greaterequal";
case TokenKind::semi:
return "semi";
case TokenKind::equal:
return "equal";
case TokenKind::equalequal:
return "equalequal";
case TokenKind::comma:
return "comma";
case TokenKind::kw_else:
return "kw_else";
case TokenKind::kw_if:
return "kw_if";
case TokenKind::kw_int:
return "kw_int";
case TokenKind::kw_return:
return "kw_return";
case TokenKind::kw_void:
return "kw_void";
case TokenKind::kw_while:
return "kw_while";
}
}