summaryrefslogtreecommitdiff
path: root/parse.c
blob: b1b5c9344e4c4c464bd017ab384e1bc35619d613 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#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 at %u:%u\n",
			        token_type_str(tok->type),
			        tok->line, tok->column);
			return 1;
		}
		tok += 1;
	}
	return 0;
}