From 58a29546fc56f3c250bfbf774f7889878c1a21a4 Mon Sep 17 00:00:00 2001 From: Ryan Jones-Ward Date: Tue, 16 Jul 2024 11:19:58 +0100 Subject: [PATCH] Finish the parsing of the declare byte statement, next will be some parsing tests for it. --- redox-core/src/parsing/asm_parser.rs | 11 ++++++++--- redox-terminal/src/main.rs | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/redox-core/src/parsing/asm_parser.rs b/redox-core/src/parsing/asm_parser.rs index 7a83d73..b0c5b2d 100644 --- a/redox-core/src/parsing/asm_parser.rs +++ b/redox-core/src/parsing/asm_parser.rs @@ -466,8 +466,7 @@ impl<'a> AsmParser<'a> { } println!("label = {label}, declaration_type = {declaration_type:?}, storage = {storage:?}"); - - println!("{:?}", String::from_utf8(storage)); + //println!("{:?}", String::from_utf8(storage)); } /// Parse a section line of an ASM file. @@ -821,7 +820,13 @@ impl<'a> AsmParser<'a> { return; } - println!("argument: {}", arg); + // Are we handling a byte literal? + if let Ok(val) = AsmParser::try_parse_u8_immediate(arg) { + bytes.push(val); + return; + } + + panic!("invalid syntax - unrecognized byte declaration - {arg}"); } /// Try to parse an expression. diff --git a/redox-terminal/src/main.rs b/redox-terminal/src/main.rs index 9ac0edd..067a620 100644 --- a/redox-terminal/src/main.rs +++ b/redox-terminal/src/main.rs @@ -67,7 +67,7 @@ fn main() { } let code = "section .data - banana db \"apples\" + banana db \"apples\",0xff section .text push 0 call :LABEL_1