summaryrefslogtreecommitdiff
path: root/projects/hackc/parser.py
diff options
context:
space:
mode:
Diffstat (limited to 'projects/hackc/parser.py')
-rw-r--r--projects/hackc/parser.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/projects/hackc/parser.py b/projects/hackc/parser.py
index 8375d52..188bddc 100644
--- a/projects/hackc/parser.py
+++ b/projects/hackc/parser.py
@@ -102,3 +102,9 @@ class Parser:
print_err(self.lines[err.token.line_no])
print_err(" " * err.token.column + "^ " + err.message)
exit(EXIT_CODE_SYNTAX_ERROR)
+ except IndexError:
+ last_line = self.lines[-1]
+ print_err(f"{self._fp}:{len(self.lines)}")
+ print_err(last_line)
+ print_err(" " * len(last_line) + "^ Unexpected EOF")
+ exit(EXIT_CODE_EOF)