-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtokens.py
More file actions
83 lines (67 loc) · 1.14 KB
/
Copy pathtokens.py
File metadata and controls
83 lines (67 loc) · 1.14 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
from enum import Enum
#List of tokens
class TokenType(Enum):
LPAREN = 1
RPAREN = 2
COL = 3
SEMICOL = 4
LCBRACK = 5
RCBRACK = 6
LBRACK = 7
RBRACK = 8
COMMA = 9
PLUS = 10
MINUS = 11
STAR = 12
SLASH = 13
MODULO = 14
DOT = 15
NEWLINE = 16
QUOTE = 17
ASMT = 18
PARAMS = 19
NEQUAL = 20
EQUAL = 21
GT = 22
LT = 23
GT_EQUAL = 24
LT_EQUAL = 25
NOT = 26
AND = 27
OR = 28
ID = 29
VAR = 30
STRING = 31
NUMBER = 32
FLOAT = 33
HASH = 34
GET = 35
SET = 36
DO = 37
CALL = 38
RUN = 39
IF = 40
ELIF = 41
ELSE = 42
FOR = 43
WHILE = 44
IN = 45
APL = 46
TRUE = 47
FALSE = 48
INPUT = 49
EOF = 50
ERROR = 51
ARROW = 52
COMMENT = 53
class Token():
def __init__(self, type, lexeme, line : int):
self.lexeme = lexeme
self.line = line
self.type = type
def get_lexeme(self):
return self.lexeme
def get_type(self):
return self.type
def get_line(self) -> int:
return self.line