Skip to content
Snippets Groups Projects
Commit c48acf9e authored by Daniel Marjamaki's avatar Daniel Marjamaki
Browse files

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@239526 91177308-0d34-0410-b5e6-96231b3b80d8
parent 03cf4b77
No related branches found
No related tags found
No related merge requests found
......@@ -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).
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment