Enum wagon_parser::parser::expression::Expression
source · pub enum Expression {
Subproc(SpannableNode<String>),
If {
this: SpannableNode<Disjunct>,
then: SpannableNode<Disjunct>,
else: Option<Box<SpannableNode<Expression>>>,
},
Disjunct(SpannableNode<Disjunct>),
}
Expand description
An expression in the WAGon attribute evaluation DSL.
§Grammar
Expression -> SubProc | If | Disjunct;
SubProc ->
"$(" /[^)]*/ ")"
; // A bash-style $() expression
If -> “if” Disjunct “then” Disjunct (“else” Expression)?;
Variants§
Subproc(SpannableNode<String>)
A subprocess that should do evaluation in the shell.
If
Fields
§
this: SpannableNode<Disjunct>
If this evaluation returns true.
§
then: SpannableNode<Disjunct>
Do this.
§
else: Option<Box<SpannableNode<Expression>>>
Else, evaluate this expression.
An if(-else) statement.
Disjunct(SpannableNode<Disjunct>)
The next layer down. See Disjunct
.
Implementations§
source§impl Expression
impl Expression
sourcepub fn new_unspanned_subproc(arg_0: String) -> Self
pub fn new_unspanned_subproc(arg_0: String) -> Self
Construct a Self::Subproc
with dummy span information.
sourcepub fn new_unspanned_disjunct(arg_0: Disjunct) -> Self
pub fn new_unspanned_disjunct(arg_0: Disjunct) -> Self
Construct a Self::Disjunct
with dummy span information.
Trait Implementations§
source§impl Clone for Expression
impl Clone for Expression
source§fn clone(&self) -> Expression
fn clone(&self) -> Expression
Returns a copy 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 Expression
impl Debug for Expression
source§impl Display for Expression
impl Display for Expression
source§impl Hash for Expression
impl Hash for Expression
source§impl Parse for Expression
impl Parse for Expression
source§fn parse(lexer: &mut LexerBridge<'_>) -> ParseResult<Self>
fn parse(lexer: &mut LexerBridge<'_>) -> ParseResult<Self>
Given a lexer, try to parse a valid instance of this node. Read more
source§fn parse_sep(
lexer: &mut LexerBridge<'_>,
join: Tokens
) -> ParseResult<Vec<Self>>where
Self: Sized,
fn parse_sep(
lexer: &mut LexerBridge<'_>,
join: Tokens
) -> ParseResult<Vec<Self>>where
Self: Sized,
source§fn parse_sep_end(
lexer: &mut LexerBridge<'_>,
join: Tokens,
end: Tokens
) -> ParseResult<Vec<Self>>where
Self: Sized,
fn parse_sep_end(
lexer: &mut LexerBridge<'_>,
join: Tokens,
end: Tokens
) -> ParseResult<Vec<Self>>where
Self: Sized,
source§impl PartialEq for Expression
impl PartialEq for Expression
source§fn eq(&self, other: &Expression) -> bool
fn eq(&self, other: &Expression) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl Eq for Expression
impl StructuralPartialEq for Expression
Auto Trait Implementations§
impl Freeze for Expression
impl RefUnwindSafe for Expression
impl Send for Expression
impl Sync for Expression
impl Unpin for Expression
impl UnwindSafe for Expression
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
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.source§impl<T> WrapSpannable<T, SpannableNode<T>> for Twhere
T: Parse,
impl<T> WrapSpannable<T, SpannableNode<T>> for Twhere
T: Parse,
source§fn wrap_spannable(self) -> SpannableNode<T>
fn wrap_spannable(self) -> SpannableNode<T>
Wrap dummy span information around the node.
source§fn into_spanned(self, span: Range<usize>) -> SpannableNode<T>
fn into_spanned(self, span: Range<usize>) -> SpannableNode<T>
Convert the node into a
SpannableNode
with the specified Span
.