Try to parse a single token at the front of
(vl-lex-token1 char1 echars breakp st warnings) → (mv token/nil remainder warnings)
Function:
(defun vl-lex-token1$inline (char1 echars breakp st warnings) (declare (xargs :guard (and (characterp char1) (and (vl-echarlist-p echars) (consp echars)) (booleanp breakp) (vl-lexstate-p st) (vl-warninglist-p warnings)))) (declare (ignorable breakp)) (declare (xargs :guard (eql char1 (vl-echar->char (car echars))))) (let ((__function__ 'vl-lex-token1)) (declare (ignorable __function__)) (if (char<= char1 #\9) (b* (((when (vl-whitespace-p char1)) (b* (((mv prefix remainder) (vl-read-while-whitespace echars))) (mv (make-vl-plaintoken :etext prefix :type :vl-ws) remainder (ok)))) ((when (vl-decimal-digit-p char1)) (vl-lex-1step-or-number echars breakp st warnings))) (case char1 (#\! (vl-lex-plain-alist echars breakp (vl-lexstate->bangops st) warnings)) (#\" (mv-let (tok rem) (vl-lex-string echars breakp st) (mv tok rem (ok)))) (#\# (vl-lex-plain-alist echars breakp (vl-lexstate->poundops st) warnings)) (#\$ (b* (((mv tok remainder) (vl-lex-system-identifier echars breakp (vl-lexstate->dollarops st)))) (mv tok remainder (ok)))) (#\% (vl-lex-plain-alist echars breakp (vl-lexstate->remops st) warnings)) (#\& (vl-lex-plain-alist echars breakp (vl-lexstate->andops st) warnings)) (#\' (b* (((mv tok remainder warnings) (vl-lex-number echars breakp st warnings)) ((when tok) (mv tok remainder warnings)) ((unless (vl-lexstate->quotesp st)) (mv nil remainder warnings))) (vl-lex-plain echars breakp "'" :vl-quote warnings))) (#\( (vl-lex-plain-alist echars breakp '(("(*" . :vl-beginattr) ("(" . :vl-lparen)) warnings)) (#\) (vl-lex-plain echars breakp ")" :vl-rparen warnings)) (#\* (vl-lex-plain-alist echars breakp (vl-lexstate->starops st) warnings)) (#\+ (vl-lex-plain-alist echars breakp (vl-lexstate->plusops st) warnings)) (#\, (vl-lex-plain echars breakp "," :vl-comma warnings)) (#\- (vl-lex-plain-alist echars breakp (vl-lexstate->dashops st) warnings)) (#\. (vl-lex-plain-alist echars breakp (vl-lexstate->dotops st) warnings)) (#\/ (cond ((vl-matches-string-p "//" echars) (mv-let (tok rem) (vl-lex-oneline-comment echars) (mv tok rem (ok)))) ((vl-matches-string-p "/*" echars) (mv-let (tok rem) (vl-lex-block-comment echars) (mv tok rem (ok)))) (t (vl-lex-plain-alist echars breakp (vl-lexstate->divops st) warnings)))) (otherwise (mv nil echars (ok))))) (if (vl-simple-id-head-p char1) (mv-let (tok rem) (vl-lex-simple-identifier-or-keyword echars breakp (vl-lexstate->kwdtable st)) (mv tok rem (ok))) (case char1 (#\: (if (vl-matches-string-p "://" echars) (mv (make-vl-plaintoken :etext (list (car echars)) :type :vl-colon :breakp breakp) (cdr echars) (ok)) (vl-lex-plain-alist echars breakp (vl-lexstate->colonops st) warnings))) (#\; (vl-lex-plain echars breakp ";" :vl-semi warnings)) (#\< (vl-lex-plain-alist echars breakp (vl-lexstate->lessops st) warnings)) (#\= (vl-lex-plain-alist echars breakp (vl-lexstate->eqops st) warnings)) (#\> (vl-lex-plain-alist echars breakp (vl-lexstate->gtops st) warnings)) (#\? (vl-lex-plain echars breakp "?" :vl-qmark warnings)) (#\@ (vl-lex-plain echars breakp "@" :vl-atsign warnings)) (#\[ (vl-lex-plain echars breakp "[" :vl-lbrack warnings)) (#\\ (mv-let (tok rem) (vl-lex-escaped-identifier echars breakp) (mv tok rem (ok)))) (#\] (vl-lex-plain echars breakp "]" :vl-rbrack warnings)) (#\^ (vl-lex-plain-alist echars breakp (vl-lexstate->xorops st) warnings)) (#\{ (vl-lex-plain echars breakp "{" :vl-lcurly warnings)) (#\| (vl-lex-plain-alist echars breakp (vl-lexstate->barops st) warnings)) (#\} (vl-lex-plain echars breakp "}" :vl-rcurly warnings)) (#\~ (vl-lex-plain-alist echars breakp '(("~&" . :vl-nand) ("~|" . :vl-nor) ("~^" . :vl-xnor) ("~" . :vl-bitnot)) warnings)) (#\` (b* (((mv tok remainder) (vl-lex-timescale echars))) (mv tok remainder (ok)))) (otherwise (mv nil echars (ok))))))))
Theorem:
(defthm vl-warninglist-p-of-vl-lex-token1.warnings (b* (((mv ?token/nil ?remainder ?warnings) (vl-lex-token1$inline char1 echars breakp st warnings))) (vl-warninglist-p warnings)) :rule-classes :rewrite)
Theorem:
(defthm vl-token-p-of-vl-lex-token1 (implies (and (force (vl-echarlist-p echars)) (and (force (consp echars)) (force (equal char1 (vl-echar->char (car echars)))) (force (booleanp breakp)) (force (vl-lexstate-p st)))) (equal (vl-token-p (mv-nth 0 (vl-lex-token1 char1 echars breakp st warnings))) (if (mv-nth 0 (vl-lex-token1 char1 echars breakp st warnings)) t nil))))
Theorem:
(defthm true-listp-of-vl-lex-token1 (equal (true-listp (mv-nth 1 (vl-lex-token1 char1 echars breakp st warnings))) (true-listp echars)) :rule-classes ((:rewrite) (:type-prescription :corollary (implies (true-listp echars) (true-listp (mv-nth 1 (vl-lex-token1 char1 echars breakp st warnings)))))))
Theorem:
(defthm vl-echarlist-p-of-vl-lex-token1 (implies (force (vl-echarlist-p echars)) (equal (vl-echarlist-p (mv-nth 1 (vl-lex-token1 char1 echars breakp st warnings))) t)))
Theorem:
(defthm append-of-vl-lex-token1 (implies (and (mv-nth 0 (vl-lex-token1 char1 echars breakp st warnings)) (force (vl-echarlist-p echars)) (and (force (consp echars)) (force (equal char1 (vl-echar->char (car echars)))) (force (booleanp breakp)) (force (vl-lexstate-p st)))) (equal (append (vl-token->etext (mv-nth 0 (vl-lex-token1 char1 echars breakp st warnings))) (mv-nth 1 (vl-lex-token1 char1 echars breakp st warnings))) echars)))
Theorem:
(defthm no-change-loser-of-vl-lex-token1 (implies (not (mv-nth 0 (vl-lex-token1 char1 echars breakp st warnings))) (equal (mv-nth 1 (vl-lex-token1 char1 echars breakp st warnings)) echars)))
Theorem:
(defthm acl2-count-of-vl-lex-token1-weak (<= (acl2-count (mv-nth 1 (vl-lex-token1 char1 echars breakp st warnings))) (acl2-count echars)) :rule-classes ((:rewrite) (:linear)))
Theorem:
(defthm acl2-count-of-vl-lex-token1-strong (implies (and (mv-nth 0 (vl-lex-token1 char1 echars breakp st warnings)) (force (equal char1 (vl-echar->char (car echars))))) (< (acl2-count (mv-nth 1 (vl-lex-token1 char1 echars breakp st warnings))) (acl2-count echars))) :rule-classes ((:rewrite) (:linear)))