X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=judge%2Ftoken.c;h=85f5069420e96755f2f98e7299f3fa4469055f12;hb=cb57be02c9d15064992acd7ff4f87e9dd1487240;hp=795cc084e28f142a86e838f88129ac0746258ac6;hpb=33d084bcbc844c5ab96d73197b64cfc7f6261c3e;p=eval.git diff --git a/judge/token.c b/judge/token.c index 795cc08..85f5069 100644 --- a/judge/token.c +++ b/judge/token.c @@ -34,9 +34,9 @@ void tok_err(struct tokenizer *t, char *msg, ...) { va_list args; va_start(args, msg); - printf("%s:%d: ", t->stream->name, t->line); - vprintf(msg, args); - putchar('\n'); + fprintf(stderr, "Error at %s line %d:\n", t->stream->name, t->line); + vfprintf(stderr, msg, args); + fputc('\n', stderr); va_end(args); exit(1); } @@ -163,3 +163,10 @@ GET(long, long int) GET(ulong, unsigned long int) GET(double, double) GET(long_double, long double) + +void get_nl(struct tokenizer *t) +{ + char *tok = get_token(t); + if (tok && *tok) + tok_err(t, "Expected end of line"); +}