35 lines
670 B
Rust
35 lines
670 B
Rust
use common::prelude::Register;
|
|
|
|
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
|
pub struct SymbolToken {
|
|
pub name: String,
|
|
}
|
|
|
|
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
|
pub struct LabelToken {
|
|
pub name: String,
|
|
}
|
|
|
|
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
|
pub struct DirectiveToken {
|
|
pub directive: String,
|
|
}
|
|
|
|
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
|
pub struct RegisterToken {
|
|
pub reg: Register,
|
|
}
|
|
|
|
impl RegisterToken {
|
|
#[must_use]
|
|
pub const fn new(reg: Register) -> Self {
|
|
Self { reg }
|
|
}
|
|
|
|
/// Returns the name of a valid [`Register`]
|
|
#[must_use]
|
|
pub fn name(&self) -> String {
|
|
self.reg.to_string()
|
|
}
|
|
}
|