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

#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdnoreturn.h>
#include <string.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_toplevels(struct ast_toplevel *tops, int n)
{
	/* TODO */
}

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