Compatible with seq. Get the first token, no matter what kind of token it is. Only usable when you know there is a token there (via the guard).
(vl-match &key (tokstream 'tokstream)) → (mv errmsg? token new-tokstream)
Function:
(defun vl-match$inline (tokstream) (declare (xargs :stobjs (tokstream))) (declare (xargs :guard (consp (vl-tokstream->tokens)))) (let ((__function__ 'vl-match)) (declare (ignorable __function__)) (b* ((tokens (vl-tokstream->tokens)) (tokstream (vl-tokstream-pop))) (mv nil (car tokens) tokstream))))
Theorem:
(defthm not-of-vl-match.errmsg? (b* (((mv ?errmsg? ?token ?new-tokstream) (vl-match$inline tokstream))) (not errmsg?)) :rule-classes :rewrite)
Theorem:
(defthm return-type-of-vl-match.token (b* (((mv ?errmsg? ?token ?new-tokstream) (vl-match$inline tokstream))) (equal (vl-token-p token) (consp (vl-tokstream->tokens)))) :rule-classes :rewrite)
Theorem:
(defthm vl-match-under-iff (iff (mv-nth 1 (vl-match)) (consp (vl-tokstream->tokens))))
Theorem:
(defthm vl-match-count-strong-on-value (and (<= (vl-tokstream-measure :tokstream (mv-nth 2 (vl-match))) (vl-tokstream-measure)) (implies (mv-nth 1 (vl-match)) (< (vl-tokstream-measure :tokstream (mv-nth 2 (vl-match))) (vl-tokstream-measure)))) :rule-classes ((:rewrite) (:linear)))
Theorem:
(defthm equal-of-vl-match-count (equal (equal (vl-tokstream-measure :tokstream (mv-nth 2 (vl-match))) (vl-tokstream-measure)) (atom (vl-tokstream->tokens))))
Theorem:
(defthm vl-token->type-of-vl-match-when-vl-is-token? (implies (vl-is-token? type) (equal (vl-token->type (mv-nth 1 (vl-match))) type)))
Theorem:
(defthm vl-token->type-of-vl-match-when-vl-is-some-token? (implies (vl-type-of-matched-token types (vl-tokstream->tokens)) (equal (vl-token->type (mv-nth 1 (vl-match))) (vl-type-of-matched-token types (vl-tokstream->tokens)))))
Theorem:
(defthm more-tokens-after-vl-match-because-lookahead-sees-something (implies (vl-lookahead-is-token? token (cdr (vl-tokstream->tokens))) (consp (vl-tokstream->tokens :tokstream (mv-nth 2 (vl-match))))) :rule-classes ((:forward-chaining :trigger-terms ((vl-lookahead-is-token? token (cdr (vl-tokstream->tokens)))))))