]> mj.ucw.cz Git - moe.git/blobdiff - judge/token.c
Implemented varname as a shorthand for "{varname}"
[moe.git] / judge / token.c
index 795cc084e28f142a86e838f88129ac0746258ac6..85f5069420e96755f2f98e7299f3fa4469055f12 100644 (file)
@@ -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");
+}