Check a single POD against a POD Request (#359)

This commit is contained in:
Rob Knight 2025-07-30 02:46:14 +01:00 committed by GitHub
parent c7b39f21f0
commit f10a5adb41
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 419 additions and 102 deletions

View file

@ -2,8 +2,11 @@
use std::fmt::Write;
use crate::middleware::{
CustomPredicate, CustomPredicateBatch, Predicate, StatementTmpl, StatementTmplArg, Value,
use crate::{
frontend::PodRequest,
middleware::{
CustomPredicate, CustomPredicateBatch, Predicate, StatementTmpl, StatementTmplArg, Value,
},
};
/// Trait for converting AST nodes to Podlang source code
@ -122,6 +125,19 @@ impl PrettyPrint for Value {
}
}
impl PrettyPrint for PodRequest {
fn fmt_podlang_with_indent(&self, w: &mut dyn Write, _indent: usize) -> std::fmt::Result {
write!(w, "REQUEST(")?;
for (i, template) in self.request_templates.iter().enumerate() {
if i > 0 {
write!(w, ", ")?;
}
template.fmt_podlang_with_indent(w, 4)?;
}
write!(w, ")")
}
}
fn fmt_predicate_definition(
w: &mut dyn Write,
predicate: &CustomPredicate,