Lex an integer or floating constant.
(lex-iconst/fconst first-digit first-pos parstate) → (mv erp const last-pos new-parstate)
This is called when we expect an integer or floating constant, after reading the first (decimal) digit of the constant. The first digit and its position are passed to this function.
If the first digit is a
If instead the first digit is
Function:
(defun lex-iconst/fconst (first-digit first-pos parstate) (declare (xargs :stobjs (parstate))) (declare (xargs :guard (and (dec-digit-char-p first-digit) (positionp first-pos) (parstatep parstate)))) (let ((__function__ 'lex-iconst/fconst)) (declare (ignorable __function__)) (b* (((reterr) (irr-const) (irr-position) parstate)) (cond ((eql first-digit #\0) (b* (((erp char pos parstate) (read-char parstate))) (cond ((not char) (retok (const-int (make-iconst :core (make-dec/oct/hex-const-oct :leading-zeros 1 :value 0) :suffix? nil)) (position-fix first-pos) parstate)) ((or (= char (char-code #\x)) (= char (char-code #\X))) (b* ((hprefix (if (= char (char-code #\x)) (hprefix-locase-0x) (hprefix-upcase-0x)))) (lex-hex-iconst/fconst hprefix pos parstate))) (t (b* ((parstate (unread-char parstate))) (lex-oct-iconst-/-dec-fconst first-pos parstate)))))) (t (lex-dec-iconst/fconst first-digit first-pos parstate))))))
Theorem:
(defthm constp-of-lex-iconst/fconst.const (b* (((mv acl2::?erp ?const ?last-pos ?new-parstate) (lex-iconst/fconst first-digit first-pos parstate))) (constp const)) :rule-classes :rewrite)
Theorem:
(defthm positionp-of-lex-iconst/fconst.last-pos (b* (((mv acl2::?erp ?const ?last-pos ?new-parstate) (lex-iconst/fconst first-digit first-pos parstate))) (positionp last-pos)) :rule-classes :rewrite)
Theorem:
(defthm parstatep-of-lex-iconst/fconst.new-parstate (implies (parstatep parstate) (b* (((mv acl2::?erp ?const ?last-pos ?new-parstate) (lex-iconst/fconst first-digit first-pos parstate))) (parstatep new-parstate))) :rule-classes :rewrite)
Theorem:
(defthm parsize-of-lex-iconst/fconst-uncond (b* (((mv acl2::?erp ?const ?last-pos ?new-parstate) (lex-iconst/fconst first-digit first-pos parstate))) (<= (parsize new-parstate) (parsize parstate))) :rule-classes :linear)