Parse an
(parse-pfcs-integer token input) → (mv tree next-token rest-input)
This is used for recognizing tokesn nonnegative (no sign) and negative (signed) unlimited-size integers.
Function:
(defun parse-pfcs-integer (token input) (declare (xargs :guard (and (abnf::tree-optionp token) (abnf::tree-listp input)))) (let ((__function__ 'parse-pfcs-integer)) (declare (ignorable __function__)) (b* ((tree (check-token-root "integer" token)) ((when (reserrp tree)) (perr (reserrf-push tree))) ((mv token input) (parse-token input))) (mv tree token input))))
Theorem:
(defthm tree-resultp-of-parse-pfcs-integer.tree (b* (((mv ?tree ?next-token ?rest-input) (parse-pfcs-integer token input))) (abnf::tree-resultp tree)) :rule-classes :rewrite)
Theorem:
(defthm tree-optionp-of-parse-pfcs-integer.next-token (b* (((mv ?tree ?next-token ?rest-input) (parse-pfcs-integer token input))) (abnf::tree-optionp next-token)) :rule-classes :rewrite)
Theorem:
(defthm tree-listp-of-parse-pfcs-integer.rest-input (b* (((mv ?tree ?next-token ?rest-input) (parse-pfcs-integer token input))) (abnf::tree-listp rest-input)) :rule-classes :rewrite)
Theorem:
(defthm parsize-of-parse-integer-<= (b* (((mv ?tree ?next-token ?rest-input) (parse-pfcs-integer token input))) (<= (parsize next-token rest-input) (parsize token input))) :rule-classes :linear)
Theorem:
(defthm parsize-of-integer-literal-< (b* (((mv ?tree ?next-token ?rest-input) (parse-pfcs-integer token input))) (implies (not (reserrp tree)) (< (parsize next-token rest-input) (parsize token input)))) :rule-classes :linear)
Theorem:
(defthm parse-pfcs-integer-of-tree-option-fix-token (equal (parse-pfcs-integer (abnf::tree-option-fix token) input) (parse-pfcs-integer token input)))
Theorem:
(defthm parse-pfcs-integer-tree-option-equiv-congruence-on-token (implies (abnf::tree-option-equiv token token-equiv) (equal (parse-pfcs-integer token input) (parse-pfcs-integer token-equiv input))) :rule-classes :congruence)
Theorem:
(defthm parse-pfcs-integer-of-tree-list-fix-input (equal (parse-pfcs-integer token (abnf::tree-list-fix input)) (parse-pfcs-integer token input)))
Theorem:
(defthm parse-pfcs-integer-tree-list-equiv-congruence-on-input (implies (abnf::tree-list-equiv input input-equiv) (equal (parse-pfcs-integer token input) (parse-pfcs-integer token input-equiv))) :rule-classes :congruence)