aboutsummaryrefslogtreecommitdiff
path: root/src/check.c
blob: f6a857668dfdc713fd04118b929b76377ed0cfd5 (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
#define _POSIX_C_SOURCE 200809L

#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdnoreturn.h>
#include "lex.h"
#include "parse.h"
#include "util.h"

static noreturn void
error(struct location loc, const char *fmt, ...)
{
	fprintf(stderr, "%s:%d:%d ", loc.file, loc.line, loc.column);

	va_list ap;
	va_start(ap, fmt);
	vfprintf(stderr, fmt, ap);
	va_end(ap);

	fprintf(stderr, "\n");
	exit(EXIT_CHECK);
}

static void
check_imports(struct ast_import *imports, int n)
{
	/* TODO */
}

static void
check_toplevels(struct ast_toplevel *tops, int n)
{
	/* TODO */
}

void
check(struct ast_unit *ast)
{
	check_imports(ast->imports, ast->implen);
	check_toplevels(ast->tops, ast->toplen);
}