mirror of
https://github.com/HigherOrderCO/Kind1.git
synced 2024-09-19 04:37:28 +03:00
Now kdl compilation accumulates errors of maximum length
This commit is contained in:
parent
377af111e2
commit
7e3008d24d
@ -129,6 +129,7 @@ pub fn to_kdl_book(book: &Book, kdl_names: &HashMap<String, String>, comp_book:
|
||||
// Returns a map of kind names to kindelia names
|
||||
// Returns an err if any of the names can't be converted
|
||||
pub fn get_kdl_names(book: &CompBook) -> Result<HashMap<String, String>, String> {
|
||||
let mut errors = Vec::new();
|
||||
// Fits a name to the max size allowed by kindelia.
|
||||
// If the name is too large, truncates and replaces the last characters by random chars.
|
||||
// Fails if the namespace is too large.
|
||||
@ -193,8 +194,16 @@ pub fn get_kdl_names(book: &CompBook) -> Result<HashMap<String, String>, String>
|
||||
|
||||
let mut kdl_names = HashMap::new();
|
||||
for name in &book.names {
|
||||
let kdln = get_kdl_name(book.entrs.get(name).unwrap())?;
|
||||
kdl_names.insert(name.clone(), kdln);
|
||||
let kdln = get_kdl_name(book.entrs.get(name).unwrap());
|
||||
match kdln {
|
||||
Ok(kdln) => kdl_names.insert(name.clone(), kdln).map(|_| ()).unwrap_or(()),
|
||||
Err(err) => errors.push(err)
|
||||
}
|
||||
}
|
||||
|
||||
if errors.is_empty() {
|
||||
Ok(kdl_names)
|
||||
} else {
|
||||
Err(errors.join("\n"))
|
||||
}
|
||||
Ok(kdl_names)
|
||||
}
|
||||
|
@ -1 +1,9 @@
|
||||
Namespace for "Algebra.Group.concat" has more than 11 characters.
|
||||
Namespace for "Algebra.Group.concat" has more than 11 characters.
|
||||
Namespace for "Algebra.Group.new" has more than 11 characters.
|
||||
Namespace for "Algebra.Monoid.concat" has more than 11 characters.
|
||||
Namespace for "Algebra.Monoid.new" has more than 11 characters.
|
||||
Namespace for "Algebra.Semigroup.concat" has more than 11 characters.
|
||||
Namespace for "Algebra.Semigroup.new" has more than 11 characters.
|
||||
Namespace for "Algebra.Magma.concat" has more than 11 characters.
|
||||
Namespace for "Algebra.Magma.new" has more than 11 characters.
|
||||
Namespace for "Algebra.Monoid.empty" has more than 11 characters.
|
Loading…
Reference in New Issue
Block a user