Parse a
(vl-parse-udp-declaration atts &key (tokstream 'tokstream) (config 'config)) → (mv errmsg? value new-tokstream)
Function:
(defun vl-parse-udp-declaration-fn (atts tokstream config) (declare (xargs :stobjs (tokstream))) (declare (xargs :guard (vl-loadconfig-p config))) (declare (ignorable config)) (declare (xargs :guard (vl-atts-p atts))) (let ((__function__ 'vl-parse-udp-declaration)) (declare (ignorable __function__)) (seq tokstream (startkwd := (vl-match-token :vl-kwd-primitive)) (udpname := (vl-match-token :vl-idtoken)) (return-raw (b* ((backup (vl-tokstream-save)) (orig-warnings (vl-parsestate->warnings (vl-tokstream->pstate))) (tokstream (vl-tokstream-update-pstate (change-vl-parsestate (vl-tokstream->pstate) :warnings nil))) ((mv err udp tokstream) (seq tokstream (:= (vl-match-token :vl-lparen)) (head := (if (or (vl-is-token? :vl-kwd-output) (vl-is-token? :vl-beginattr)) (vl-parse-integrated-udp-head) (vl-parse-traditional-udp-head udpname))) (body := (vl-parse-udp-body head)) (endkwd := (vl-match-token :vl-kwd-endprimitive)) (:= (vl-parse-endblock-name (vl-idtoken->name udpname) "primitive/endprimitive")) (return (b* (((vl-udp-head head)) ((vl-udp-body body)) (warnings (vl-parsestate->warnings (vl-tokstream->pstate)))) (make-vl-udp :name (vl-idtoken->name udpname) :minloc (vl-token->loc startkwd) :maxloc (vl-token->loc endkwd) :output head.output :inputs head.inputs :sequentialp head.sequentialp :table body.table :initval body.init :warnings warnings :atts atts))))) ((unless err) (let ((tokstream (vl-tokstream-update-pstate (change-vl-parsestate (vl-tokstream->pstate) :warnings orig-warnings)))) (mv nil udp tokstream))) (errtokens (vl-tokstream->tokens)) (tokstream (vl-tokstream-restore backup))) (seq tokstream (endkwd := (vl-skip-through-endprimitive (vl-idtoken->name udpname))) (return (vl-make-udp-with-parse-error (vl-idtoken->name udpname) (vl-token->loc startkwd) (vl-token->loc endkwd) err errtokens))))))))
Theorem:
(defthm vl-parse-udp-declaration-fails-gracefully (implies (mv-nth 0 (vl-parse-udp-declaration atts)) (not (mv-nth 1 (vl-parse-udp-declaration atts)))))
Theorem:
(defthm vl-warning-p-of-vl-parse-udp-declaration (iff (vl-warning-p (mv-nth 0 (vl-parse-udp-declaration atts))) (mv-nth 0 (vl-parse-udp-declaration atts))))
Theorem:
(defthm vl-parse-udp-declaration-result (implies (and (force (vl-atts-p atts))) (equal (vl-udp-p (mv-nth 1 (vl-parse-udp-declaration atts))) (not (mv-nth 0 (vl-parse-udp-declaration atts))))))
Theorem:
(defthm vl-parse-udp-declaration-count-strong (and (<= (vl-tokstream-measure :tokstream (mv-nth 2 (vl-parse-udp-declaration atts))) (vl-tokstream-measure)) (implies (not (mv-nth 0 (vl-parse-udp-declaration atts))) (< (vl-tokstream-measure :tokstream (mv-nth 2 (vl-parse-udp-declaration atts))) (vl-tokstream-measure)))) :rule-classes ((:rewrite) (:linear)))