Trait partiql_ast::ast::ToAstNode
source · [−]pub trait ToAstNode: Sized {
fn to_node(self) -> AstNodeBuilder<Self, BytePosition>
where
Self: Clone,
{ ... }
fn to_ast<Loc, IntoLoc>(self, location: IntoLoc) -> AstNode<Self, Loc>
where
Loc: Display,
IntoLoc: Into<Location<Loc>>,
{ ... }
fn ast(self, _: Range<ByteOffset>) -> AstNode<Self, BytePosition> { ... }
}
Expand description
Provides the required methods for AstNode conversations.
Provided Methods
fn to_node(self) -> AstNodeBuilder<Self, BytePosition> where
Self: Clone,
fn to_node(self) -> AstNodeBuilder<Self, BytePosition> where
Self: Clone,
Wraps the self
to an AstNode and returns an AstNodeBuilder
for
further AstNode construction.
Example:
use partiql_ast::ast;
use partiql_ast::ast::{SymbolPrimitive, ToAstNode};
use partiql_ast::ast::CaseSensitivity::CaseInsensitive;
use partiql_source_map::location::{ByteOffset, BytePosition, Location, ToLocated};
let p = SymbolPrimitive {
value: "symbol2".to_string(),
case: Some(ast::CaseSensitivity::CaseInsensitive)
};
let node = p
.to_node()
.location((BytePosition::from(12)..BytePosition::from(1)).into())
.build()
.expect("Could not retrieve ast node");