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

View file

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