From 1af10ddc10e35805c6723d7a2a85d7e3768497f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Manuel=20Tom=C3=A1s?= Date: Sun, 13 Oct 2024 00:51:57 -0300 Subject: Error out on parser failure --- main.lisp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'main.lisp') diff --git a/main.lisp b/main.lisp index 6357cc4..0d890a0 100644 --- a/main.lisp +++ b/main.lisp @@ -8,4 +8,8 @@ (if (parsing-p result) (let ((finished? (not (has-data? (parsing-left result))))) (values (parsing-tree result) finished?)) - result))) + (error (format nil "~a" result))))) + +(defmethod print-object ((obj failure) stream) + (multiple-value-bind (line column) (line-and-column (failure-place obj)) + (format stream "~a:~a: ~a" line column (failure-message obj)))) -- cgit v1.2.3