-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlexer.h
More file actions
44 lines (36 loc) · 702 Bytes
/
lexer.h
File metadata and controls
44 lines (36 loc) · 702 Bytes
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
#ifndef LISA_LEXER_H
#define LISA_LEXER_H
typedef enum {
TOKEN_LPAREN,
TOKEN_RPAREN,
TOKEN_LBRACKET,
TOKEN_RBRACKET,
TOKEN_NUMBER,
TOKEN_DOUBLE,
TOKEN_STRING,
TOKEN_SYMBOL,
TOKEN_TRUE,
TOKEN_FALSE,
TOKEN_NIL,
TOKEN_DEF,
TOKEN_FN,
TOKEN_LET,
TOKEN_IF,
TOKEN_DO,
TOKEN_ERROR,
TOKEN_EOF,
} lisa_token_type;
typedef struct {
lisa_token_type type;
const char *start;
int length;
int line;
} lisa_token;
typedef struct {
const char *start;
const char *current;
int line;
} lisa_lexer;
void lisa_lexer_init(lisa_lexer *lexer, const char *source);
lisa_token lisa_lexer_next(lisa_lexer *lexer);
#endif