From 07164d51a087533b2379ec6692487520ad5572cc Mon Sep 17 00:00:00 2001 From: John Doty Date: Thu, 6 Jun 2024 17:05:41 -0700 Subject: [PATCH] Fix end of file error reporting --- harness.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/harness.py b/harness.py index 320f534..06426ca 100644 --- a/harness.py +++ b/harness.py @@ -157,8 +157,8 @@ def parse(table: parser.ParseTable, tokens, trace=None) -> typing.Tuple[Tree | N for (kind, start, length) in input_tokens ] - assert "$" not in input - input = input + [TokenValue(kind="$", start=-1, end=-1)] + eof = 0 if len(input) == 0 else input[-1].end + input = input + [TokenValue(kind="$", start=eof, end=eof)] input_index = 0 threads = [