-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtokentype.py
More file actions
72 lines (65 loc) · 1.08 KB
/
Copy pathtokentype.py
File metadata and controls
72 lines (65 loc) · 1.08 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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from enum import Enum, unique
@unique
class TokenType(Enum):
# Single-character tokens
LEFT_PAREN = 1
RIGHT_PAREN = 2
LEFT_BRACE = 3
RIGHT_BRACE = 4
LEFT_BRACKET = 38
RIGHT_BRACKET = 39
COMMA = 5
DOT = 6
MINUS = 7
PLUS = 8
SEMICOLON = 9
COLON = 37
SLASH = 10
STAR = 11
PYCALL = 41
NEWLINE = 42
INDENT = 44
DEDENT = 45
LAMBDA = 49
HAT = 56
# One or two character tokens
BANG = 12
BANG_EQUAL = 13
EQUAL = 14
ASSIGNMENT = 15
GREATER = 16
GREATER_EQUAL = 17
LESS = 18
LESS_EQUAL = 19
ELLIPSIS = 48
PLUSPLUS = 54
MINUSMINUS = 55
# Literals
IDENTIFIER = 20
STRING = 21
INT = 22
FLOAT = 53
# Keywords
AND = 23
ELSE = 24
FALSE = 25
FUN = 26
FOR = 27
IF = 28
NONE = 29
OR = 30
PRINT = 31
RETURN = 32
TRUE = 33
MUT = 34
WHILE = 35
IN = 36
ENSURE = 40
VAR = 43
BREAK = 46
CONTINUE = 47
CLASS = 51
UNSTABLE = 52
EOF = 50