]> granicus.if.org Git - clang/commitdiff
Expose ConsumeAnyToken interface to external clients.
authorVassil Vassilev <v.g.vassilev@gmail.com>
Tue, 17 Oct 2017 19:38:57 +0000 (19:38 +0000)
committerVassil Vassilev <v.g.vassilev@gmail.com>
Tue, 17 Oct 2017 19:38:57 +0000 (19:38 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316022 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Parse/Parser.h

index 826114bc43d6ea3123dd0b15a5042546d7526765..a2eef247de28f4f520e81cd91fc511a28b34f55a 100644 (file)
@@ -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();