Expand description
AST types for the wasmsh shell.
This crate defines the abstract syntax tree produced by the parser. Words remain structured (no premature stringification) so that expansion phases can operate on typed segments.
Structs§
- AndOr
List - A chain of pipelines joined by
&&or||. - Arith
Command Node - A
(( expr ))arithmetic command. - Arith
ForCommand - A C-style
for (( init; cond; step )) do body donecommand. - Assignment
- A variable assignment (
name=value). - Case
Command - A
case word in pattern) body ;; ... esaccommand. - Case
Item - A single
pattern) body ;;arm in a case statement. - Complete
Command - A complete command terminated by a newline or
;. - Double
Bracket Command - A
[[ expression ]]extended test command. - Elif
Clause - A single
elif condition; then bodyclause. - ForCommand
- A
for name in words; do body; donecommand. - Function
Def - A function definition:
name() bodyorfunction name body. - Group
Command - A brace group
{ compound_list ; }. - Here
DocBody - The body of a here-document.
- IfCommand
- An
if/elif/else/ficommand. - Pipeline
- A pipeline of one or more commands connected by
|. - Program
- A complete shell program (list of commands).
- Redirection
- A redirection (
>,<,>>,<<, etc.). - Select
Command - A
select name [in word ...]; do body; donecommand. - Simple
Command - A simple command: optional assignments, words (argv), and redirections.
- Span
- A span marking the byte range of a syntax element in source.
- Subshell
Command - A subshell command
( compound_list ). - Until
Command - An
until condition; do body; donecommand. - While
Command - A
while condition; do body; donecommand. - Word
- A structured word composed of parts that preserve quoting and expansion boundaries.
Enums§
- AndOrOp
&&or||operator.- Case
Terminator - Terminator for a case item arm.
- Command
- A single command in the AST.
- Redirection
Op - Redirection operator.
- Word
Part - A segment of a word — literals, quoted strings, expansions, etc.