Parse an initializer declarator.
(parse-init-declarator parstate) → (mv erp initdeclor span new-parstate)
An initializer declarator consists of a declarator, optionally followed by an equal sign and an initializer.
Function:
(defun parse-init-declarator (parstate) (declare (xargs :stobjs (parstate))) (declare (xargs :guard (parstatep parstate))) (let ((__function__ 'parse-init-declarator)) (declare (ignorable __function__)) (b* (((reterr) (irr-initdeclor) (irr-span) parstate) ((erp declor span parstate) (parse-declarator parstate)) ((erp token & parstate) (read-token parstate))) (cond ((token-punctuatorp token "=") (b* (((erp initer last-span parstate) (parse-initializer parstate))) (retok (make-initdeclor :declor declor :init? initer) (span-join span last-span) parstate))) (t (b* ((parstate (if token (unread-token parstate) parstate))) (retok (make-initdeclor :declor declor :init? nil) span parstate)))))))
Theorem:
(defthm initdeclorp-of-parse-init-declarator.initdeclor (b* (((mv acl2::?erp ?initdeclor ?span ?new-parstate) (parse-init-declarator parstate))) (initdeclorp initdeclor)) :rule-classes :rewrite)
Theorem:
(defthm spanp-of-parse-init-declarator.span (b* (((mv acl2::?erp ?initdeclor ?span ?new-parstate) (parse-init-declarator parstate))) (spanp span)) :rule-classes :rewrite)
Theorem:
(defthm parstatep-of-parse-init-declarator.new-parstate (implies (parstatep parstate) (b* (((mv acl2::?erp ?initdeclor ?span ?new-parstate) (parse-init-declarator parstate))) (parstatep new-parstate))) :rule-classes :rewrite)
Theorem:
(defthm parsize-of-parse-init-declarator-uncond (b* (((mv acl2::?erp ?initdeclor ?span ?new-parstate) (parse-init-declarator parstate))) (<= (parsize new-parstate) (parsize parstate))) :rule-classes :linear)
Theorem:
(defthm parsize-of-parse-init-declarator-cond (b* (((mv acl2::?erp ?initdeclor ?span ?new-parstate) (parse-init-declarator parstate))) (implies (not erp) (<= (parsize new-parstate) (1- (parsize parstate))))) :rule-classes :linear)