Information about a tree for an error result.
(tree-info-for-error tree) → info
When an ABNF tree does not satisfy certain conditions, it is useful to return some information about the tree in the error result. Since ABNF trees may be large, in general we do not want to put the whole tree into the error result. Instead, we want to put some summary information. This function calculates that information.
Function:
(defun tree-info-for-error (tree) (declare (xargs :guard (abnf::treep tree))) (let ((__function__ 'tree-info-for-error)) (declare (ignorable __function__)) (abnf::tree-case tree :leafterm (list :leafterm tree.get) :leafrule (list :leafrule tree.get) :nonleaf (list :nonleaf tree.rulename? (len tree.branches)))))
Theorem:
(defthm tree-info-for-error-of-tree-fix-tree (equal (tree-info-for-error (abnf::tree-fix tree)) (tree-info-for-error tree)))
Theorem:
(defthm tree-info-for-error-tree-equiv-congruence-on-tree (implies (abnf::tree-equiv tree tree-equiv) (equal (tree-info-for-error tree) (tree-info-for-error tree-equiv))) :rule-classes :congruence)