Expand description
Parser module - exposed for fuzzing and testing Parser module for Bashkit
Implements a recursive descent parser for bash scripts.
§Design Notes
Reserved words (like done, fi, then) are only treated as special in command
position - when they would start a command. In argument position, they are regular
words. The termination of compound commands is handled by parse_compound_list_until
which checks for terminators BEFORE parsing each command.
Structs§
- Arithmetic
ForCommand - C-style arithmetic for loop: for ((init; cond; step)); do body; done
- Assignment
- Variable assignment.
- Case
Command - Case statement.
- Case
Item - A single case item.
- Command
List - A list of commands with operators.
- ForCommand
- For loop.
- Function
Def - Function definition.
- IfCommand
- If statement.
- Lexer
- Lexer for bash scripts.
- Parser
- Parser for bash scripts.
- Pipeline
- A pipeline of commands.
- Position
- A position in source code.
- Redirect
- I/O redirection.
- Script
- A complete bash script.
- Simple
Command - A simple command with arguments and redirections.
- Span
- A span of source code (start to end position).
- Spanned
Token - A token with its source location span.
- Time
Command - Time command - wraps a command and measures its execution time.
- Until
Command - Until loop.
- While
Command - While loop.
- Word
- A word (potentially with expansions).
Enums§
- Assignment
Value - Value in an assignment - scalar or array
- Command
- A single command in the script.
- Compound
Command - Compound commands (control structures).
- List
Operator - Operators for command lists.
- Parameter
Op - Parameter expansion operators
- Redirect
Kind - Types of redirections.
- Word
Part - Parts of a word.