Lex a floating suffix, if present.
(lex-fsuffix-if-present parstate) → (mv erp fsuffix? last/next-pos new-parstate)
If a suffix is found, the
If there is no next character, there is no suffix. Otherwise, there are four possibilities for suffixes. If the next character is not part of any suffix, we unread the character and return no suffix.
Function:
(defun lex-fsuffix-if-present (parstate) (declare (xargs :stobjs (parstate))) (declare (xargs :guard (parstatep parstate))) (let ((__function__ 'lex-fsuffix-if-present)) (declare (ignorable __function__)) (b* (((reterr) nil (irr-position) parstate) ((erp char pos parstate) (read-char parstate))) (cond ((not char) (retok nil pos parstate)) ((= char (char-code #\f)) (retok (fsuffix-locase-f) pos parstate)) ((= char (char-code #\F)) (retok (fsuffix-upcase-f) pos parstate)) ((= char (char-code #\l)) (retok (fsuffix-locase-l) pos parstate)) ((= char (char-code #\L)) (retok (fsuffix-upcase-l) pos parstate)) (t (b* ((parstate (unread-char parstate))) (retok nil pos parstate)))))))
Theorem:
(defthm fsuffix-optionp-of-lex-fsuffix-if-present.fsuffix? (b* (((mv acl2::?erp ?fsuffix? ?last/next-pos ?new-parstate) (lex-fsuffix-if-present parstate))) (fsuffix-optionp fsuffix?)) :rule-classes :rewrite)
Theorem:
(defthm positionp-of-lex-fsuffix-if-present.last/next-pos (b* (((mv acl2::?erp ?fsuffix? ?last/next-pos ?new-parstate) (lex-fsuffix-if-present parstate))) (positionp last/next-pos)) :rule-classes :rewrite)
Theorem:
(defthm parstatep-of-lex-fsuffix-if-present.new-parstate (implies (parstatep parstate) (b* (((mv acl2::?erp ?fsuffix? ?last/next-pos ?new-parstate) (lex-fsuffix-if-present parstate))) (parstatep new-parstate))) :rule-classes :rewrite)
Theorem:
(defthm parsize-of-lex-fsuffix-if-present-uncond (b* (((mv acl2::?erp ?fsuffix? ?last/next-pos ?new-parstate) (lex-fsuffix-if-present parstate))) (<= (parsize new-parstate) (parsize parstate))) :rule-classes :linear)
Theorem:
(defthm parsize-of-lex-fsuffix-if-present-cond (b* (((mv acl2::?erp ?fsuffix? ?last/next-pos ?new-parstate) (lex-fsuffix-if-present parstate))) (implies (and (not erp) fsuffix?) (<= (parsize new-parstate) (1- (parsize parstate))))) :rule-classes :linear)