pub struct ParseArrayLiteral;Expand description
Parse array literal
It will parse 1,2,3,“5” as an array for powershell
§Example
use minusone::ps::build_powershell_tree;
use minusone::ps::forward::Forward;
use minusone::ps::integer::ParseInt;
use minusone::ps::linter::Linter;
use minusone::ps::string::ParseString;
use minusone::ps::access::AccessString;
use minusone::ps::join::JoinOperator;
use minusone::ps::array::ParseArrayLiteral;
let mut tree = build_powershell_tree("-join ('a','b','c')").unwrap();
tree.apply_mut(&mut (
ParseInt::default(),
Forward::default(),
ParseString::default(),
ParseArrayLiteral::default(),
JoinOperator::default()
)
).unwrap();
let mut ps_litter_view = Linter::new();
tree.apply(&mut ps_litter_view).unwrap();
assert_eq!(ps_litter_view.output, "\"abc\"");Trait Implementations§
Source§impl Default for ParseArrayLiteral
impl Default for ParseArrayLiteral
Source§fn default() -> ParseArrayLiteral
fn default() -> ParseArrayLiteral
Returns the “default value” for a type. Read more
Source§impl<'a> RuleMut<'a> for ParseArrayLiteral
impl<'a> RuleMut<'a> for ParseArrayLiteral
type Language = Powershell
fn enter( &mut self, _node: &mut NodeMut<'a, Self::Language>, _flow: ControlFlow, ) -> MinusOneResult<()>
fn leave( &mut self, node: &mut NodeMut<'a, Self::Language>, _flow: ControlFlow, ) -> MinusOneResult<()>
Auto Trait Implementations§
impl Freeze for ParseArrayLiteral
impl RefUnwindSafe for ParseArrayLiteral
impl Send for ParseArrayLiteral
impl Sync for ParseArrayLiteral
impl Unpin for ParseArrayLiteral
impl UnsafeUnpin for ParseArrayLiteral
impl UnwindSafe for ParseArrayLiteral
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