Skip to main content

Module repl

Module repl 

Source
Expand description

TUI REPL for rl, built on [ratatui] and [crossterm].

§Layout

|---------------------------------|
|  output area  (scrollable)      |
|  >> dec int x = 10              |
|  >> x + 1                       |
|  11                             |
|---------------------------------|
|  >> _  (input bar)              |
|---------------------------------|

§Key bindings

KeyAction
EnterSubmit / continue multiline
Ctrl+CExit
EscCancel multiline input
/ History navigation
Shift+↑/↓Scroll output
Ctrl+←/→Word jump
Home / EndLine start / end

Modules§

command_handler 🔒
REPL command dispatcher - handles all : prefixed commands.
depth_checker 🔒
Determines whether a multiline input block is complete and ready to evaluate.
input_eval 🔒
Evaluates a complete input string and appends results to the output buffer.
lines_types 🔒
Output line variants used by the REPL output buffer.
logic_loop 🔒
The main REPL event loop - input handling, rendering, and evaluation dispatch.
output_render 🔒
Converts the OutputLine buffer into ratatui [Line]s for rendering.
syntax_highlighting 🔒
Token-based syntax highlighting for the REPL input bar and output.
utils 🔒
Small shared utilities for the REPL.

Functions§

start_repl
Initializes the ratatui terminal, runs the REPL loop, and restores the terminal on exit. Prints any IO error to stderr.