Complete wrapper: lex an ACL2 string.
(lex-string contents &key (filename '"")) → (mv errmsg tokens)
This just takes care of creating a local sin to use, then calls lex-main to do the real work.
Function:
(defun lex-string-fn (contents filename) (declare (xargs :guard (and (stringp contents) (stringp filename)))) (let ((__function__ 'lex-string)) (declare (ignorable __function__)) (with-local-stobj sin (mv-let (errmsg tokens sin) (b* ((sin (sin-init contents filename sin))) (lex-main sin)) (mv errmsg tokens)))))
Theorem:
(defthm return-type-of-lex-string.errmsg (b* (((mv ?errmsg ?tokens) (lex-string-fn contents filename))) (or (stringp errmsg) (not errmsg))) :rule-classes :type-prescription)
Theorem:
(defthm tokenlist-p-of-lex-string.tokens (b* (((mv ?errmsg ?tokens) (lex-string-fn contents filename))) (tokenlist-p tokens)) :rule-classes :rewrite)
Theorem:
(defthm tokenlist-all-text-of-lex-string (b* (((mv errmsg tokens) (lex-string contents :filename filename))) (implies (not errmsg) (equal (tokenlist-all-text tokens) (if (stringp contents) contents "")))))