Match a
(vl-parse-timeliteral &key (tokstream 'tokstream) (config 'config)) → (mv errmsg? value new-tokstream)
A time_literal is handled by the lexer as a vl-timetoken and contains a quantity just as a string and a vl-timeunit-p, which is just what we need for our vl-timeliteral structures.
Function:
(defun vl-parse-timeliteral-fn (tokstream config) (declare (xargs :stobjs (tokstream))) (declare (xargs :guard (vl-loadconfig-p config))) (declare (ignorable config)) (let ((__function__ 'vl-parse-timeliteral)) (declare (ignorable __function__)) (seq tokstream (lit := (vl-match-token :vl-timetoken)) (return (make-vl-timeliteral :quantity (vl-timetoken->quantity lit) :units (vl-timetoken->units lit))))))
Theorem:
(defthm vl-parse-timeliteral-fails-gracefully (implies (mv-nth 0 (vl-parse-timeliteral)) (not (mv-nth 1 (vl-parse-timeliteral)))))
Theorem:
(defthm vl-warning-p-of-vl-parse-timeliteral (iff (vl-warning-p (mv-nth 0 (vl-parse-timeliteral))) (mv-nth 0 (vl-parse-timeliteral))))
Theorem:
(defthm vl-parse-timeliteral-result (implies (and t) (equal (vl-timeliteral-p (mv-nth 1 (vl-parse-timeliteral))) (not (mv-nth 0 (vl-parse-timeliteral))))))
Theorem:
(defthm vl-parse-timeliteral-count-strong (and (<= (vl-tokstream-measure :tokstream (mv-nth 2 (vl-parse-timeliteral))) (vl-tokstream-measure)) (implies (not (mv-nth 0 (vl-parse-timeliteral))) (< (vl-tokstream-measure :tokstream (mv-nth 2 (vl-parse-timeliteral))) (vl-tokstream-measure)))) :rule-classes ((:rewrite) (:linear)))