Add annotate_snippets for better parsing errors (#477)
Adds nicer errors for Podlang code, using the `annotate_snippets` crate, the same crate used by the Rust compiler to generate contextual errors. This prints a short snippet of the code containing the error within the error message, highlighting the part that needs to be fixed. It also includes a change to the `load_module` function, changing a `Vec` function argument to a slice.
This commit is contained in:
parent
acab26e5c1
commit
09d67de989
11 changed files with 612 additions and 40 deletions
|
|
@ -610,7 +610,7 @@ mod tests {
|
|||
r#"is_equal(X, Y) = AND(Equal(X["val"], Y["val"]))"#,
|
||||
"checks",
|
||||
¶ms,
|
||||
vec![],
|
||||
&[],
|
||||
)
|
||||
.unwrap(),
|
||||
);
|
||||
|
|
@ -621,7 +621,7 @@ mod tests {
|
|||
r#"is_less(X, Y) = AND(Lt(X["val"], Y["val"]))"#,
|
||||
"ordering",
|
||||
¶ms,
|
||||
vec![],
|
||||
&[],
|
||||
)
|
||||
.unwrap(),
|
||||
);
|
||||
|
|
@ -645,7 +645,7 @@ mod tests {
|
|||
),
|
||||
"combined",
|
||||
¶ms,
|
||||
vec![checks.clone(), ordering.clone()],
|
||||
&[checks.clone(), ordering.clone()],
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue