assembler: use common to match registers

This commit is contained in:
2025-06-25 19:29:56 +01:00
parent d9807b5b36
commit 68e459f32b
4 changed files with 46 additions and 28 deletions
+10 -1
View File
@@ -1,3 +1,5 @@
use common::prelude::Register;
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct SymbolToken {
pub name: String,
@@ -15,7 +17,14 @@ pub struct DirectiveToken {
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct RegisterToken {
pub name: String,
pub reg: Register,
}
impl RegisterToken {
/// Returns the name of a valid [`Register`]
pub fn name(&self) -> String {
self.reg.to_string()
}
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]