Match whitespace to create a :whitespace token.
(lex-whitespace sin) → (mv tok sin)
Function:
(defun lex-whitespace (sin) (declare (xargs :stobjs (sin))) (declare (xargs :guard t)) (let ((__function__ 'lex-whitespace)) (declare (ignorable __function__)) (b* (((mv match sin) (sin-match-charset* (whitespace-chars) sin)) ((unless match) (mv nil sin))) (mv (make-token :type :whitespace :text match) sin))))
Theorem:
(defthm return-type-of-lex-whitespace.tok (b* (((mv ?tok ?sin) (lex-whitespace sin))) (equal (token-p tok) (if tok t nil))) :rule-classes :rewrite)
Theorem:
(defthm lex-whitespace-progress-weak (mv-let (tok new-sin) (lex-whitespace sin) (declare (ignorable tok new-sin)) (<= (len (strin-left new-sin)) (len (strin-left sin)))) :rule-classes ((:rewrite) (:linear)))
Theorem:
(defthm lex-whitespace-progress-strong (mv-let (tok new-sin) (lex-whitespace sin) (declare (ignorable tok new-sin)) (implies tok (< (len (strin-left new-sin)) (len (strin-left sin))))) :rule-classes ((:rewrite) (:linear)))
Theorem:
(defthm lex-whitespace-reconstruction (b* (((mv tok new-sin) (lex-whitespace sin))) (implies tok (equal (append (explode (token->text tok)) (strin-left new-sin)) (strin-left sin)))))