forked from OSchip/llvm-project
Expose ConsumeAnyToken interface to external clients.
llvm-svn: 316022
This commit is contained in:
parent
0a412f4db0
commit
4068fc1b28
|
@ -338,6 +338,27 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
/// ConsumeAnyToken - Dispatch to the right Consume* method based on the
|
||||
/// current token type. This should only be used in cases where the type of
|
||||
/// the token really isn't known, e.g. in error recovery.
|
||||
SourceLocation ConsumeAnyToken(bool ConsumeCodeCompletionTok = false) {
|
||||
if (isTokenParen())
|
||||
return ConsumeParen();
|
||||
if (isTokenBracket())
|
||||
return ConsumeBracket();
|
||||
if (isTokenBrace())
|
||||
return ConsumeBrace();
|
||||
if (isTokenStringLiteral())
|
||||
return ConsumeStringToken();
|
||||
if (Tok.is(tok::code_completion))
|
||||
return ConsumeCodeCompletionTok ? ConsumeCodeCompletionToken()
|
||||
: handleUnexpectedCodeCompletionToken();
|
||||
if (Tok.isAnnotation())
|
||||
return ConsumeAnnotationToken();
|
||||
return ConsumeToken();
|
||||
}
|
||||
|
||||
|
||||
SourceLocation getEndOfPreviousToken() {
|
||||
return PP.getLocForEndOfToken(PrevTokLocation);
|
||||
}
|
||||
|
@ -388,26 +409,6 @@ private:
|
|||
PP.EnterToken(Next);
|
||||
}
|
||||
|
||||
/// ConsumeAnyToken - Dispatch to the right Consume* method based on the
|
||||
/// current token type. This should only be used in cases where the type of
|
||||
/// the token really isn't known, e.g. in error recovery.
|
||||
SourceLocation ConsumeAnyToken(bool ConsumeCodeCompletionTok = false) {
|
||||
if (isTokenParen())
|
||||
return ConsumeParen();
|
||||
if (isTokenBracket())
|
||||
return ConsumeBracket();
|
||||
if (isTokenBrace())
|
||||
return ConsumeBrace();
|
||||
if (isTokenStringLiteral())
|
||||
return ConsumeStringToken();
|
||||
if (Tok.is(tok::code_completion))
|
||||
return ConsumeCodeCompletionTok ? ConsumeCodeCompletionToken()
|
||||
: handleUnexpectedCodeCompletionToken();
|
||||
if (Tok.isAnnotation())
|
||||
return ConsumeAnnotationToken();
|
||||
return ConsumeToken();
|
||||
}
|
||||
|
||||
SourceLocation ConsumeAnnotationToken() {
|
||||
assert(Tok.isAnnotation() && "wrong consume method");
|
||||
SourceLocation Loc = Tok.getLocation();
|
||||
|
|
Loading…
Reference in New Issue