pub enum BashNode {
Show 19 variants
Script {
shebang: Option<String>,
body: Vec<BashNode>,
},
Assignment {
name: String,
value: Box<BashNode>,
},
Command {
name: String,
args: Vec<BashNode>,
},
If {
condition: Box<BashNode>,
then_body: Vec<BashNode>,
else_body: Vec<BashNode>,
},
For {
var: String,
items: Vec<BashNode>,
body: Vec<BashNode>,
},
While {
condition: Box<BashNode>,
body: Vec<BashNode>,
},
Function {
name: String,
body: Vec<BashNode>,
},
Case {
value: Box<BashNode>,
patterns: Vec<(String, Vec<BashNode>)>,
},
Test {
double: bool,
expr: Box<BashNode>,
},
Compare {
left: Box<BashNode>,
op: BashCompareOp,
right: Box<BashNode>,
},
Arithmetic(Box<BashNode>),
ArithOp {
left: Box<BashNode>,
op: BashArithOp,
right: Box<BashNode>,
},
Variable(String),
StringLit(String),
IntLit(i64),
Array(Vec<BashNode>),
Pipe {
left: Box<BashNode>,
right: Box<BashNode>,
},
CommandSubst(Box<BashNode>),
Redirect {
command: Box<BashNode>,
redirect_type: RedirectType,
target: String,
},
}Expand description
Bash AST node types for generation
Variants§
Script
Script (root node with optional shebang)
Assignment
Variable assignment: name=value
Command
Command execution
If
If statement
Fields
For
For loop
Fields
While
While loop
Function
Function definition
Case
Case statement
Test
Test expression: [ expr ] or [[ expr ]]
Compare
Binary comparison: left op right
Fields
§
op: BashCompareOpComparison operator
Arithmetic(Box<BashNode>)
Arithmetic expression: $((expr))
ArithOp
Binary arithmetic operation
Variable(String)
Variable reference: $name or ${name}
StringLit(String)
String literal
IntLit(i64)
Integer literal
Array(Vec<BashNode>)
Array literal
Pipe
Pipe: cmd1 | cmd2
CommandSubst(Box<BashNode>)
Command substitution: $(cmd)
Redirect
Redirection
Implementations§
Trait Implementations§
impl StructuralPartialEq for BashNode
Auto Trait Implementations§
impl Freeze for BashNode
impl RefUnwindSafe for BashNode
impl Send for BashNode
impl Sync for BashNode
impl Unpin for BashNode
impl UnsafeUnpin for BashNode
impl UnwindSafe for BashNode
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more