Module conch_parser::ast::builder [] [src]

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

AtomicDefaultBuilder

A Builder implementation which builds shell commands using the (atomic) AST definitions in the ast module.

CaseArm

An individual "unit of execution" within a case command.

CaseFragments

Parsed fragments relating to a shell case command.

CasePatternFragments

Parsed fragments relating to patterns in a shell case command.

CommandGroup

A grouping of a list of commands and any comments trailing after the commands.

CoreBuilder

The actual provided Builder implementation. The various type parameters are used to swap out atomic/non-atomic AST versions.

DefaultBuilder

A Builder implementation which builds shell commands using the (non-atomic) AST definitions in the ast module.

EmptyBuilder

A no-op Builder which ignores all inputs and always returns ().

ForFragments

Parsed fragments relating to a shell for command.

GuardBodyPairGroup

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

ComplexWordKind

An indicator to the builder what kind of complex word was parsed.

LoopKind

An indicator to the builder whether a while or until command was parsed.

ParameterSubstitutionKind

Represents the type of parameter that was parsed

RedirectKind

Represents redirecting a command's file descriptors.

SeparatorKind

An indicator to the builder of how complete commands are separated.

SimpleWordKind

An indicator to the builder what kind of simple word was parsed.

WordKind

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 Definitions

ArcBuilder

A DefaultBuilder implementation which uses Arc<String>s when representing shell words.

RcBuilder

A DefaultBuilder implementation which uses Rc<String>s when representing shell words.

StringBuilder

A DefaultBuilder implementation which uses regular Strings when representing shell words.