use super::{AstNodeId, SourceSpan};
#[derive(Debug, Clone)]
pub struct ExprNode {
pub items: Vec<AstNodeId>,
pub span: SourceSpan,
}
impl ExprNode {
pub fn single(id: AstNodeId, span: SourceSpan) -> Self {
Self {
items: vec![id],
span,
}
}
pub fn sequence(items: Vec<AstNodeId>, span: SourceSpan) -> Self {
Self { items, span }
}
pub fn append(&mut self, id: AstNodeId, end: usize) {
self.items.push(id);
self.span.end = end;
}
}
#[derive(Debug, Clone)]
pub enum ValueNode {
Empty,
String(String),
Boolean(bool),
Integer(String),
Decimal(String),
Double(String),
Typed(crate::types::value::XmlValue),
}
#[derive(Debug, Clone)]
pub struct ContextItemNode {
pub span: SourceSpan,
}
impl ContextItemNode {
pub fn new(span: SourceSpan) -> Self {
Self { span }
}
}
#[derive(Debug, Clone)]
pub struct VarRefNode {
pub prefix: String,
pub local_name: String,
pub slot: Option<u32>,
pub span: SourceSpan,
}
impl VarRefNode {
pub fn new(prefix: String, local_name: String, span: SourceSpan) -> Self {
Self {
prefix,
local_name,
slot: None,
span,
}
}
}