Parse assumptions

This commit is contained in:
2026-04-29 19:18:00 -06:00
parent 3f12a9cf1a
commit 2d6c73f8fe

View File

@@ -23,8 +23,6 @@ use strum::{EnumDiscriminants, EnumIter};
use crate::prelude::*;
// TODO: migrate AST logic (after redesigning grammar)
/// Retrieves, but does not parse, all top-level items in a file.
// TODO: is `Vec` the most efficient to incrementally update here?
#[salsa::tracked]
@@ -186,14 +184,19 @@ pub fn import<'db>(db: &'db dyn Database, ast: AstNode) -> Import<'db> {
pub struct Import<'db> {}
/// Parses [Assumption] from an [AstNode].
// TODO: parse soft weights
#[salsa::tracked]
pub fn assumption<'db>(db: &'db dyn Database, ast: AstNode) -> Assumption<'db> {
todo!()
let body = rule_body(db, ast.expect_field(db, "body"));
Assumption::new(db, body)
}
/// An abstract assumption.
#[salsa::tracked]
pub struct Assumption<'db> {}
pub struct Assumption<'db> {
/// The assumption's rule body.
pub body: RuleBody<'db>,
}
/// Parses a rule body.
// TODO: parallelize?