summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--lib.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib.c b/lib.c
index 2dba05b..bbc60a6 100644
--- a/lib.c
+++ b/lib.c
@@ -199,7 +199,9 @@ ut_parse_error(struct ut_state *s, uint32_t off, uint64_t *tokens, int max_token
}
}
- rv = ut_new_exception(s, op->off, "Syntax error: Unexpected token\n%s", msg);
+ rv = ut_new_exception(s,
+ op ? op->off : s->lex.lastoff,
+ "Syntax error: Unexpected token\n%s", msg);
free(msg);
return rv;