diff --git a/compiler/source.py b/compiler/source.py index 4b85a5f..8a90bc2 100644 --- a/compiler/source.py +++ b/compiler/source.py @@ -126,7 +126,7 @@ class SourceLocation: def show_in_source(self) -> str: source = self.source.splitlines(keepends=False) - line_number_maxlen = int(math.log10(len(source)) + 1) + line_number_maxlen = 1 if not len(source) else int(math.log10(len(source)) + 1) lines = source[self.begin.line:self.end.line + 1] result = [] begin_char = self.begin.character