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
use super::*;

impl Display for IdentifierNode {
    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
        f.write_str(&self.name)
    }
}

impl Display for NamePathNode {
    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
        for (idx, item) in self.names.iter().enumerate() {
            if idx != 0 {
                f.write_str("∷")?;
            }
            Display::fmt(item, f)?;
        }
        Ok(())
    }
}

impl Display for MacroKind {
    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
        match self {
            MacroKind::Normal => f.write_str("@"),
            MacroKind::Environment => f.write_str("@@"),
            MacroKind::Dict => f.write_str("@!"),
        }
    }
}

impl Display for MacroPathNode {
    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
        Display::fmt(&self.path, f)?;
        for item in &self.names {
            f.write_str(".")?;
            Display::fmt(item, f)?;
        }
        Ok(())
    }
}