mirror of
https://github.com/Noratrieb/dilaria.git
synced 2026-01-15 18:05:03 +01:00
print and more
This commit is contained in:
parent
ebbc675ffd
commit
9e643b8acd
9 changed files with 150 additions and 54 deletions
|
|
@ -75,18 +75,12 @@ where
|
|||
let mut chars = 0;
|
||||
let lines = source.split_inclusive('\n').enumerate();
|
||||
for (idx, line) in lines {
|
||||
if chars + line.len() + 1 > error.span().start {
|
||||
if chars + line.len() > error.span().start {
|
||||
let offset_on_line = error.span().start - chars;
|
||||
|
||||
println!("{}error: {}{}", RED, error.message(), RESET);
|
||||
println!(" {}|{}", CYAN, RESET);
|
||||
println!(
|
||||
"{}{:>5} |{} {}",
|
||||
CYAN,
|
||||
idx + 1,
|
||||
RESET,
|
||||
&line[..line.len() - 1]
|
||||
);
|
||||
println!("{}{:>5} |{} {}", CYAN, idx + 1, RESET, line);
|
||||
print!(" {}|{} ", CYAN, RESET);
|
||||
println!(
|
||||
"{}{}{}{}",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue