Recognizer for token structures.
(tokenp x) → *
Function:
(defun tokenp (x) (declare (xargs :guard t)) (and (consp x) (cond ((or (atom x) (eq (car x) :keyword)) (and (b* ((unwrap (cdr x))) (stringp unwrap)))) ((eq (car x) :ident) (and (b* ((unwrap (cdr x))) (identp unwrap)))) ((eq (car x) :const) (and (b* ((unwrap (cdr x))) (constp unwrap)))) ((eq (car x) :string) (and (b* ((unwrap (cdr x))) (stringlitp unwrap)))) (t (and (eq (car x) :punctuator) (and) (b* ((unwrap (cdr x))) (stringp unwrap)))))))
Theorem:
(defthm consp-when-tokenp (implies (tokenp x) (consp x)) :rule-classes :compound-recognizer)