pub enum SyntaxNode {
NamedNode {
identifier: String,
starts_at: Position,
children: Vec<SyntaxNode>,
},
AnonymousNode {
starts_at: Position,
children: Vec<SyntaxNode>,
},
}
Expand description
Represents a node in an AST
Used to represent a template code for further evaluation.
Example:
(plus 1 2)
can be represented as:
AnonymousNode {
starts_at: 0,
children: vec![
NamedNode {
identifier: "plus".to_string(),
starts_at: 1,
children: vec![
NamedNode {
identifier: "1".to_string(),
starts_at: 6,
children: vec![],
},
NamedNode {
identifier: "2".to_string(),
starts_at: 8,
children: vec![],
},
],
},
]
};
Variants§
Implementations§
Source§impl SyntaxNode
impl SyntaxNode
pub fn is_anonymous(&self) -> bool
pub fn add_child(self, child: SyntaxNode) -> SyntaxNode
pub fn with_identifier( self, new_identifier: &str, identifier_starts_at: Position, ) -> SyntaxNode
Trait Implementations§
Source§impl Clone for SyntaxNode
impl Clone for SyntaxNode
Source§fn clone(&self) -> SyntaxNode
fn clone(&self) -> SyntaxNode
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 SyntaxNode
impl Debug for SyntaxNode
Source§impl Display for SyntaxNode
impl Display for SyntaxNode
Source§impl PartialEq for SyntaxNode
impl PartialEq for SyntaxNode
impl StructuralPartialEq for SyntaxNode
Auto Trait Implementations§
impl Freeze for SyntaxNode
impl RefUnwindSafe for SyntaxNode
impl Send for SyntaxNode
impl Sync for SyntaxNode
impl Unpin for SyntaxNode
impl UnwindSafe for SyntaxNode
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