Skip to main content

detect_repl_continuation_mode

Function detect_repl_continuation_mode 

Source
pub fn detect_repl_continuation_mode(source: &str) -> ReplContinuationMode
Available on crate features code and embedded-python only.
Expand description

Detects whether REPL source is complete or needs more input.

This mirrors CPython’s broad interactive behavior:

  • Incomplete bracketed / parenthesized / triple-quoted constructs continue.
  • Clause headers (if:, def:, etc.) require an indented body and then a terminating blank line before execution.
  • All other parse outcomes are treated as complete (either valid code or a syntax error that should be shown immediately).