blob: 609e8a62a34df46da0a4cd0e734ac3c972f0cda9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
#include "parse.h"
#include <stdio.h>
int parse(const Token *tok)
{
while (tok->type != TOK_NONE) {
switch (tok->type) {
case TOK_KW_FN:
case TOK_KW_VAR:
case TOK_KW_CONST:
break;
default:
fprintf(stderr, "unexpected %s %s%s%sat %u:%u\n",
token_type_str(tok->type),
(tok->s != NULL) ? "(" : "",
(tok->s != NULL) ? tok->s : "",
(tok->s != NULL) ? ") " : "",
tok->line, tok->column);
return 1;
}
tok += 1;
}
return 0;
}
|