anchor.diff:      (handler-case (progn ,@body)
         (,class () (return-from ,name nil)))
       (error "~S didn't signal a ~S" ',body ',class))))
  +
  +;;;; Tests of the low-level interface, which is not meant for human beings.
  +;;;; See the high-level interface below if you are looking for examples.
   
   ;;; A trivial lexer
   
  
positive.code: (in-package #:yacc-tests)
  
  (defmacro expect (form expected)
    (let ((value (gensym "VALUE")))
      `(let ((,value ,form))
        (unless (equal ,value ,expected)
          (error "Test failed: ~S yielded ~S, expected ~S"
                 ',form ,value ,expected)))))
  
  (defmacro expect-condition (class &body body)
    (let ((name (gensym "EXPECT-CONDITION")))
  
negative.code:           (expect (parse *precedence-left-expression-parser* e) v))
          (let ((v '("x" + ((5 / (3 * ((12 + "y") / 3))) + "z"))))
            (expect (parse *precedence-right-expression-parser* e) v))
          (let ((v '("x" + (5 / (3 * ((12 + "y") / (3 + "z")))))))
            (expect (parse *ambiguous-expression-parser* e) v))
          (expect-condition yacc-parse-error
            (parse *precedence-nonassoc-expression-parser* e)))
        (dolist (e '("5/3*(" "5/3)"))
          (expect-condition yacc-parse-error
            (parse *left-expression-parser* e))
          (expect-condition yacc-parse-error
            (parse *ambiguous-expression-parser* e))
          (expect-condition yacc-parse-error
            (parse *precedence-left-expression-parser* e))
          (expect-condition yacc-parse-error
  