summaryrefslogtreecommitdiff
path: root/src/semantic_token.rs
blob: cac82a95d5ffb08dcdd6c79859e433ee8a8af3fa (plain) (blame)
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
use crate::*;

pub enum SemanticTokenType {
    LabelReference(usize),
    MacroReference(usize),

    LabelDefinition(LabelDefinition),
    MacroDefinition(MacroDefinition),

    Pad(u16),
    Byte(u8),
    Short(u16),
    Instruction(u8),

    MacroTerminator,
    Comment,
    Error(SyntacticTokenType, Error),
}

pub struct SemanticToken {
    pub r#type: SemanticTokenType,
    pub source_location: SourceLocation,
    pub bytecode_location: BytecodeLocation,
}

pub struct LabelDefinition {
    pub name: String,
    pub address: u16,
    /// A list of pointers to label reference tokens
    pub references: Vec<usize>,
}
pub struct MacroDefinition {
    pub name: String,
    pub body_tokens: Vec<SemanticToken>,
    /// A list of pointers to macro reference tokens
    pub references: Vec<usize>,
}