Fix: mappings

This commit is contained in:
2026-05-19 09:46:24 +02:00
parent 69e5ab2a5e
commit 3620f0432a
3 changed files with 4 additions and 16 deletions
+1 -3
View File
@@ -2,9 +2,7 @@ WHITESPACE = _{ " " | "\t" | "\r" | "\n" }
integer = @{ ASCII_DIGIT+ } integer = @{ ASCII_DIGIT+ }
next_line = { "+" } map = { "/*" ~ integer ~ ":" ~ integer ~ "*/" }
map = { "/*" ~ integer ~ ":" ~ integer ~ next_line? ~ "*/" }
non_map = { (!map ~ ANY)+ } non_map = { (!map ~ ANY)+ }
+1 -11
View File
@@ -32,17 +32,7 @@ pub fn get_mapping(input: &str) -> HashSet<(RustMap, MistMap)> {
inner.next().unwrap().as_str().parse().unwrap(), inner.next().unwrap().as_str().parse().unwrap(),
); );
mapping.insert(( mapping.insert((RustMap(rs.0, rs.1), MistMap(line, col)));
RustMap(rs.0, rs.1),
MistMap(
if inner.next().is_some() {
line
} else {
line - 1
},
col,
),
));
} }
} }
+2 -2
View File
@@ -131,7 +131,7 @@ pub fn print_diagnostics(diagnostics: &Vec<MistDiagnostic>) {
println!( println!(
"\n{}:{}:{}\n \x1b[31mError\x1b[0m: {}\n\t{}", "\n{}:{}:{}\n \x1b[31mError\x1b[0m: {}\n\t{}",
msg.file_name, msg.file_name,
msg.line + 1, msg.line,
msg.column, msg.column,
msg.message, msg.message,
line.unwrap_or_default(), line.unwrap_or_default(),
@@ -144,7 +144,7 @@ pub fn print_diagnostics(diagnostics: &Vec<MistDiagnostic>) {
println!( println!(
"\n{}:{}:{}\n \x1b[33mWarning\x1b[0m: {}\n\t{}", "\n{}:{}:{}\n \x1b[33mWarning\x1b[0m: {}\n\t{}",
msg.file_name, msg.file_name,
msg.line + 1, msg.line,
msg.column, msg.column,
msg.message, msg.message,
line.unwrap_or_default(), line.unwrap_or_default(),