Skip to main content

Module parser

Module parser 

Source
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§

ArithmeticForCommand
C-style arithmetic for loop: for ((init; cond; step)); do body; done
Assignment
Variable assignment.
CaseCommand
Case statement.
CaseItem
A single case item.
CommandList
A list of commands with operators.
ForCommand
For loop.
FunctionDef
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.
SimpleCommand
A simple command with arguments and redirections.
Span
A span of source code (start to end position).
SpannedToken
A token with its source location span.
TimeCommand
Time command - wraps a command and measures its execution time.
UntilCommand
Until loop.
WhileCommand
While loop.
Word
A word (potentially with expansions).

Enums§

AssignmentValue
Value in an assignment - scalar or array
Command
A single command in the script.
CompoundCommand
Compound commands (control structures).
ListOperator
Operators for command lists.
ParameterOp
Parameter expansion operators
RedirectKind
Types of redirections.
WordPart
Parts of a word.