Blank lines and line addressing

This commit is contained in:
2022-05-13 23:57:06 -05:00
parent 135dd6ad8d
commit 4edad9c0cc
2 changed files with 20 additions and 0 deletions
+14
View File
@@ -502,4 +502,18 @@ mod test {
])
);
}
#[test]
fn test_relative_blanks() {
assert_eq!(assemble_snippet(".org 0x400
nop $+2
nop 0x111111
nop 0x222222".lines()),
Ok(vec![
0x03, 0x08, 0x04, 0x00,
0x03, 0x11, 0x11, 0x11,
0x03, 0x22, 0x22, 0x22
]))
}
}
+6
View File
@@ -78,6 +78,12 @@ impl<'a, T: IntoIterator<Item = &'a str>, F: Fn(String) -> Result<T, AssembleErr
self.next()
}
// TODO: This makes line numbers on error messages wrong, but it's hard to fix. We need
// to rip out and redo the whole error system. Parse lines initially to tuples of their
// line and location (file and line number) and then pass one of those tuples to create
// an error.
Ok(VASMLine::Blank) => { self.next() }
Ok(normal_line) => Some(Ok(Line {
line: normal_line,
line_num: self.current_line,