|
spudplate
Template scaffolding compiler for spudlang .spud files
|
Production prompter: writes to a stream and reads a line from another. More...
#include <interpreter.h>
Public Member Functions | |
| StdinPrompter () | |
Default constructor: read from std::cin, write to std::cout, auto-detect colour support. | |
| StdinPrompter (std::istream &in, std::ostream &out, bool use_colour) | |
| Inject custom streams and explicit colour mode (test-only). | |
| std::string | prompt (const PromptRequest &req) override |
Display the prompt described by req and return the user's raw answer. | |
| bool | authorize (const std::string &summary) override |
| Display a security summary and return whether to proceed. | |
Production prompter: writes to a stream and reads a line from another.
Defaults to std::cin and std::cout with auto-detected colour support (suppressed when NO_COLOR is set or stdout is not a tty). The stream-injecting constructor exists for tests.
|
overridevirtual |
Display the prompt described by req and return the user's raw answer.
The interpreter parses the returned string, validates it against type and options, and on rejection calls back with previous_error set. Implementations deliver one raw line per call.
Implements spudplate::Prompter.
|
overridevirtual |
Display a security summary and return whether to proceed.
Called once, before any statement runs, when the program contains run clauses. The summary is multi-line and lists every literal command that may execute. Returning false aborts the run cleanly with no side effects.
Implements spudplate::Prompter.