Expand description
Abstract Syntax Tree types for kaish.
This module provides:
- AST type definitions (
typesmodule, re-exported at this level) - S-expression formatter for test snapshots (
sexprmodule) - The statement plan: an unexpanded rendering plus the commands a
statement would run (
planmodule)
Modules§
- plan
- The statement plan: an AST rendered back to shell text, unexpanded.
- sexpr
- S-expression formatter for kaish AST.
Structs§
- Assignment
- Variable assignment:
NAME=value(bash-style),local NAME = value(scoped), or a bracket-path lvalue (xs[0]=value,user[email]=value,services[web][port]=value). The path’s first segment is always the rootFieldname; a bare assignment is a one-segment path. - Case
Branch - A single branch in a case statement.
- Case
Stmt - Case statement for pattern matching.
- Command
- A command invocation with arguments and redirections.
- ForLoop
- For loop over items.
- IfStmt
- Conditional statement.
- Param
Def - Parameter definition for a tool.
- Pipeline
- A pipeline of commands connected by pipes.
- Program
- A complete kaish program is a sequence of statements.
- Record
Entry - One
key: valueentry of a record literal. - Redirect
- I/O redirection.
- Spanned
Part - A
StringParttogether with its byte offset in the original source. - ToolDef
- User-defined tool.
- VarPath
- Variable reference path:
${VAR},${VAR[0]},${r[key]},${a[b][c]}. - While
Loop - While loop with condition.
Enums§
- Arg
- A command argument (positional or named).
- Binary
Op - Binary operators used to chain command/test conditions with
&&/||. - Expr
- An expression that evaluates to a value.
- File
Test Op - File test operators for
[[ ]]. - List
Elem - One element of a list literal.
- Param
Type - Parameter type annotation.
- Record
Key - A record literal key:
{name: amy}(bare),{"content-type": x}(quoted, for anything that is not a bareword), or{"$k": x}(double-quoted with interpolation — resolved at eval time like any double-quoted string; single quotes keep a literal$). Seedocs/LANGUAGE.md, “Construction — list/record literals”. - Redirect
Kind - Type of redirection.
- Stmt
- A single statement in kaish.
- String
Part - Part of an interpolated string.
- String
Test Op - String test operators for
[[ ]]. - Test
CmpOp - Comparison operators for
[[ ]]tests. - Test
Expr - Test expression for
[[ ... ]]conditionals. - Value
- A literal value.
- VarSegment
- A segment in a variable path.
Functions§
- spread_
non_ list_ message - Full teaching message for a non-list spread: “
[...$scalar]” — the operand must be a list; spread only flattens a list’s elements into the new one. - spread_
value_ kind - Human-readable value-kind name for a spread (
[...expr]) operand that turned out not to be a list. Shared between the sync (interpreter/eval.rs) and async (kernel.rs::eval_expr_async) literal evaluators so the two paths can’t diverge on wording (same convention asStringTestOp::matches_shape).