summaryrefslogtreecommitdiff
path: root/main.lisp
diff options
context:
space:
mode:
authorJuan Manuel Tomás <jtomas1815@gmail.com>2024-10-13 00:51:57 -0300
committerJuan Manuel Tomás <jtomas1815@gmail.com>2024-10-13 00:51:57 -0300
commit1af10ddc10e35805c6723d7a2a85d7e3768497f8 (patch)
tree10cb209d714c339b1bc99c900eca98424ef31c11 /main.lisp
parent7a6f4586c2e83ffcdb5a8b7b2c5591f6e80e038f (diff)
downloadmonparser-1af10ddc10e35805c6723d7a2a85d7e3768497f8.tar.gz
monparser-1af10ddc10e35805c6723d7a2a85d7e3768497f8.zip
Error out on parser failure
Diffstat (limited to 'main.lisp')
-rw-r--r--main.lisp6
1 files changed, 5 insertions, 1 deletions
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))))