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
Builderimplementation which builds shell commands using the (atomic) AST definitions in theastmodule. - CaseArm
- An individual “unit of execution” within a
casecommand. - Case
Fragments - Parsed fragments relating to a shell
casecommand. - Case
Pattern Fragments - Parsed fragments relating to patterns in a shell
casecommand. - Command
Group - A grouping of a list of commands and any comments trailing after the commands.
- Core
Builder - The actual provided
Builderimplementation. The various type parameters are used to swap out atomic/non-atomic AST versions. - Default
Builder - A
Builderimplementation which builds shell commands using the (non-atomic) AST definitions in theastmodule. - Empty
Builder - A no-op
Builderwhich ignores all inputs and always returns(). - ForFragments
- Parsed fragments relating to a shell
forcommand. - Guard
Body Pair Group - A grouping of guard and body commands, and any comments they may have.
- IfFragments
- Parsed fragments relating to a shell
ifcommand. - 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
whileoruntilcommand 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
parsemodule 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
DefaultBuilderimplementation which usesArc<String>s when representing shell words. - RcBuilder
- A
DefaultBuilderimplementation which usesRc<String>s when representing shell words. - String
Builder - A
DefaultBuilderimplementation which uses regularStrings when representing shell words.