diff --git a/interpreter/cling/include/cling/Interpreter/LookupHelper.h b/interpreter/cling/include/cling/Interpreter/LookupHelper.h
index 5c344223c66c738f3306ea381d5091500232b16c..8d44500af1a46eebaa5b8ab2a3ff1038b7bde28a 100644
--- a/interpreter/cling/include/cling/Interpreter/LookupHelper.h
+++ b/interpreter/cling/include/cling/Interpreter/LookupHelper.h
@@ -71,6 +71,8 @@ namespace cling {
     unsigned m_CacheHits = 0;
     /// Number of times we missed the cache.
     unsigned m_TotalParseRequests = 0;
+    /// If we are called recursively.
+    bool IsRecursivelyRunning = false;
 
   public:
     LookupHelper(clang::Parser* P, Interpreter* interp);
diff --git a/interpreter/cling/include/cling/Utils/ParserStateRAII.h b/interpreter/cling/include/cling/Utils/ParserStateRAII.h
index 11d37f6a6e39203cff6b0054db1969e2fcef67e5..8ecb1a5a28b5a40052095948431d029c7804e9be 100644
--- a/interpreter/cling/include/cling/Utils/ParserStateRAII.h
+++ b/interpreter/cling/include/cling/Utils/ParserStateRAII.h
@@ -36,6 +36,7 @@ namespace cling {
     bool OldSuppressAllDiagnostics;
     bool OldPPSuppressAllDiagnostics;
     bool OldSpellChecking;
+    clang::Token OldTok;
     clang::SourceLocation OldPrevTokLocation;
     unsigned short OldParenCount, OldBracketCount, OldBraceCount;
     unsigned OldTemplateParameterDepth;
diff --git a/interpreter/cling/lib/Interpreter/LookupHelper.cpp b/interpreter/cling/lib/Interpreter/LookupHelper.cpp
index 2f27e5d9ac033dfdce2e056534ccb859f1ba9b5a..794d6532052d728d13701a0604b0902cbfaf2e4c 100644
--- a/interpreter/cling/lib/Interpreter/LookupHelper.cpp
+++ b/interpreter/cling/lib/Interpreter/LookupHelper.cpp
@@ -37,17 +37,20 @@ namespace cling {
 
   class StartParsingRAII {
     LookupHelper& m_LH;
+    llvm::SaveAndRestore<bool> SaveIsRecursivelyRunning;
     ParserStateRAII ResetParserState;
-
     void prepareForParsing(llvm::StringRef code, llvm::StringRef bufferName,
                            LookupHelper::DiagSetting diagOnOff);
   public:
     StartParsingRAII(LookupHelper& LH, llvm::StringRef code,
                      llvm::StringRef bufferName,
                      LookupHelper::DiagSetting diagOnOff)
-      : m_LH(LH), ResetParserState(*LH.m_Parser.get(), true /*skipToEOF*/) {
-    prepareForParsing(code, bufferName, diagOnOff);
-  }
+        : m_LH(LH), SaveIsRecursivelyRunning(LH.IsRecursivelyRunning),
+          ResetParserState(*LH.m_Parser.get(),
+                           !LH.IsRecursivelyRunning /*skipToEOF*/) {
+      LH.IsRecursivelyRunning = true;
+      prepareForParsing(code, bufferName, diagOnOff);
+    }
 
     ~StartParsingRAII() { pop(); }
     void pop() const {}
@@ -84,7 +87,8 @@ namespace cling {
     if (!PP.isIncrementalProcessingEnabled()) {
       PP.enableIncrementalProcessing();
     }
-    assert(!code.empty()&&"prepareForParsing should only be called when needd");
+    assert(!code.empty() &&
+           "prepareForParsing should only be called when need");
 
     // Create a fake file to parse the type name.
     FileID FID;
diff --git a/interpreter/cling/lib/Utils/ParserStateRAII.cpp b/interpreter/cling/lib/Utils/ParserStateRAII.cpp
index 8c7df78c438a903011b94a75e20e4b8838aca35d..2f4c9326c7f12f2303283c8eb8c7ad6d336c4656 100644
--- a/interpreter/cling/lib/Utils/ParserStateRAII.cpp
+++ b/interpreter/cling/lib/Utils/ParserStateRAII.cpp
@@ -24,7 +24,7 @@ cling::ParserStateRAII::ParserStateRAII(Parser& p, bool skipToEOF)
     OldPPSuppressAllDiagnostics(p.getPreprocessor().getDiagnostics()
                                 .getSuppressAllDiagnostics()),
     OldSpellChecking(p.getPreprocessor().getLangOpts().SpellChecking),
-  OldPrevTokLocation(p.PrevTokLocation),
+  OldTok(p.Tok), OldPrevTokLocation(p.PrevTokLocation),
   OldParenCount(p.ParenCount), OldBracketCount(p.BracketCount),
   OldBraceCount(p.BraceCount),
   OldTemplateParameterDepth(p.TemplateParameterDepth),
@@ -54,6 +54,8 @@ cling::ParserStateRAII::~ParserStateRAII() {
   P->TemplateIds.swap(OldTemplateIds);
   if (SkipToEOF)
     P->SkipUntil(tok::eof);
+  else
+    P->Tok = OldTok;
   PP.enableIncrementalProcessing(ResetIncrementalProcessing);
   if (!SemaDiagHadErrors) {
     // Doesn't reset the diagnostic mappings