Matches
(vl-parse-sequence-match-item &key (tokstream 'tokstream) (config 'config)) → (mv errmsg? value new-tokstream)
After reviewing the grammar, I think sequence_match_items are essentially just a subset of expressions and can probably be best represented just as expressions. The main grammar rule is:
sequence_match_item ::= operator_assignment | inc_or_dec_expression | subroutine_call
If you dive down into this, the complexity really explodes. The details of
But all of this stuff is also a problem in our ordinary expressions; we have
expression ::= primary | '(' operator_assignment ')' | inc_or_dec_expression | ... primary ::= function_subroutine_call | ... function_subroutine_call ::= subroutine_call
So all of these kinds of things can directly be expressions.
Function:
(defun vl-parse-sequence-match-item-fn (tokstream config) (declare (xargs :stobjs (tokstream))) (declare (xargs :guard (vl-loadconfig-p config))) (declare (ignorable config)) (let ((__function__ 'vl-parse-sequence-match-item)) (declare (ignorable __function__)) (seq tokstream (expr := (vl-parse-mintypmax-expression)) (when (and expr (vl-expr-case expr (:vl-call t) (:vl-unary (member expr.op '(:vl-unary-preinc :vl-unary-predec :vl-unary-postinc :vl-unary-postdec))) (:vl-binary (member expr.op '(:vl-binary-assign :vl-binary-plusassign :vl-binary-minusassign :vl-binary-timesassign :vl-binary-divassign :vl-binary-remassign :vl-binary-andassign :vl-binary-orassign :vl-binary-xorassign :vl-binary-shlassign :vl-binary-shrassign :vl-binary-ashlassign :vl-binary-ashrassign))) (& nil))) (return expr)) (return-raw (vl-parse-error "Illegal expression for sequence_match_item.")))))
Theorem:
(defthm vl-parse-sequence-match-item-fails-gracefully (implies (mv-nth 0 (vl-parse-sequence-match-item)) (not (mv-nth 1 (vl-parse-sequence-match-item)))))
Theorem:
(defthm vl-warning-p-of-vl-parse-sequence-match-item (iff (vl-warning-p (mv-nth 0 (vl-parse-sequence-match-item))) (mv-nth 0 (vl-parse-sequence-match-item))))
Theorem:
(defthm vl-parse-sequence-match-item-result (implies (and t) (equal (vl-expr-p (mv-nth 1 (vl-parse-sequence-match-item))) (not (mv-nth 0 (vl-parse-sequence-match-item))))))
Theorem:
(defthm vl-parse-sequence-match-item-count-strong (and (<= (vl-tokstream-measure :tokstream (mv-nth 2 (vl-parse-sequence-match-item))) (vl-tokstream-measure)) (implies (not (mv-nth 0 (vl-parse-sequence-match-item))) (< (vl-tokstream-measure :tokstream (mv-nth 2 (vl-parse-sequence-match-item))) (vl-tokstream-measure)))) :rule-classes ((:rewrite) (:linear)))