summaryrefslogtreecommitdiff
path: root/src/semantic_token.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/semantic_token.rs')
-rw-r--r--src/semantic_token.rs38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/semantic_token.rs b/src/semantic_token.rs
new file mode 100644
index 0000000..cac82a9
--- /dev/null
+++ b/src/semantic_token.rs
@@ -0,0 +1,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>,
+}
+