(parse-charset-set x index) → (mv err char new-index)
Function:
(defun parse-charset-set (x index) (declare (xargs :guard (and (stringp x) (natp index)))) (declare (xargs :guard (<= index (strlen x)))) (let ((__function__ 'parse-charset-set)) (declare (ignorable __function__)) (b* ((x (lstrfix x)) (index (lnfix index)) ((unless (< index (strlen x))) (mv "String ended inside charset" nil index)) (char1 (char x index)) ((unless (eql char1 #\\)) (mv "No match" nil index)) (index (+ 1 index)) ((unless (< index (strlen x))) (mv "String ended inside charset" nil index)) (char2 (char x index)) (index (+ 1 index))) (case char2 (#\w (mv nil (cons #\_ (append (charset-range #\a #\z) (charset-range #\A #\Z) (charset-range #\0 #\9))) index)) (#\d (mv nil (charset-range #\0 #\9) index)) (#\s (mv nil '(#\Space #\Tab #\Newline #\Page #\Return) index)) (#\h (mv nil '(#\Space #\Tab) index)) (#\v (mv nil '(#\Newline #\Page #\Return) index)) (t (mv (str::cat "Unrecognized escape sequence in charset: " (coerce (list char1 char2) 'string)) nil index))))))
Theorem:
(defthm maybe-stringp-of-parse-charset-set.err (b* (((mv ?err common-lisp::?char ?new-index) (parse-charset-set x index))) (acl2::maybe-stringp err)) :rule-classes :type-prescription)
Theorem:
(defthm character-listp-of-parse-charset-set.char (b* (((mv ?err common-lisp::?char ?new-index) (parse-charset-set x index))) (character-listp char)) :rule-classes :rewrite)
Theorem:
(defthm natp-of-parse-charset-set.new-index (b* (((mv ?err common-lisp::?char ?new-index) (parse-charset-set x index))) (natp new-index)) :rule-classes :type-prescription)
Theorem:
(defthm new-index-of-parse-charset-set (b* (((mv ?err common-lisp::?char ?new-index) (parse-charset-set x index))) (<= (nfix index) new-index)) :rule-classes :linear)
Theorem:
(defthm new-index-of-parse-charset-set-strong (b* (((mv ?err common-lisp::?char ?new-index) (parse-charset-set x index))) (implies (not err) (< (nfix index) new-index))) :rule-classes :linear)
Theorem:
(defthm new-index-of-parse-charset-set-less-than-length (b* (((mv ?err common-lisp::?char ?new-index) (parse-charset-set x index))) (implies (<= (nfix index) (len (acl2::explode x))) (<= new-index (len (acl2::explode x))))) :rule-classes :linear)
Theorem:
(defthm parse-charset-set-of-str-fix-x (equal (parse-charset-set (acl2::str-fix x) index) (parse-charset-set x index)))
Theorem:
(defthm parse-charset-set-streqv-congruence-on-x (implies (acl2::streqv x x-equiv) (equal (parse-charset-set x index) (parse-charset-set x-equiv index))) :rule-classes :congruence)
Theorem:
(defthm parse-charset-set-of-nfix-index (equal (parse-charset-set x (nfix index)) (parse-charset-set x index)))
Theorem:
(defthm parse-charset-set-nat-equiv-congruence-on-index (implies (acl2::nat-equiv index index-equiv) (equal (parse-charset-set x index) (parse-charset-set x index-equiv))) :rule-classes :congruence)