Basic 'use' syntax for importing custom predicates (#286)
* Basic 'use' syntax for importing custom predicates * Add extra test for unknown batches * Fix unused import * Enforce that imports must match number of predicates in a batch
This commit is contained in:
parent
f7bb6af219
commit
21ab3c2d0d
6 changed files with 499 additions and 136 deletions
|
|
@ -17,7 +17,7 @@ pub enum LangError {
|
|||
Frontend(Box<frontend::Error>),
|
||||
}
|
||||
|
||||
/// Errors that can occur during the processing of Podlog Pest tree into middleware structures.
|
||||
/// Errors that can occur during the processing of Podlang Pest tree into middleware structures.
|
||||
#[derive(thiserror::Error, Debug)]
|
||||
pub enum ProcessorError {
|
||||
#[error("Undefined identifier: '{name}' at {span:?}")]
|
||||
|
|
@ -71,6 +71,22 @@ pub enum ProcessorError {
|
|||
value: String,
|
||||
span: Option<(usize, usize)>,
|
||||
},
|
||||
#[error("Batch with ID '{id}' not found at {span:?}")]
|
||||
BatchNotFound {
|
||||
id: String,
|
||||
span: Option<(usize, usize)>,
|
||||
},
|
||||
#[error("Number of predicates in 'use' statement ({found}) exceeds the number of predicates in the batch ({expected}) at {span:?}")]
|
||||
ImportArityMismatch {
|
||||
expected: usize,
|
||||
found: usize,
|
||||
span: Option<(usize, usize)>,
|
||||
},
|
||||
#[error("Duplicate import name '{name}' at {span:?}")]
|
||||
DuplicateImportName {
|
||||
name: String,
|
||||
span: Option<(usize, usize)>,
|
||||
},
|
||||
#[error("Frontend error: {0}")]
|
||||
Frontend(#[from] frontend::Error),
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue