diff --git a/include/cling/MetaProcessor/MetaProcessor.h b/include/cling/MetaProcessor/MetaProcessor.h index 1469e5ed..bdabee74 100644 --- a/include/cling/MetaProcessor/MetaProcessor.h +++ b/include/cling/MetaProcessor/MetaProcessor.h @@ -123,6 +123,11 @@ namespace cling { /// input, resetting the continuation to a new line. void cancelContinuation() const; + ///\brief Returns whether we are waiting for more input, either because the + /// input contains imbalanced braces or a backslash-newline was seen (i.e., + /// the last token was a `\`). + bool awaitingMoreInput() const; + ///\brief Returns the number of imbalanced tokens seen in the current input. /// int getExpectedIndent() const; diff --git a/lib/MetaProcessor/MetaProcessor.cpp b/lib/MetaProcessor/MetaProcessor.cpp index 13bf73da..7a030c8b 100644 --- a/lib/MetaProcessor/MetaProcessor.cpp +++ b/lib/MetaProcessor/MetaProcessor.cpp @@ -348,6 +348,11 @@ namespace cling { m_InputValidator->reset(); } + bool MetaProcessor::awaitingMoreInput() const { + return m_InputValidator->getLastResult() == + InputValidator::ValidationResult::kIncomplete; + } + int MetaProcessor::getExpectedIndent() const { return m_InputValidator->getExpectedIndent(); }