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
58
59
60
61
use crate::functions::SassFunction;
use crate::sass::{CallArgs, FormalArgs, SassString, Value};
use crate::selectors::Selectors;

/// Every sass file is a sequence of sass items.
/// Scoping items contains further sequences of items.
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
pub enum Item {
    Import(Value),
    VariableDeclaration {
        name: String,
        val: Value,
        default: bool,
        global: bool,
    },
    AtRoot {
        selectors: Selectors,
        body: Vec<Item>,
    },
    AtRule {
        name: String,
        args: Value,
        body: Option<Vec<Item>>,
    },

    MixinDeclaration {
        name: String,
        args: FormalArgs,
        body: Vec<Item>,
    },
    MixinCall {
        name: String,
        args: CallArgs,
        body: Vec<Item>,
    },
    Content,

    FunctionDeclaration {
        name: String,
        func: SassFunction,
    },
    Return(Value),

    IfStatement(Value, Vec<Item>, Vec<Item>),
    /// The value may be or evaluate to a list.
    Each(Vec<String>, Value, Vec<Item>),
    For {
        name: String,
        from: Box<Value>,
        to: Box<Value>,
        inclusive: bool,
        body: Vec<Item>,
    },
    While(Value, Vec<Item>),

    Rule(Selectors, Vec<Item>),
    NamespaceRule(String, Value, Vec<Item>),
    Property(SassString, Value),
    Comment(String),
    None,
}