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
use crate::diag::location::{SourceLoc, SourceRange};

pub struct AttrList {
    pub attributes: Vec<Attribute>,

    pub sharp_loc: SourceLoc,
    pub exclaim_loc: SourceLoc,
    pub left_bracket_loc: SourceLoc,
    pub right_bracket_loc: SourceLoc
}

pub enum Attribute {
    ValueOnly(ValueOnlyAttr),
    KVPair(KeyValuePairAttr)
}

pub struct ValueOnlyAttr {
    pub value: AttrValue
}

pub struct KeyValuePairAttr {
    pub key: String,
    pub value: AttrValue,

    pub key_range: SourceRange
}

pub enum AttrValue {
    IntValue(AttrIntValue),
    IdentifierValue(AttrIdentifierValue),
    StrValue(AttrStrValue),
    List(AttrListValue)
}

pub struct AttrIntValue {
    pub value: i64,
    pub value_range: SourceRange
}

pub struct AttrIdentifierValue {
    pub value: String,
    pub value_range: SourceRange
}

pub struct AttrStrValue {
    pub value: String,
    pub value_range: SourceRange
}

pub struct AttrListValue {
    pub value: Vec<Attribute>,

    pub left_paren_loc: SourceLoc,
    pub right_paren_loc: SourceLoc
}