Check if an optional token is a type specifier that consists of a single keyword.
(token-type-specifier-keyword-p token?) → yes/no
There are a number of type specifiers that consist of single keywords.
We also compare the token against the GCC variants
We similarly include the GCC extension types
Function:
(defun token-type-specifier-keyword-p (token?) (declare (xargs :guard (token-optionp token?))) (let ((__function__ 'token-type-specifier-keyword-p)) (declare (ignorable __function__)) (or (token-keywordp token? "void") (token-keywordp token? "char") (token-keywordp token? "short") (token-keywordp token? "int") (token-keywordp token? "long") (token-keywordp token? "float") (token-keywordp token? "double") (token-keywordp token? "signed") (token-keywordp token? "__signed") (token-keywordp token? "__signed__") (token-keywordp token? "unsigned") (token-keywordp token? "_Bool") (token-keywordp token? "_Complex") (token-keywordp token? "__int128") (token-keywordp token? "_Float128") (token-keywordp token? "__builtin_va_list"))))
Theorem:
(defthm booleanp-of-token-type-specifier-keyword-p (b* ((yes/no (token-type-specifier-keyword-p token?))) (booleanp yes/no)) :rule-classes :rewrite)
Theorem:
(defthm non-nil-when-token-type-specifier-keyword-p (implies (token-type-specifier-keyword-p token?) token?) :rule-classes :compound-recognizer)