Expand description
Defines an interfaces to receive parse data and construct ASTs.
This allows the parser to remain agnostic of the required source representation, and frees up the library user to substitute their own. If one does not require a custom AST representation, this module offers a reasonable default builder implementation.
If a custom AST representation is required you will need to implement
the Builder
trait for your AST. Otherwise you can provide the DefaultBuilder
struct to the parser if you wish to use the default AST implementation.
Structs§
- Atomic
Default Builder - A
Builder
implementation which builds shell commands using the (atomic) AST definitions in theast
module. - CaseArm
- An individual “unit of execution” within a
case
command. - Case
Fragments - Parsed fragments relating to a shell
case
command. - Case
Pattern Fragments - Parsed fragments relating to patterns in a shell
case
command. - Command
Group - A grouping of a list of commands and any comments trailing after the commands.
- Core
Builder - The actual provided
Builder
implementation. The various type parameters are used to swap out atomic/non-atomic AST versions. - Default
Builder - A
Builder
implementation which builds shell commands using the (non-atomic) AST definitions in theast
module. - Empty
Builder - A no-op
Builder
which ignores all inputs and always returns()
. - ForFragments
- Parsed fragments relating to a shell
for
command. - Guard
Body Pair Group - A grouping of guard and body commands, and any comments they may have.
- IfFragments
- Parsed fragments relating to a shell
if
command. - Newline
- Represents a parsed newline, more specifically, the presense of a comment immediately preceeding the newline.
Enums§
- Complex
Word Kind - An indicator to the builder what kind of complex word was parsed.
- Loop
Kind - An indicator to the builder whether a
while
oruntil
command was parsed. - Parameter
Substitution Kind - Represents the type of parameter that was parsed
- Redirect
Kind - Represents redirecting a command’s file descriptors.
- Separator
Kind - An indicator to the builder of how complete commands are separated.
- Simple
Word Kind - An indicator to the builder what kind of simple word was parsed.
- Word
Kind - An indicator to the builder what kind of word was parsed.
Traits§
- Builder
- A trait which defines an interface which the parser defined in the
parse
module uses to delegate Abstract Syntax Tree creation. The methods defined here correspond to their respectively named methods on the parser, and accept the relevant data for each shell command type.
Type Aliases§
- ArcBuilder
- A
DefaultBuilder
implementation which usesArc<String>
s when representing shell words. - RcBuilder
- A
DefaultBuilder
implementation which usesRc<String>
s when representing shell words. - String
Builder - A
DefaultBuilder
implementation which uses regularString
s when representing shell words.