diff options
-rw-r--r-- | argot.lisp | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -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)) |