pull/1/head
ondra05 2023-06-09 18:35:34 +02:00
parent 6e8cd398ba
commit a119376aa2
No known key found for this signature in database
GPG Key ID: 0DA6D2BB2285E881
2 changed files with 10 additions and 3 deletions

View File

@ -69,8 +69,8 @@ pub enum ErrorKind {
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct Error {
kind: ErrorKind,
span: Span,
pub kind: ErrorKind,
pub span: Span,
}
impl Display for Error {

View File

@ -8,7 +8,14 @@ fn main() -> Result<(), Box<dyn Error>> {
stdin().read_to_string(&mut code)?;
let mut buf = vec![];
hbasm::assembly(&code, &mut buf)?;
if let Err(e) = hbasm::assembly(&code, &mut buf) {
eprintln!(
"Error {:?} at {:?} (`{}`)",
e.kind,
e.span.clone(),
&code[e.span],
);
}
stdout().write_all(&buf)?;
Ok(())
}