spudplate
Template scaffolding compiler for spudlang .spud files
Loading...
Searching...
No Matches
spudplate::PromptRequest Struct Reference

Structured description of an ask prompt for the prompter to render. More...

#include <interpreter.h>

Public Attributes

std::string text
 The question text from the .spud source.
 
VarType type
 Expected answer type.
 
std::vector< std::string > options
 Stringified allowed answers; empty means any.
 
std::optional< std::string > default_value
 Stringified default; empty means required.
 
std::optional< std::string > previous_error
 Set on retry; describes why the prior answer was rejected.
 
int question_index {0}
 1-based position of this question among presented ones; 0 suppresses the counter.
 
int question_total {0}
 Total static ask statements in the program; 0 suppresses the counter.
 
int indent_level {0}
 Number of nested repeat blocks above this prompt; renders as 2 spaces per level.
 
std::vector< std::pair< std::int64_t, std::int64_t > > iterations
 One {current, total} pair per enclosing repeat block, outermost first. Empty outside any repeat.
 

Detailed Description

Structured description of an ask prompt for the prompter to render.

The interpreter populates this struct from an AskStmt and the live environment, then hands it to the prompter. Rendering - colour, layout, [Y/n] hints, numbered option menus, rejection feedback - is the prompter's responsibility.