-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlex_process.c
More file actions
31 lines (27 loc) · 812 Bytes
/
lex_process.c
File metadata and controls
31 lines (27 loc) · 812 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
#include "compiler.h"
#include "helpers/vector.h"
#include <stdlib.h>
struct lex_process* lex_process_create(struct compile_process* compiler, struct lex_process_functions* functions, void* private)
{
struct lex_process* process = calloc(1, sizeof(struct lex_process));
process->function = functions;
process->token_vec = vector_create(sizeof(struct token));
process->compiler = compiler;
process->private = private;
process->pos.line = 1;
process->pos.col = 1;
return process;
}
void lex_process_free(struct lex_process* process)
{
vector_free(process->token_vec);
free(process);
}
void* lex_process_private(struct lex_process* process)
{
return process->private;
}
struct vector* lex_process_tokens(struct lex_process* process)
{
return process->token_vec;
}