Parse a specified
(parse-symbol symbol token input) → (mv tree next-token rest-input)
This is used to check the presence of an expected symbol.
For more details see parse-symbol-among.
Function:
(defun parse-symbol (symbol token input) (declare (xargs :guard (and (stringp symbol) (abnf::tree-optionp token) (abnf::tree-listp input)))) (declare (xargs :guard (member-equal symbol *symbols*))) (let ((__function__ 'parse-symbol)) (declare (ignorable __function__)) (parse-symbol-among (list symbol) token input)))
Theorem:
(defthm tree-resultp-of-parse-symbol.tree (b* (((mv ?tree ?next-token ?rest-input) (parse-symbol symbol token input))) (abnf::tree-resultp tree)) :rule-classes :rewrite)
Theorem:
(defthm tree-optionp-of-parse-symbol.next-token (b* (((mv ?tree ?next-token ?rest-input) (parse-symbol symbol token input))) (abnf::tree-optionp next-token)) :rule-classes :rewrite)
Theorem:
(defthm tree-listp-of-parse-symbol.rest-input (b* (((mv ?tree ?next-token ?rest-input) (parse-symbol symbol token input))) (abnf::tree-listp rest-input)) :rule-classes :rewrite)
Theorem:
(defthm parsize-of-parse-symbol-<= (b* (((mv ?tree ?next-token ?rest-input) (parse-symbol symbol token input))) (<= (parsize next-token rest-input) (parsize token input))) :rule-classes :linear)
Theorem:
(defthm parsize-of-parse-symbol-< (b* (((mv ?tree ?next-token ?rest-input) (parse-symbol symbol token input))) (implies (not (reserrp tree)) (< (parsize next-token rest-input) (parsize token input)))) :rule-classes :linear)
Theorem:
(defthm len-of-parse-symbol-<= (b* (((mv ?tree ?next-token ?rest-input) (parse-symbol symbol token input))) (<= (len rest-input) (len input))) :rule-classes :linear)
Theorem:
(defthm len-of-parse-symbol-< (b* (((mv ?tree ?next-token ?rest-input) (parse-symbol symbol token input))) (implies (and (not (reserrp tree)) next-token) (< (len rest-input) (len input)))) :rule-classes :linear)
Theorem:
(defthm parse-symbol-of-str-fix-symbol (equal (parse-symbol (str-fix symbol) token input) (parse-symbol symbol token input)))
Theorem:
(defthm parse-symbol-streqv-congruence-on-symbol (implies (acl2::streqv symbol symbol-equiv) (equal (parse-symbol symbol token input) (parse-symbol symbol-equiv token input))) :rule-classes :congruence)
Theorem:
(defthm parse-symbol-of-tree-option-fix-token (equal (parse-symbol symbol (abnf::tree-option-fix token) input) (parse-symbol symbol token input)))
Theorem:
(defthm parse-symbol-tree-option-equiv-congruence-on-token (implies (abnf::tree-option-equiv token token-equiv) (equal (parse-symbol symbol token input) (parse-symbol symbol token-equiv input))) :rule-classes :congruence)
Theorem:
(defthm parse-symbol-of-tree-list-fix-input (equal (parse-symbol symbol token (abnf::tree-list-fix input)) (parse-symbol symbol token input)))
Theorem:
(defthm parse-symbol-tree-list-equiv-congruence-on-input (implies (abnf::tree-list-equiv input input-equiv) (equal (parse-symbol symbol token input) (parse-symbol symbol token input-equiv))) :rule-classes :congruence)