pub struct EmptyBuilder;
Expand description
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).
Implementations§
Source§impl EmptyBuilder
impl EmptyBuilder
Trait Implementations§
Source§impl Builder for EmptyBuilder
impl Builder for EmptyBuilder
Source§type CommandList = ()
type CommandList = ()
The type which represents an and/or list of commands.
Source§type ListableCommand = ()
type ListableCommand = ()
The type which represents a command that can be used in an and/or command list.
Source§type PipeableCommand = ()
type PipeableCommand = ()
The type which represents a command that can be used in a pipeline.
Source§type CompoundCommand = ()
type CompoundCommand = ()
The type which represents compound commands like
if
, case
, for
, etc.Source§type Word = ()
type Word = ()
The type which represents shell words, which can be command names or arguments.
Source§fn complete_command(
&mut self,
_pre_cmd_comments: Vec<Newline>,
_cmd: Self::Command,
_separator: SeparatorKind,
_cmd_comment: Option<Newline>,
) -> Result<Self::Command, Self::Error>
fn complete_command( &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
Source§fn and_or_list(
&mut self,
_first: Self::ListableCommand,
_rest: Vec<(Vec<Newline>, AndOr<Self::ListableCommand>)>,
) -> Result<Self::CommandList, Self::Error>
fn and_or_list( &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 moreSource§fn pipeline(
&mut self,
_bang: bool,
_cmds: Vec<(Vec<Newline>, Self::Command)>,
) -> Result<Self::Command, Self::Error>
fn pipeline( &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
Source§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>
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>
Invoked when the “simplest” possible command is parsed: an executable with arguments. Read more
Source§fn brace_group(
&mut self,
_cmds: CommandGroup<Self::Command>,
_redirects: Vec<Self::Redirect>,
) -> Result<Self::Command, Self::Error>
fn brace_group( &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
Source§fn subshell(
&mut self,
_cmds: CommandGroup<Self::Command>,
_redirects: Vec<Self::Redirect>,
) -> Result<Self::Command, Self::Error>
fn subshell( &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
Source§fn loop_command(
&mut self,
__kind: LoopKind,
__guard_body_pair: GuardBodyPairGroup<Self::Command>,
__redirects: Vec<Self::Redirect>,
) -> Result<Self::CompoundCommand, Self::Error>
fn loop_command( &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 moreSource§fn if_command(
&mut self,
_fragments: IfFragments<Self::Command>,
_redirects: Vec<Self::Redirect>,
) -> Result<Self::Command, Self::Error>
fn if_command( &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 moreSource§fn for_command(
&mut self,
_fragments: ForFragments<Self::Word, Self::Command>,
_redirects: Vec<Self::Redirect>,
) -> Result<Self::Command, Self::Error>
fn for_command( &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 moreSource§fn case_command(
&mut self,
_fragments: CaseFragments<Self::Word, Self::Command>,
_redirects: Vec<Self::Redirect>,
) -> Result<Self::Command, Self::Error>
fn case_command( &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 moreSource§fn function_declaration(
&mut self,
_name: String,
_post_name_comments: Vec<Newline>,
_body: Self::CompoundCommand,
) -> Result<Self::Command, Self::Error>
fn function_declaration( &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
Source§fn comments(&mut self, _comments: Vec<Newline>) -> Result<(), Self::Error>
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
Source§fn word(
&mut self,
_kind: ComplexWordKind<Self::Command>,
) -> Result<Self::Word, Self::Error>
fn word( &mut self, _kind: ComplexWordKind<Self::Command>, ) -> Result<Self::Word, Self::Error>
Invoked when a word is parsed. Read more
Source§fn redirect(
&mut self,
_kind: RedirectKind<Self::Word>,
) -> Result<Self::Redirect, Self::Error>
fn redirect( &mut self, _kind: RedirectKind<Self::Word>, ) -> Result<Self::Redirect, Self::Error>
Invoked when a redirect is parsed. Read more
Source§fn compound_command_into_pipeable(
&mut self,
_cmd: Self::CompoundCommand,
) -> Result<Self::PipeableCommand, Self::Error>
fn compound_command_into_pipeable( &mut self, _cmd: Self::CompoundCommand, ) -> Result<Self::PipeableCommand, Self::Error>
Bridges the gap between a
PipeableCommand
and a CompoundCommand
since
CompoundCommand
s are typically PipeableCommand
s as well. Read moreSource§impl Clone for EmptyBuilder
impl Clone for EmptyBuilder
Source§fn clone(&self) -> EmptyBuilder
fn clone(&self) -> EmptyBuilder
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for EmptyBuilder
impl Debug for EmptyBuilder
Source§impl Default for EmptyBuilder
impl Default for EmptyBuilder
impl Copy for EmptyBuilder
Auto Trait Implementations§
impl Freeze for EmptyBuilder
impl RefUnwindSafe for EmptyBuilder
impl Send for EmptyBuilder
impl Sync for EmptyBuilder
impl Unpin for EmptyBuilder
impl UnwindSafe for EmptyBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more