Main loop for reading string literals.
(vl-read-string-aux echars eacc vacc st) → (mv error eacc vacc remainder)
Function:
(defun vl-read-string-aux (echars eacc vacc st) (declare (xargs :guard (and (vl-echarlist-p echars) (vl-lexstate-p st)))) (let ((__function__ 'vl-read-string-aux)) (declare (ignorable __function__)) (b* (((unless (consp echars)) (mv "the file ends before the string is closed." eacc vacc echars)) (echar1 (first echars)) ((the character char1) (vl-echar->char echar1)) ((when (eql char1 #\")) (mv nil (cons echar1 eacc) vacc (rest echars))) ((when (eql char1 #\Newline)) (mv "the line ends before the string is closed." eacc vacc echars)) ((when (eql char1 #\\)) (b* (((mv char prefix remainder) (vl-read-string-escape-sequence echars st)) ((unless prefix) (mv "the string contains an invalid escape sequence." eacc vacc echars)) (eacc (revappend prefix eacc)) (vacc (if char (cons char vacc) vacc))) (vl-read-string-aux remainder eacc vacc st)))) (vl-read-string-aux (cdr echars) (cons echar1 eacc) (cons char1 vacc) st))))
Theorem:
(defthm return-type-of-vl-read-string-aux.error (b* (((mv common-lisp::?error ?eacc ?vacc ?remainder) (vl-read-string-aux echars eacc vacc st))) (equal (stringp error) (if error t nil))) :rule-classes :rewrite)
Theorem:
(defthm vl-echarlist-p-of-vl-read-string-aux.eacc (implies (and (force (vl-echarlist-p echars)) (force (vl-echarlist-p eacc))) (b* (((mv common-lisp::?error ?eacc ?vacc ?remainder) (vl-read-string-aux echars eacc vacc st))) (vl-echarlist-p eacc))) :rule-classes :rewrite)
Theorem:
(defthm character-listp-of-vl-read-string-aux.vacc (implies (and (force (vl-echarlist-p echars)) (force (character-listp vacc))) (b* (((mv common-lisp::?error ?eacc ?vacc ?remainder) (vl-read-string-aux echars eacc vacc st))) (character-listp vacc))) :rule-classes :rewrite)
Theorem:
(defthm vl-echarlist-p-of-vl-read-string-aux.remainder (implies (force (vl-echarlist-p echars)) (b* (((mv common-lisp::?error ?eacc ?vacc ?remainder) (vl-read-string-aux echars eacc vacc st))) (vl-echarlist-p remainder))) :rule-classes :rewrite)
Theorem:
(defthm vl-read-string-aux-of-nil (implies (atom echars) (mv-nth 0 (vl-read-string-aux echars eacc vacc st))))
Theorem:
(defthm true-listp-of-vl-read-string-aux.eacc (equal (true-listp (mv-nth 1 (vl-read-string-aux echars eacc vacc st))) (true-listp eacc)))
Theorem:
(defthm true-listp-of-vl-read-string-aux.remainder (equal (true-listp (mv-nth 3 (vl-read-string-aux echars eacc vacc st))) (true-listp echars)))
Theorem:
(defthm revappend-of-vl-read-string-aux (equal (append (rev (mv-nth 1 (vl-read-string-aux echars eacc vacc st))) (mv-nth 3 (vl-read-string-aux echars eacc vacc st))) (append (rev eacc) echars)))
Theorem:
(defthm acl2-count-of-vl-read-string-aux-weak (<= (acl2-count (mv-nth 3 (vl-read-string-aux echars eacc vacc st))) (acl2-count echars)) :rule-classes ((:rewrite) (:linear)))
Theorem:
(defthm acl2-count-of-vl-read-string-aux-strong (implies (not (mv-nth 0 (vl-read-string-aux echars eacc vacc st))) (< (acl2-count (mv-nth 3 (vl-read-string-aux echars eacc vacc st))) (acl2-count echars))) :rule-classes ((:rewrite) (:linear)))