-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtokens.cpp
More file actions
61 lines (60 loc) · 1.45 KB
/
tokens.cpp
File metadata and controls
61 lines (60 loc) · 1.45 KB
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
//
// Created by zvukm on 10.10.2019.
//
#include "tokens.h"
std::string convertTokenToString(int type) {
switch (type) {
case Class:
return "class";
case Extends:
return "extends";
case Is:
return "is";
case End:
return "end";
case Var:
return "var";
case Method:
return "method";
case This:
return "this";
case While:
return "while";
case Loop:
return "loop";
case If:
return "if";
case Then:
return "then";
case Else:
return "else";
case Return:
return "return";
case LeftRoundBracket:
return "(";
case RightRoundBracket:
return ")";
case LeftRectBracket:
return "[";
case RightRectBracket:
return "]";
case Dot:
return ".";
case Comma:
return ",";
case Colon:
return ":";
case Assignment:
return ":=";
case BooleanLiteral:
return "booleanLiteral";
case IntegerLiteral:
return "integerLiteral";
case RealLiteral:
return "realLiteral";
case Identifier:
return "identifier";
default:
return "";
}
}