Merge nucleic/clever-quartz-marten-uqnx into dev

This commit is contained in:
2026-07-18 21:19:16 -07:00
parent 109cab4cc7
commit a0c3e601be
4 changed files with 61 additions and 22 deletions
+21
View File
@@ -49,3 +49,24 @@ pub struct InteractivePrompt {
/// Prompt to display on a continuation line of input.
pub continuation_prompt: String,
}
/// Returns whether a parser result represents a complete command that can be
/// executed, as opposed to a command that needs more physical input lines.
pub(crate) fn parse_result_is_complete(
result: &Result<brush_parser::ast::Program, brush_parser::ParseError>,
) -> bool {
match result {
// Unclosed quotes and similar tokenizer states need another line.
Err(brush_parser::ParseError::Tokenizing { inner, position: _ })
if inner.is_incomplete() =>
{
false
}
// An otherwise-valid compound command may simply be missing its
// closing token (`fi`, `done`, `}`, ...).
Err(brush_parser::ParseError::ParsingAtEndOfInput) => false,
// A located syntax error is complete input and should be surfaced.
// A successful parse is ready to execute.
_ => true,
}
}