Token: complement is() method with isOneOf() to allow easier usage

llvm-svn: 239526
This commit is contained in:
Daniel Marjamaki 2015-06-11 12:28:14 +00:00
parent b36d610cc2
commit 647e61244b
1 changed files with 7 additions and 0 deletions

View File

@ -94,6 +94,13 @@ public:
/// "if (Tok.is(tok::l_brace)) {...}".
bool is(tok::TokenKind K) const { return Kind == K; }
bool isNot(tok::TokenKind K) const { return Kind != K; }
bool isOneOf(tok::TokenKind K1, tok::TokenKind K2) const {
return is(K1) || is(K2);
}
template <typename... Ts>
bool isOneOf(tok::TokenKind K1, tok::TokenKind K2, Ts... Ks) const {
return is(K1) || isOneOf(K2, Ks...);
}
/// \brief Return true if this is a raw identifier (when lexing
/// in raw mode) or a non-keyword identifier (when lexing in non-raw mode).