esl_compiler/builder/
mod.rs

1//! Builder module. Takes the result from a Pest file parser and builds the unchecked tree.
2pub mod auxiliary;
3pub mod behavior;
4pub mod component;
5pub mod def_component;
6pub mod def_relation;
7pub mod def_type;
8pub mod def_verb;
9pub mod design;
10pub mod file;
11pub mod goal;
12pub mod need;
13pub mod relation;
14pub mod specification;
15pub mod subject;
16pub mod transformation;
17pub mod value;
18pub mod variable;
19use std::borrow::BorrowMut;
20
21use crate::cursor::Cursors;
22use crate::parser::Rule;
23
24/// Requirement stringency, i.e. requirement (desired) or constraint (given).
25#[derive(Clone, Debug, Default, PartialEq)]
26pub enum Stringency {
27    #[default]
28    Requirement,
29    Constraint,
30}
31impl<'a, Cs: BorrowMut<Cursors<'a>>> From<Cs> for Stringency {
32    fn from(mut value: Cs) -> Self {
33        if value.borrow_mut().contains(Rule::kw_suffix_constraints) {
34            Stringency::Constraint
35        } else {
36            Stringency::Requirement
37        }
38    }
39}