Lex a decimal exponent, if present.
(lex-?-exponent-part parstate) → (mv erp expo? last/next-pos new-parstate)
If an exponent is found,
the
If there is no next character, there is no exponent.
If the next character is not
Function:
(defun lex-?-exponent-part (parstate) (declare (xargs :stobjs (parstate))) (declare (xargs :guard (parstatep parstate))) (let ((__function__ 'lex-?-exponent-part)) (declare (ignorable __function__)) (b* (((reterr) nil (irr-position) parstate) ((erp char pos parstate) (read-char parstate))) (cond ((not char) (retok nil pos parstate)) ((or (utf8-= char (char-code #\e)) (utf8-= char (char-code #\E))) (b* ((prefix (if (utf8-= char (char-code #\e)) (dexprefix-locase-e) (dexprefix-upcase-e))) ((erp sign? sign-pos parstate) (lex-?-sign parstate)) (pos-so-far (if sign? sign-pos pos)) ((erp digits last-pos & parstate) (lex-*-digit pos-so-far parstate)) ((unless digits) (b* ((parstate (if sign? (unread-char parstate) parstate)) (parstate (unread-char parstate))) (retok nil pos parstate)))) (retok (make-dexpo :prefix prefix :sign? sign? :digits digits) last-pos parstate))) (t (b* ((parstate (unread-char parstate))) (retok nil pos parstate)))))))
Theorem:
(defthm dexpo-optionp-of-lex-?-exponent-part.expo? (b* (((mv acl2::?erp ?expo? ?last/next-pos ?new-parstate) (lex-?-exponent-part parstate))) (dexpo-optionp expo?)) :rule-classes :rewrite)
Theorem:
(defthm positionp-of-lex-?-exponent-part.last/next-pos (b* (((mv acl2::?erp ?expo? ?last/next-pos ?new-parstate) (lex-?-exponent-part parstate))) (positionp last/next-pos)) :rule-classes :rewrite)
Theorem:
(defthm parstatep-of-lex-?-exponent-part.new-parstate (implies (parstatep parstate) (b* (((mv acl2::?erp ?expo? ?last/next-pos ?new-parstate) (lex-?-exponent-part parstate))) (parstatep new-parstate))) :rule-classes :rewrite)
Theorem:
(defthm parsize-of-lex-?-exponent-part-uncond (b* (((mv acl2::?erp ?expo? ?last/next-pos ?new-parstate) (lex-?-exponent-part parstate))) (<= (parsize new-parstate) (parsize parstate))) :rule-classes :linear)
Theorem:
(defthm parsize-of-lex-?-exponent-part-cond (b* (((mv acl2::?erp ?expo? ?last/next-pos ?new-parstate) (lex-?-exponent-part parstate))) (implies (and (not erp) expo?) (<= (parsize new-parstate) (1- (parsize parstate))))) :rule-classes :linear)