Changed position terminology

This commit is contained in:
Erin 2021-06-07 21:28:24 +02:00 committed by ondra05
parent 17a7f33c0b
commit beffef80c6
2 changed files with 7 additions and 6 deletions

View file

@ -1,5 +1,6 @@
#![forbid(unsafe_code)]
mod ast;
mod base_55;
mod brian;
mod error;
@ -48,8 +49,8 @@ fn main() {
println!(
"Error `{:?}` occurred at span: {:?} = `{:?}`",
e.kind,
e.position.clone(),
source.slice(e.position)
e.span.clone(),
source.slice(e.span)
);
}
}

View file

@ -25,15 +25,15 @@ pub fn repl() {
println!(
"Error `{:?}` occurred at span: {:?} = `{:?}`",
e.kind,
e.position.clone(),
line.slice(e.position.clone())
e.span.clone(),
line.slice(e.span.clone())
);
println!(" | {}", line);
println!(
" {}{}-- Here",
" ".repeat(e.position.start),
"^".repeat((e.position.end - e.position.start).max(1))
" ".repeat(e.span.start),
"^".repeat((e.span.end - e.span.start).max(1))
);
}
}