ajust/add devlaration errors to be more standard compliant

This commit is contained in:
Bennet Bleßmann
2024-08-03 22:59:29 +02:00
parent 17a816eff4
commit df33da111e
9 changed files with 86 additions and 3 deletions

View File

@@ -60,6 +60,24 @@ fn setup_op_decl(mut terms: Vec<Term>, atom_tbl: &AtomTable) -> Result<OpDecl, C
}
};
if name == "[]" || name == "{}" {
return Err(CompilationError::InvalidDecl(
DeclarationError::ShallNotCreate(name),
));
}
if name == "," {
return Err(CompilationError::InvalidDecl(
DeclarationError::ShallNotModify(name),
));
}
if name == "|" && (prec < 1001 || !spec.is_infix()) {
return Err(CompilationError::InvalidDecl(
DeclarationError::ShallNotCreate(name),
));
}
Ok(to_op_decl(prec, spec, name))
}