From 82160af7af1a6dfa95694ce63118acf55f25705b Mon Sep 17 00:00:00 2001 From: Erin Date: Fri, 9 Jun 2023 13:33:17 +0200 Subject: [PATCH] fixed labels, added comments --- hbasm/src/lib.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hbasm/src/lib.rs b/hbasm/src/lib.rs index 67f6d2af..681fd765 100644 --- a/hbasm/src/lib.rs +++ b/hbasm/src/lib.rs @@ -14,6 +14,7 @@ macro_rules! tokendef { #[derive(Clone, Copy, Debug, PartialEq, Eq, Logos)] #[logos(extras = Rodeo)] #[logos(skip r"[ \t\f]+")] + #[logos(skip r"-- .*")] pub enum Token { $(#[token($opcode, |_| hbbytecode::opcode::[<$opcode:upper>])])* OpCode(u8), @@ -130,6 +131,7 @@ pub fn assembly(code: &str, buf: &mut Vec) -> Result<(), Error> { Some(Ok(Token::Label(lbl))) => { self.lblmap.insert(lbl, self.buf.len() as u64 + 1); } + Some(Ok(Token::ISep)) => (), Some(Ok(_)) => return Err(ErrorKind::UnexpectedToken), Some(Err(())) => return Err(ErrorKind::InvalidToken), None => return Ok(()),