mxmlextrema_as3parser/tree/
xml_expression.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
use crate::ns::*;
use serde::{Serialize, Deserialize};

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct XmlExpression {
    pub location: Location,
    pub element: Rc<XmlElement>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct XmlMarkupExpression {
    pub location: Location,
    pub markup: String,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct XmlListExpression {
    pub location: Location,
    pub content: Vec<Rc<XmlContent>>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct XmlElement {
    pub location: Location,
    pub name: XmlTagName,
    pub attributes: Vec<Rc<XmlAttribute>>,
    pub attribute_expression: Option<Rc<Expression>>,
    pub content: Option<Vec<Rc<XmlContent>>>,
    pub closing_name: Option<XmlTagName>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum XmlTagName {
    Name((String, Location)),
    Expression(Rc<Expression>),
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct XmlAttribute {
    pub location: Location,
    pub name: (String, Location),
    pub value: XmlAttributeValue,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum XmlAttributeValue {
    Value((String, Location)),
    Expression(Rc<Expression>),
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum XmlContent {
    Characters((String, Location)),
    Markup((String, Location)),
    Element(Rc<XmlElement>),
    Expression(Rc<Expression>),
}