blob: 75ee98ffc3c4a5319262d9a439423158b59af3b5 (
plain) (
blame)
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
|
#include <stdio.h>
#include <stdlib.h>
#include "include/util.h"
#include "include/token.h"
#include "include/lexer.h"
#include "include/source.h"
#include "include/hlkt.h"
int main(int argc, char* argv[]) {
char* source;
lexer_t* lexer;
int in_file;
source = source_get(argv[1]);
lexer = lexer_init(source);
HLKT_ASS(lexer);
log_inf("lexer created");
log_inf("BEGIN INPUT");
log_raw(lexer->content);
log_inf("END INPUT");
in_file = 1;
while (in_file) {
token_t* token;
char* type;
token = lexer_get_next_token(lexer);
type = token_get_type(token->type);
log_inf("token type: [%s]\t\ttoken value: [%s]", type, token->value);
(token->type == TOKEN_EOF) && (in_file = 0);
token_destroy(token);
}
// clean up
lexer_destroy(lexer);
free(source);
HLKT_LOG();
return 0;
}
|