-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtoken.h
More file actions
78 lines (69 loc) · 1.16 KB
/
Copy pathtoken.h
File metadata and controls
78 lines (69 loc) · 1.16 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
#ifndef TOKEN_H
#define TOKEN_H
#define MAX_INDENTS 256
#define TAB_WIDTH 4
typedef enum {
TOKEN_EOF,
TOKEN_ERROR,
TOKEN_NEWLINE,
TOKEN_INDENT,
TOKEN_DEDENT,
TOKEN_IDENTIFIER,
TOKEN_NUMBER,
TOKEN_STRING,
TOKEN_LPAREN,
TOKEN_RPAREN,
TOKEN_LBRACKET,
TOKEN_RBRACKET,
TOKEN_LBRACE,
TOKEN_RBRACE,
TOKEN_COMMA,
TOKEN_DOT,
TOKEN_COLON,
TOKEN_PLUS,
TOKEN_MINUS,
TOKEN_STAR,
TOKEN_SLASH,
TOKEN_PERCENT,
TOKEN_EQUAL,
TOKEN_EQUAL_EQUAL,
TOKEN_NOT_EQUAL,
TOKEN_LESS,
TOKEN_LESS_EQUAL,
TOKEN_GREATER,
TOKEN_GREATER_EQUAL,
TOKEN_IF,
TOKEN_ELIF,
TOKEN_ELSE,
TOKEN_WHILE,
TOKEN_FOR,
TOKEN_IN,
TOKEN_DEF,
TOKEN_CLASS,
TOKEN_RETURN,
TOKEN_TRUE,
TOKEN_FALSE,
TOKEN_NONE,
TOKEN_AND,
TOKEN_OR,
TOKEN_NOT,
TOKEN_PASS,
TOKEN_BREAK,
TOKEN_CONTINUE,
TOKEN_IMPORT,
TOKEN_AS,
} TokenType;
typedef struct {
TokenType type;
const char* start;
int length;
int line;
int column;
int offset;
} Token;
typedef struct {
Token* data;
int count;
int capacity;
} TokenArray;
#endif