Skip to content

Commit df37f91

Browse files
committed
Fix error alignment for lrpar
1 parent 028a16b commit df37f91

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

lrpar/src/lib/ctbuilder.rs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -561,9 +561,12 @@ where
561561
let parsed_header = GrmtoolsSectionParser::new(&inc, false).parse();
562562
if let Err(errs) = parsed_header {
563563
let mut out = String::new();
564-
out.push_str(&yacc_diag.file_location_msg(" parsing the `%grmtools` section:", None));
564+
out.push_str(&format!(
565+
"\n{ERROR}{}\n",
566+
yacc_diag.file_location_msg(" parsing the `%grmtools` section", None)
567+
));
565568
for e in errs {
566-
out.push_str(&indent(&yacc_diag.format_error(e).to_string(), " "));
569+
out.push_str(&indent(&yacc_diag.format_error(e).to_string(), " "));
567570
}
568571
return Err(ErrorString(out))?;
569572
}
@@ -597,7 +600,7 @@ where
597600
Ok(_) if self.warnings_are_errors && !warnings.is_empty() => {
598601
let mut out = String::new();
599602
out.push_str(&format!(
600-
"{ERROR} {}",
603+
"\n{ERROR}{}\n",
601604
yacc_diag.file_location_msg("", None)
602605
));
603606
for e in warnings {
@@ -626,10 +629,13 @@ where
626629
grm
627630
}
628631
Err(errs) => {
629-
let mut out = String::from("\n");
630-
out.push_str(&indent(&yacc_diag.file_location_msg("", None), " "));
632+
let mut out = String::new();
633+
out.push_str(&format!(
634+
"\n{ERROR}{}\n",
635+
yacc_diag.file_location_msg("", None)
636+
));
631637
for e in errs {
632-
out.push_str(&indent(&yacc_diag.format_error(e).to_string(), " "));
638+
out.push_str(&indent(&yacc_diag.format_error(e).to_string(), " "));
633639
out.push('\n');
634640
}
635641

0 commit comments

Comments
 (0)