Skip to main content

Module ast

Module ast 

Source
Expand description

Abstract Syntax Tree types for kaish.

This module provides:

  • AST type definitions (types module, re-exported at this level)
  • S-expression formatter for test snapshots (sexpr module)
  • The statement plan: an unexpanded rendering plus the commands a statement would run (plan module)

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 root Field name; a bare assignment is a one-segment path.
CaseBranch
A single branch in a case statement.
CaseStmt
Case statement for pattern matching.
Command
A command invocation with arguments and redirections.
ForLoop
For loop over items.
IfStmt
Conditional statement.
ParamDef
Parameter definition for a tool.
Pipeline
A pipeline of commands connected by pipes.
Program
A complete kaish program is a sequence of statements.
RecordEntry
One key: value entry of a record literal.
Redirect
I/O redirection.
SpannedPart
A StringPart together with its byte offset in the original source.
ToolDef
User-defined tool.
VarPath
Variable reference path: ${VAR}, ${VAR[0]}, ${r[key]}, ${a[b][c]}.
WhileLoop
While loop with condition.

Enums§

Arg
A command argument (positional or named).
BinaryOp
Binary operators used to chain command/test conditions with && / ||.
Expr
An expression that evaluates to a value.
FileTestOp
File test operators for [[ ]].
ListElem
One element of a list literal.
ParamType
Parameter type annotation.
RecordKey
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 $). See docs/LANGUAGE.md, “Construction — list/record literals”.
RedirectKind
Type of redirection.
Stmt
A single statement in kaish.
StringPart
Part of an interpolated string.
StringTestOp
String test operators for [[ ]].
TestCmpOp
Comparison operators for [[ ]] tests.
TestExpr
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 as StringTestOp::matches_shape).