Struct conch_parser::ast::builder::EmptyBuilder
[−]
[src]
pub struct EmptyBuilder;
A no-op Builder which ignores all inputs and always returns ().
Useful for validation of correct programs (i.e. parsing input without caring about the actual AST representations).
Methods
impl EmptyBuilder[src]
fn new() -> Self
Constructs a builder.
Trait Implementations
impl Debug for EmptyBuilder[src]
impl Copy for EmptyBuilder[src]
impl Clone for EmptyBuilder[src]
fn clone(&self) -> EmptyBuilder
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0
Performs copy-assignment from source. Read more
impl Default for EmptyBuilder[src]
impl Builder for EmptyBuilder[src]
type Command = ()
The type which represents a complete, top-level command.
type CommandList = ()
The type which represents an and/or list of commands.
type ListableCommand = ()
The type which represents a command that can be used in an and/or command list.
type PipeableCommand = ()
The type which represents a command that can be used in a pipeline.
type CompoundCommand = ()
The type which represents compound commands like if, case, for, etc.
type Word = ()
The type which represents shell words, which can be command names or arguments.
type Redirect = ()
The type which represents a file descriptor redirection.
type Error = Void
A type for returning custom parse/build errors.
fn complete_command(
&mut self,
_pre_cmd_comments: Vec<Newline>,
_cmd: Self::Command,
_separator: SeparatorKind,
_cmd_comment: Option<Newline>
) -> Result<Self::Command, Self::Error>
&mut self,
_pre_cmd_comments: Vec<Newline>,
_cmd: Self::Command,
_separator: SeparatorKind,
_cmd_comment: Option<Newline>
) -> Result<Self::Command, Self::Error>
Invoked once a complete command is found. That is, a command delimited by a newline, semicolon, ampersand, or the end of input. Read more
fn and_or_list(
&mut self,
_first: Self::ListableCommand,
_rest: Vec<(Vec<Newline>, AndOr<Self::ListableCommand>)>
) -> Result<Self::CommandList, Self::Error>
&mut self,
_first: Self::ListableCommand,
_rest: Vec<(Vec<Newline>, AndOr<Self::ListableCommand>)>
) -> Result<Self::CommandList, Self::Error>
Invoked when multiple commands are parsed which are separated by && or ||. Typically after the first command is run, each of the following commands may or may not be executed, depending on the exit status of the previously executed command. Read more
fn pipeline(
&mut self,
_bang: bool,
_cmds: Vec<(Vec<Newline>, Self::Command)>
) -> Result<Self::Command, Self::Error>
&mut self,
_bang: bool,
_cmds: Vec<(Vec<Newline>, Self::Command)>
) -> Result<Self::Command, Self::Error>
Invoked when a pipeline of commands is parsed. A pipeline is one or more commands where the standard output of the previous typically becomes the standard input of the next. Read more
fn simple_command(
&mut self,
_redirects_or_env_vars: Vec<RedirectOrEnvVar<Self::Redirect, String, Self::Word>>,
_redirects_or_cmd_words: Vec<RedirectOrCmdWord<Self::Redirect, Self::Word>>
) -> Result<Self::PipeableCommand, Self::Error>
&mut self,
_redirects_or_env_vars: Vec<RedirectOrEnvVar<Self::Redirect, String, Self::Word>>,
_redirects_or_cmd_words: Vec<RedirectOrCmdWord<Self::Redirect, Self::Word>>
) -> Result<Self::PipeableCommand, Self::Error>
Invoked when the "simplest" possible command is parsed: an executable with arguments. Read more
fn brace_group(
&mut self,
_cmds: CommandGroup<Self::Command>,
_redirects: Vec<Self::Redirect>
) -> Result<Self::Command, Self::Error>
&mut self,
_cmds: CommandGroup<Self::Command>,
_redirects: Vec<Self::Redirect>
) -> Result<Self::Command, Self::Error>
Invoked when a non-zero number of commands were parsed between balanced curly braces. Typically these commands should run within the current shell environment. Read more
fn subshell(
&mut self,
_cmds: CommandGroup<Self::Command>,
_redirects: Vec<Self::Redirect>
) -> Result<Self::Command, Self::Error>
&mut self,
_cmds: CommandGroup<Self::Command>,
_redirects: Vec<Self::Redirect>
) -> Result<Self::Command, Self::Error>
Invoked when a non-zero number of commands were parsed between balanced parentheses. Typically these commands should run within their own environment without affecting the shell's global environment. Read more
fn loop_command(
&mut self,
__kind: LoopKind,
__guard_body_pair: GuardBodyPairGroup<Self::Command>,
__redirects: Vec<Self::Redirect>
) -> Result<Self::CompoundCommand, Self::Error>
&mut self,
__kind: LoopKind,
__guard_body_pair: GuardBodyPairGroup<Self::Command>,
__redirects: Vec<Self::Redirect>
) -> Result<Self::CompoundCommand, Self::Error>
Invoked when a loop command like while or until is parsed. Typically these commands will execute their body based on the exit status of their guard. Read more
fn if_command(
&mut self,
_fragments: IfFragments<Self::Command>,
_redirects: Vec<Self::Redirect>
) -> Result<Self::Command, Self::Error>
&mut self,
_fragments: IfFragments<Self::Command>,
_redirects: Vec<Self::Redirect>
) -> Result<Self::Command, Self::Error>
Invoked when an if conditional command is parsed. Typically an if command is made up of one or more guard-body pairs, where the body of the first successful corresponding guard is executed. There can also be an optional else part to be run if no guard is successful. Read more
fn for_command(
&mut self,
_fragments: ForFragments<Self::Word, Self::Command>,
_redirects: Vec<Self::Redirect>
) -> Result<Self::Command, Self::Error>
&mut self,
_fragments: ForFragments<Self::Word, Self::Command>,
_redirects: Vec<Self::Redirect>
) -> Result<Self::Command, Self::Error>
Invoked when a for command is parsed. Typically a for command binds a variable to each member in a group of words and invokes its body with that variable present in the environment. If no words are specified, the command will iterate over the arguments to the script or enclosing function. Read more
fn case_command(
&mut self,
_fragments: CaseFragments<Self::Word, Self::Command>,
_redirects: Vec<Self::Redirect>
) -> Result<Self::Command, Self::Error>
&mut self,
_fragments: CaseFragments<Self::Word, Self::Command>,
_redirects: Vec<Self::Redirect>
) -> Result<Self::Command, Self::Error>
Invoked when a case command is parsed. Typically this command will execute certain commands when a given word matches a pattern. Read more
fn function_declaration(
&mut self,
_name: String,
_post_name_comments: Vec<Newline>,
_body: Self::CompoundCommand
) -> Result<Self::Command, Self::Error>
&mut self,
_name: String,
_post_name_comments: Vec<Newline>,
_body: Self::CompoundCommand
) -> Result<Self::Command, Self::Error>
Invoked when a function declaration is parsed. Typically a function declaration overwrites any previously defined function within the current environment. Read more
fn comments(&mut self, _comments: Vec<Newline>) -> Result<(), Self::Error>
Invoked when only comments are parsed with no commands following. This can occur if an entire shell script is commented out or if there are comments present at the end of the script. Read more
fn word(
&mut self,
_kind: ComplexWordKind<Self::Command>
) -> Result<Self::Word, Self::Error>
&mut self,
_kind: ComplexWordKind<Self::Command>
) -> Result<Self::Word, Self::Error>
Invoked when a word is parsed. Read more
fn redirect(
&mut self,
_kind: RedirectKind<Self::Word>
) -> Result<Self::Redirect, Self::Error>
&mut self,
_kind: RedirectKind<Self::Word>
) -> Result<Self::Redirect, Self::Error>
Invoked when a redirect is parsed. Read more
fn compound_command_into_pipeable(
&mut self,
_cmd: Self::CompoundCommand
) -> Result<Self::PipeableCommand, Self::Error>
&mut self,
_cmd: Self::CompoundCommand
) -> Result<Self::PipeableCommand, Self::Error>
Bridges the gap between a PipeableCommand and a CompoundCommand since CompoundCommands are typically PipeableCommands as well. Read more