Skip to main content

efx_core/ast/
nodes.rs

1use crate::ast::span_range::SpanRange;
2
3/// AST Mini-XML Nodes
4#[derive(Debug, Clone)]
5pub enum Node {
6    /// Element: <name attr="...">children...</name> или <name .../>
7    Element(Element),
8    /// Text node (after normalizing escapes {{ → {, }} → })
9    Text(Text),
10    /// Interpolation of a Rust expression from curly braces: { expr }
11    I11n(Interpolation),
12}
13
14#[derive(Debug, Clone)]
15pub struct Element {
16    pub name: String,
17    pub attrs: Vec<Attr>,
18    pub children: Vec<Node>,
19    pub span: SpanRange,
20}
21
22#[derive(Debug, Clone)]
23pub struct Attr {
24    pub name: String,
25    pub value: String,
26    pub span: SpanRange,
27}
28
29#[derive(Debug, Clone)]
30pub struct Text {
31    pub value: String,
32    pub span: SpanRange,
33}
34
35#[derive(Debug, Clone)]
36pub struct Interpolation {
37    /// Raw expression fragment
38    pub expr_src: String,
39    pub span: SpanRange,
40}