66enum class Ns : uint8_t {
102enum class Op : uint8_t {
248ParseResult
parse(
const std::string& source);
259 std::map<std::string, std::string>
states;
276std::string
slugify(
const std::string& name);
const char * diag_name(Diag d)
constexpr uint32_t kMaxExprDepth
Ns
Which table a slug is resolved against.
std::string print_canonical(const ScriptProgram &program)
A stable s-expression rendering of the parsed program.
constexpr uint32_t kMaxLines
const char * op_name(Op op)
std::string slugify(const std::string &name)
Canonical name -> slug: trim, uppercase, collapse internal whitespace runs to a single '_'.
constexpr uint32_t kMaxVariables
constexpr uint32_t kMaxStatements
ParseResult parse(const std::string &source)
Lex and parse, applying every check that does not need config.
bool is_valid_slug(const std::string &slug)
True when a slug is usable as a bare identifier: ^[A-Z][A-Z0-9_]*$.
constexpr uint32_t kMaxNestingDepth
const char * ns_name(Ns ns)
constexpr uint32_t kMaxIndentUnit
Widest indent unit accepted.
std::vector< Diagnostic > validate(const ScriptProgram &program, const SlugTables &tables)
Config-dependent checks.
constexpr size_t kMaxSourceBytes
Motorized ball valve position: raw ADC counts -> % open.
std::string message
Human wording, including the offending text.
std::vector< Diagnostic > diagnostics
A parsed script, as a flat arena.
std::vector< Stmt > stmts
std::vector< Expr > exprs
std::vector< int32_t > block_items
Statement indices, grouped into contiguous [begin, end) block ranges.
std::vector< std::string > variables
std::vector< SlugRef > slugs
Every slug reference in SOURCE ORDER, with spans.
One slug reference, with its source span so a rename can rewrite exactly this token.
What a script's slugs are allowed to name, built from the loaded config.
std::set< std::string > allowed_transitions
State slugs reachable from the state that owns this script, per state_transitions....
std::map< std::string, std::string > actuators
std::map< std::string, std::string > sensors
std::map< std::string, std::string > states
int32_t body_begin
If/While body, and If's else arm: [begin, end) into ScriptProgram::block_items.
int32_t expr
Assign value, Delay seconds, If/While condition.
int32_t slug
OpenValve/CloseValve/TransitionTo target.
int32_t var
Assign: index into ScriptProgram::variables.
static SlugTables tables()
The tables every case validates against.