summaryrefslogtreecommitdiffstats
path: root/include/clang/Basic/TokenKinds.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/clang/Basic/TokenKinds.h')
-rw-r--r--include/clang/Basic/TokenKinds.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/include/clang/Basic/TokenKinds.h b/include/clang/Basic/TokenKinds.h
index 478add8..e850971 100644
--- a/include/clang/Basic/TokenKinds.h
+++ b/include/clang/Basic/TokenKinds.h
@@ -63,6 +63,31 @@ const char *getTokenName(enum TokenKind Kind);
/// Preprocessor::getSpelling().
const char *getTokenSimpleSpelling(enum TokenKind Kind);
+/// \brief Return true if this is a raw identifier or an identifier kind.
+inline bool isAnyIdentifier(TokenKind K) {
+ return (K == tok::identifier) || (K == tok::raw_identifier);
+}
+
+/// \brief Return true if this is a "literal" kind, like a numeric
+/// constant, string, etc.
+inline bool isLiteral(TokenKind K) {
+ return (K == tok::numeric_constant) || (K == tok::char_constant) ||
+ (K == tok::wide_char_constant) || (K == tok::utf16_char_constant) ||
+ (K == tok::utf32_char_constant) || (K == tok::string_literal) ||
+ (K == tok::wide_string_literal) || (K == tok::utf8_string_literal) ||
+ (K == tok::utf16_string_literal) || (K == tok::utf32_string_literal) ||
+ (K == tok::angle_string_literal);
+}
+
+/// \brief Return true if this is any of tok::annot_* kinds.
+inline bool isAnnotation(TokenKind K) {
+#define ANNOTATION(NAME) \
+ if (K == tok::annot_##NAME) \
+ return true;
+#include "clang/Basic/TokenKinds.def"
+ return false;
+}
+
} // end namespace tok
} // end namespace clang
OpenPOWER on IntegriCloud