(cst2ast-escape-sequence tree) → element
Function:
(defun cst2ast-escape-sequence (tree) (declare (xargs :guard (abnf::treep tree))) (let ((__function__ 'cst2ast-escape-sequence)) (declare (ignorable __function__)) (b* (((unless (and (abnf::treep tree) (abnf::tree-case tree :nonleaf) (equal (abnf::tree-nonleaf->rulename? tree) (abnf::rulename "escape-sequence")))) (reserrf "unexpected input to cst2ast-escape-sequence")) ((unless (and (equal (len (abnf::tree-nonleaf->branches tree)) 2) (equal (car (abnf::tree-nonleaf->branches tree)) *list-leafterm-92*))) (reserrf "unexpected input to cst2ast-escape-sequence 2")) (second-branch (cadr (abnf::tree-nonleaf->branches tree))) ((unless (and (abnf::tree-listp second-branch) (equal (len second-branch) 1))) (reserrf "unexpected input to cst2ast-escape-sequence 3")) (subtree (car second-branch)) ((unless (and (abnf::treep subtree) (abnf::tree-case subtree :nonleaf) (null (abnf::tree-nonleaf->rulename? subtree)))) (reserrf "unexpected input to cst2ast-escape-sequence 4")) (escape-sequence-contents (abnf::tree-nonleaf->branches subtree)) ((unless (abnf::tree-list-listp escape-sequence-contents)) (reserrf "unexpected input to cst2ast-escape-sequence 5")) (yul-escape-or-err (cond ((= (length escape-sequence-contents) 1) (cst2ast-single-char (car escape-sequence-contents))) ((and (= (length escape-sequence-contents) 2) (equal (first escape-sequence-contents) *list-leafterm-u*)) (cst2ast-uhhhh (second escape-sequence-contents))) ((and (= (length escape-sequence-contents) 2) (equal (first escape-sequence-contents) *list-leafterm-x*)) (cst2ast-xhh (second escape-sequence-contents))) (t (reserrf "unexpected input to cst2ast-escape-sequence 6")))) ((when (reserrp yul-escape-or-err)) yul-escape-or-err)) (make-string-element-escape :get yul-escape-or-err))))
Theorem:
(defthm string-element-resultp-of-cst2ast-escape-sequence (b* ((element (cst2ast-escape-sequence tree))) (string-element-resultp element)) :rule-classes :rewrite)