assembler: start refactoring/rewriting tokeniser

This commit is contained in:
2025-06-25 14:48:45 +01:00
parent 11a57eab51
commit 4e5db58a84
5 changed files with 74 additions and 30 deletions
+6
View File
@@ -59,12 +59,18 @@ pub enum AssembleErrorKind {
IO(std::io::Error),
/// Errors emitted from the [`Tokeniser`].
Tokenise(TokeniserError),
/// Returned for code where the functionality has not yet been implemented but we
/// don't want the program to panic.
Unimplemented(String),
}
impl Display for AssembleErrorKind {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::Tokenise(why) => write!(f, "tokeniser error: {why}"),
Self::Unimplemented(why) => write!(f, "used unimplemented feature: {why}"),
Self::IO(why) => write!(f, "problem occurred with I/O: {why}"),
#[expect(unreachable_patterns)]
_ => write!(
f,
"unhandled error type in Display implementation! See error.rs!"