forked from AbleOS/holey-bytes
sus
This commit is contained in:
parent
e1499fd5a1
commit
36f4d31fb2
|
@ -69,8 +69,8 @@ pub enum ErrorKind {
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct Error {
|
pub struct Error {
|
||||||
kind: ErrorKind,
|
pub kind: ErrorKind,
|
||||||
span: Span,
|
pub span: Span,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Display for Error {
|
impl Display for Error {
|
||||||
|
|
|
@ -8,7 +8,14 @@ fn main() -> Result<(), Box<dyn Error>> {
|
||||||
stdin().read_to_string(&mut code)?;
|
stdin().read_to_string(&mut code)?;
|
||||||
|
|
||||||
let mut buf = vec![];
|
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)?;
|
stdout().write_all(&buf)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue