Add MetaProcessor::awaitingMoreInput()

`MetaProcessor::awaitingMoreInput()` returns whether the collected input is
incomplete, either because it contains unbalanced braces or we found a
backslash-newline (the last seen token is a `\`).

Part of a patch series to fix ROOT-5219.

Co-authored-by: Axel Naumann <Axel.Naumann@cern.ch>
This commit is contained in:
Javier Lopez-Gomez 2022-01-27 13:44:01 +01:00 committed by jenkins
parent 71cbd0a80e
commit 9ea7dd97e3
2 changed files with 10 additions and 0 deletions

View File

@ -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;

View File

@ -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();
}