Parser for elements contained within modules, interfaces, etc., including generate constructs.
The structure of these is a little confusing -- here is some clarification:
Function:
(defun vl-parse-generate-fn (tokstream config) (declare (xargs :stobjs (tokstream))) (declare (xargs :guard (vl-loadconfig-p config))) (declare (ignorable config)) (let ((__function__ 'vl-parse-generate)) (declare (ignorable __function__)) (seq tokstream (when (vl-is-token? :vl-kwd-for) (loopblk := (vl-parse-genloop)) (return loopblk)) (when (vl-is-token? :vl-kwd-if) (ifblk := (vl-parse-genif)) (return ifblk)) (when (vl-is-token? :vl-kwd-case) (caseblk := (vl-parse-gencase)) (return caseblk)) (when (vl-is-token? :vl-kwd-begin) (loc := (vl-current-loc)) (:= (vl-match)) (when (vl-is-token? :vl-colon) (:= (vl-match)) (blkname := (vl-match-token :vl-idtoken))) (elts := (vl-parse-genelements-until :vl-kwd-end)) (:= (vl-match-token :vl-kwd-end)) (when blkname (:= (vl-parse-endblock-name (vl-idtoken->name blkname) "begin/end"))) (return (make-vl-genbegin :block (make-vl-genblock :name (and blkname (vl-idtoken->name blkname)) :elems elts :loc loc)))) (return nil))))
Function:
(defun vl-parse-genelement-fn (tokstream config) (declare (xargs :stobjs (tokstream))) (declare (xargs :guard (vl-loadconfig-p config))) (declare (xargs :measure-debug t)) (declare (ignorable config)) (let ((__function__ 'vl-parse-genelement)) (declare (ignorable __function__)) (seq tokstream (gen :w= (vl-parse-generate)) (when gen (return (list gen))) (items := (vl-parse-modelement)) (return (vl-modelementlist->genelements items)))))
Function:
(defun vl-parse-generate-block-fn (directly-under-condp tokstream config) (declare (xargs :stobjs (tokstream))) (declare (xargs :guard (vl-loadconfig-p config))) (declare (xargs :measure-debug t)) (declare (ignorable config)) (let ((__function__ 'vl-parse-generate-block)) (declare (ignorable __function__)) (seq tokstream (loc := (vl-current-loc)) (gen :w= (vl-parse-generate)) (when gen (return (if directly-under-condp (vl-genelement-case gen :vl-genbegin gen.block :vl-genif (make-vl-genblock :loc loc :elems (list gen) :condnestp t) :vl-gencase (make-vl-genblock :loc loc :elems (list gen) :condnestp t) :otherwise (make-vl-genblock :loc loc :elems (list gen))) (vl-genelement-case gen :vl-genbegin gen.block :otherwise (make-vl-genblock :loc loc :elems (list gen)))))) (items := (vl-parse-modelement)) (return (make-vl-genblock :loc loc :elems (vl-modelementlist->genelements items))))))
Function:
(defun vl-parse-genelements-until-fn (endkwd tokstream config) (declare (xargs :stobjs (tokstream))) (declare (xargs :guard (vl-loadconfig-p config))) (declare (ignorable config)) (declare (xargs :guard (vl-tokentype-p endkwd))) (let ((__function__ 'vl-parse-genelements-until)) (declare (ignorable __function__)) (seq tokstream (when (vl-is-token? endkwd) (return nil)) (when (vl-is-token? :vl-kwd-generate) (:= (vl-match)) (elems :w= (vl-parse-genelements-until :vl-kwd-endgenerate)) (:= (vl-match-token :vl-kwd-endgenerate)) (rest := (vl-parse-genelements-until endkwd)) (return (append elems rest))) (first :s= (vl-parse-genelement)) (rest := (vl-parse-genelements-until endkwd)) (return (append first rest)))))
Function:
(defun vl-parse-genloop-fn (tokstream config) (declare (xargs :stobjs (tokstream))) (declare (xargs :guard (vl-loadconfig-p config))) (declare (ignorable config)) (declare (xargs :guard (and (consp (vl-tokstream->tokens)) (vl-is-token? :vl-kwd-for)))) (let ((__function__ 'vl-parse-genloop)) (declare (ignorable __function__)) (seq tokstream (header := (vl-parse-genloop-header)) (body := (vl-parse-generate-block nil)) (return (change-vl-genloop header :body body)))))
Function:
(defun vl-parse-genif-fn (tokstream config) (declare (xargs :stobjs (tokstream))) (declare (xargs :guard (vl-loadconfig-p config))) (declare (ignorable config)) (declare (xargs :guard (and (consp (vl-tokstream->tokens)) (vl-is-token? :vl-kwd-if)))) (let ((__function__ 'vl-parse-genif)) (declare (ignorable __function__)) (seq tokstream (loc := (vl-current-loc)) (:= (vl-match)) (:= (vl-match-token :vl-lparen)) (test := (vl-parse-expression)) (:= (vl-match-token :vl-rparen)) (then :w= (vl-parse-generate-block t)) (when (and (consp (vl-tokstream->tokens)) (vl-is-token? :vl-kwd-else)) (:= (vl-match)) (else := (vl-parse-generate-block t))) (return (make-vl-genif :test test :then then :else (or else (make-vl-genblock :loc loc)) :loc loc)))))
Function:
(defun vl-parse-gencase-fn (tokstream config) (declare (xargs :stobjs (tokstream))) (declare (xargs :guard (vl-loadconfig-p config))) (declare (ignorable config)) (declare (xargs :guard (and (consp (vl-tokstream->tokens)) (vl-is-token? :vl-kwd-case)))) (let ((__function__ 'vl-parse-gencase)) (declare (ignorable __function__)) (seq tokstream (loc := (vl-current-loc)) (:= (vl-match)) (:= (vl-match-token :vl-lparen)) (test := (vl-parse-expression)) (:= (vl-match-token :vl-rparen)) ((caselist . default) := (vl-parse-gencaselist)) (return (make-vl-gencase :test test :cases caselist :default (or default (make-vl-genblock :loc loc)) :loc loc)))))
Function:
(defun vl-parse-gencaselist-fn (tokstream config) (declare (xargs :stobjs (tokstream))) (declare (xargs :guard (vl-loadconfig-p config))) (declare (ignorable config)) (let ((__function__ 'vl-parse-gencaselist)) (declare (ignorable __function__)) (seq tokstream (when (vl-is-token? :vl-kwd-endcase) (:= (vl-match)) (return (cons nil nil))) (when (vl-is-token? :vl-kwd-default) (:= (vl-match)) (:= (vl-match-token :vl-colon)) (blk :w= (vl-parse-generate-block t)) ((rest . rdefault) := (vl-parse-gencaselist)) (when rdefault (return-raw (vl-parse-error "Multiple default cases in generate case"))) (return (cons rest blk))) (exprs := (vl-parse-1+-expressions-separated-by-commas)) (:= (vl-match-token :vl-colon)) (blk :w= (vl-parse-generate-block t)) ((rest . default) := (vl-parse-gencaselist)) (return (cons (cons (cons exprs blk) rest) default)))))