Given a :nonleaf tree with rulename "string-literal", return the appropriate literal AST node.
(cst2ast-string-literal tree) → ast-node?
Function:
(defun cst2ast-string-literal (tree) (declare (xargs :guard (abnf::treep tree))) (let ((__function__ 'cst2ast-string-literal)) (declare (ignorable __function__)) (b* (((unless (abnf::tree-case tree :nonleaf)) nil) (branches (abnf::tree-nonleaf->branches tree)) ((unless (and (listp branches) (= (len branches) 3))) nil) ((unless (equal (first branches) (third branches))) nil) (double-quoted (equal (first branches) *double-quote-tree-list*)) ((unless (or double-quoted (equal (first branches) *single-quote-tree-list*))) nil) (content (cst2ast-string-literal-contents (second branches) double-quoted)) ((unless (string-element-listp content)) nil)) (make-literal-plain-string :get (make-plain-string :content content :double-quote-p double-quoted)))))
Theorem:
(defthm literal-optionp-of-cst2ast-string-literal (b* ((ast-node? (cst2ast-string-literal tree))) (literal-optionp ast-node?)) :rule-classes :rewrite)