Parses everything in a
(vl-parse-dpi-export atts &key (tokstream 'tokstream) (config 'config)) → (mv errmsg? value new-tokstream)
SystemVerilog-2012:
dpi_import_export ::= | 'export' dpi_spec_string [c_identifier '=' ] 'function' function_identifier ';' | 'export' dpi_spec_string [c_identifier '=' ] 'task' task_identifier ';' | ... import cases ... task_identifier ::= identifier function_identifier ::= identifier
Function:
(defun vl-parse-dpi-export-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-dpi-export)) (declare (ignorable __function__)) (seq tokstream (:= (vl-match-token :vl-kwd-export)) (spec := (vl-parse-dpi-spec-string)) (when (vl-is-token? :vl-idtoken) (c-name := (vl-parse-c-identifier)) (:= (vl-match-token :vl-equalsign))) (fntask := (vl-match-some-token '(:vl-kwd-function :vl-kwd-task))) (name := (vl-match-token :vl-idtoken)) (:= (vl-warn-about-deprecated-dpi spec name nil)) (:= (vl-match-token :vl-semi)) (return (make-vl-dpiexport :name (vl-idtoken->name name) :c-name (or c-name (vl-idtoken->name name)) :spec spec :fntask (case (vl-token->type fntask) (:vl-kwd-function :vl-dpi-function) (:vl-kwd-task :vl-dpi-task)) :atts atts :loc (vl-token->loc name))))))
Theorem:
(defthm vl-parse-dpi-export-fails-gracefully (implies (mv-nth 0 (vl-parse-dpi-export atts)) (not (mv-nth 1 (vl-parse-dpi-export atts)))))
Theorem:
(defthm vl-warning-p-of-vl-parse-dpi-export (iff (vl-warning-p (mv-nth 0 (vl-parse-dpi-export atts))) (mv-nth 0 (vl-parse-dpi-export atts))))
Theorem:
(defthm vl-parse-dpi-export-result (implies (and (force (vl-atts-p atts))) (equal (vl-dpiexport-p (mv-nth 1 (vl-parse-dpi-export atts))) (not (mv-nth 0 (vl-parse-dpi-export atts))))))
Theorem:
(defthm vl-parse-dpi-export-count-strong (and (<= (vl-tokstream-measure :tokstream (mv-nth 2 (vl-parse-dpi-export atts))) (vl-tokstream-measure)) (implies (not (mv-nth 0 (vl-parse-dpi-export atts))) (< (vl-tokstream-measure :tokstream (mv-nth 2 (vl-parse-dpi-export atts))) (vl-tokstream-measure)))) :rule-classes ((:rewrite) (:linear)))