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
|
#include "errloc.h"
#include "lex.h"
#include <stdarg.h>
#include <stdio.h>
void errcloc(const struct lex *l, const char *fmt, ...)
{
const struct loc *loc = &l->loc;
va_list ap;
va_start(ap, fmt);
fprintf(stderr, "%s:%d:%d: error: ", l->loc.f, loc->line, loc->col);
vfprintf(stderr, fmt, ap);
fputc('\n', stderr);
va_end(ap);
}
void errloc(const struct tk *tk, const char *fmt, ...)
{
const struct loc *loc = &tk->loc;
va_list ap;
va_start(ap, fmt);
fprintf(stderr, "%s:%d:%d: error: ", loc->f, loc->line, loc->col);
vfprintf(stderr, fmt, ap);
fputc('\n', stderr);
va_end(ap);
}
|