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
use derive_more::From;

use crate::code_point::CodePoint;
use crate::structure::Located;
use crate::structure::rlt::new_types::{Identifier, TypeName};

#[derive(Debug, Clone, PartialEq, From)]
pub enum Term {
    Reference(Reference),
}

#[derive(Debug, Clone, PartialEq)]
pub enum Reference {
    Type(TypeName),
    Identifier(Identifier),
}

impl Located for Term {
    fn location(&self) -> CodePoint {
        match self {
            Term::Reference(x) => x.location(),
        }
    }
}

impl Located for Reference {
    fn location(&self) -> CodePoint {
        match self {
            Reference::Type(x) => x.location(),
            Reference::Identifier(x) => x.location(),
        }
    }
}