aboutsummaryrefslogtreecommitdiff
path: root/argot.lisp
diff options
context:
space:
mode:
Diffstat (limited to 'argot.lisp')
-rw-r--r--argot.lisp7
1 files changed, 5 insertions, 2 deletions
diff --git a/argot.lisp b/argot.lisp
index c2b3556..ec5f9b8 100644
--- a/argot.lisp
+++ b/argot.lisp
@@ -19,7 +19,9 @@
:initform "")))
(define-condition invalid-rule-def (error)
- ((rule :reader rule :initarg :rule)))
+ ((rule :reader rule :initarg :rule))
+ (:report (lambda (e stream)
+ (format stream "The rule ~s is malformed." (car (rule e))))))
(defun include-rule (grammar rule)
(setf (gethash (rule-lhs rule) (grammar-rules grammar)) rule))
@@ -140,7 +142,8 @@ and it returns VAR in that case."
:start-rule ',(first (first ruledefs))))
,@(loop
:for ruledef :in ruledefs
- :for (lhs pattern vars check action) := (parse-rule-def ruledef)
+ :for (lhs pattern vars check action) := (handler-case (parse-rule-def ruledef)
+ (invalid-rule-def (e) (invoke-debugger e)))
:for bindings := (collect-let-bindings lhs vars)
:collect (rule-includer name lhs pattern check action bindings))