Fix negative index for start of parser

This commit is contained in:
Florian Schroedl
2022-01-20 17:00:00 +01:00
parent d4f4a8a4d7
commit 96bf7fe263

View File

@@ -75,7 +75,7 @@ proc `$`*(x: ParserError): string =
of charMismatchErr(expected: @expected, parser: @parser, index: @index, unexpected: @unexpected):
# TODO: Only works for single line right now
let original = parser.state.stream
let errSpace = " ".repeat(index - 1)
let errSpace = " ".repeat(max(0, index))
&"""Parsing Error (Character Mismatch Error):
{original}