Verilog-2005 only. Top-level function for parsing port lists in both ANSI and non-ANSI styles.
(vl-parse-module-port-list-top-2005 &key (tokstream 'tokstream) (config 'config)) → (mv errmsg? value new-tokstream)
See verilog-2005-ports and verilog-2005-portdecls. We match the following, contrived grammar rule:
vl_module_port_list ::= list_of_ports | [list_of_port_declarations]
We can tell which variant we are following because a
(* input output inout
Function:
(defun vl-parse-module-port-list-top-2005-fn (tokstream config) (declare (xargs :stobjs (tokstream))) (declare (xargs :guard (vl-loadconfig-p config))) (declare (ignorable config)) (let ((__function__ 'vl-parse-module-port-list-top-2005)) (declare (ignorable __function__)) (seq tokstream (unless (vl-is-token? :vl-lparen) (return (make-vl-nonansi-ports :ports nil))) (:= (vl-match)) (when (vl-is-token? :vl-rparen) (:= (vl-match-token :vl-rparen)) (return (make-vl-nonansi-ports :ports nil))) (when (vl-is-some-token? '(:vl-kwd-output :vl-kwd-input :vl-kwd-inout :vl-beginattr)) (portdecls := (vl-parse-1+-port-declarations-separated-by-commas-2005)) (:= (vl-match-token :vl-rparen)) (return (make-vl-ansi-ports :decls portdecls))) (ports := (vl-parse-1+-ports-separated-by-commas)) (:= (vl-match-token :vl-rparen)) (return (make-vl-nonansi-ports :ports ports)))))
Theorem:
(defthm vl-parse-module-port-list-top-2005-fails-gracefully (implies (mv-nth 0 (vl-parse-module-port-list-top-2005)) (not (mv-nth 1 (vl-parse-module-port-list-top-2005)))))
Theorem:
(defthm vl-warning-p-of-vl-parse-module-port-list-top-2005 (iff (vl-warning-p (mv-nth 0 (vl-parse-module-port-list-top-2005))) (mv-nth 0 (vl-parse-module-port-list-top-2005))))
Theorem:
(defthm vl-parse-module-port-list-top-2005-result (implies (and t) (equal (vl-parsed-ports-p (mv-nth 1 (vl-parse-module-port-list-top-2005))) (not (mv-nth 0 (vl-parse-module-port-list-top-2005))))))
Theorem:
(defthm vl-parse-module-port-list-top-2005-count-weak (<= (vl-tokstream-measure :tokstream (mv-nth 2 (vl-parse-module-port-list-top-2005))) (vl-tokstream-measure)) :rule-classes ((:rewrite) (:linear)))