Expand description
Abstract syntax tree for bash commands.
All AST nodes borrow from the input string (&'a str) — zero-copy.
The parser produces a Vec<Cmd<'a>> representing the top-level command list.
Structs§
- AndOr
List - A chain of commands connected by
&&and||. - CaseArm
- A single arm in a
casestatement. - Compound
Cmd - A compound command with optional trailing redirections.
- Guard
Body - A guard (condition) and body pair, used by
while,until, andif. - Simple
Cmd - A simple command with optional prefix assignments and suffix words/redirects.
Enums§
- AndOr
- A single
&&or||link in an and-or chain. - Arith
- An arithmetic expression node (used in
$(( )),(( )), and C-style for). - Atom
- An atomic element within a word: literal text, expansion, or glob.
- Cmd
- A complete command — foreground or background.
- CmdPrefix
- A prefix element: variable assignment or redirection.
- CmdSuffix
- A suffix element: argument word or redirection.
- Compound
Kind - The body of a compound command.
- Executable
- An executable unit: simple command, compound command, or function definition.
- Heredoc
Body - The body of a heredoc (here-document).
- Param
- A shell parameter reference.
- Pipeline
- A pipeline: one or more commands connected by
|. - Redir
- An I/O redirection.
- Subst
- A substitution or parameter expansion.
- Word
- A shell word: either a single part or a concatenation of parts.
- Word
Part - A fragment of a word: bare text, quoted text, or a substitution.