Refactoring
This commit is contained in:
File diff suppressed because it is too large
Load Diff
212
src/rsprocess/assert_fmt.rs
Normal file
212
src/rsprocess/assert_fmt.rs
Normal file
@ -0,0 +1,212 @@
|
|||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// Display Implementation for all types
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
impl fmt::Display for RSassert {
|
||||||
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
|
write!(f, "label {{\n{}\n}}", self.tree)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl fmt::Display for Tree {
|
||||||
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
|
match self {
|
||||||
|
Self::Concat(t1, t2) => {write!(f, "{t1};\n{t2}")},
|
||||||
|
Self::If(exp, t) => {write!(f, "if {exp} {{\n{t}\n}}")},
|
||||||
|
Self::IfElse(exp, t1, t2) => {
|
||||||
|
write!(f, "if {exp} {{\n{t1}\n}} else {{\n{t2}\n}}")
|
||||||
|
},
|
||||||
|
Self::Assignment(v, q, exp) => {
|
||||||
|
if let Some(q) = q {
|
||||||
|
write!(f, "{v}.{q} = {exp}")
|
||||||
|
} else {
|
||||||
|
write!(f, "{v} = {exp}")
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Self::Return(exp) => {write!(f, "return {exp}")},
|
||||||
|
Self::For(v, r, t) => {write!(f, "for {v} in {r} {{\n{t}\n}}")},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl fmt::Display for Variable {
|
||||||
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
|
match self {
|
||||||
|
Self::Label => {write!(f, "label")},
|
||||||
|
Self::Edge => {write!(f, "edge")},
|
||||||
|
Self::Id(s) => {write!(f, "{s}")}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl fmt::Display for Expression {
|
||||||
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
|
match self {
|
||||||
|
Self::True => {write!(f, "True")},
|
||||||
|
Self::False => {write!(f, "False")},
|
||||||
|
Self::Integer(i) => {write!(f, "{i}")},
|
||||||
|
Self::Label(rslabel) => {write!(f, "{{debug: {rslabel:?}}}")},
|
||||||
|
Self::Set(set) => {write!(f, "{{debug: {set:?}}}")},
|
||||||
|
Self::Element(el) => {write!(f, "'{{debug: {el:?}}}'")},
|
||||||
|
Self::String(s) => {write!(f, r#""{s}""#)},
|
||||||
|
Self::Var(v) => {write!(f, "{v}")},
|
||||||
|
Self::Unary(u, exp) => {
|
||||||
|
if u.is_prefix() {
|
||||||
|
write!(f, "{u}({exp})")
|
||||||
|
} else if u.is_suffix() {
|
||||||
|
write!(f, "{exp}{u}")
|
||||||
|
} else {
|
||||||
|
unreachable!()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Self::Binary(b, exp1, exp2) => {
|
||||||
|
if b.is_prefix() {
|
||||||
|
write!(f, "{b}({exp1}, {exp2})")
|
||||||
|
} else if b.is_suffix() {
|
||||||
|
write!(f, "({exp1}, {exp2}){b}")
|
||||||
|
} else if b.is_infix() {
|
||||||
|
write!(f, "({exp1} {b} {exp2})")
|
||||||
|
} else {
|
||||||
|
unreachable!()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl fmt::Display for Range {
|
||||||
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
|
match self {
|
||||||
|
Self::IterateOverSet(exp) => {write!(f, "{{{exp}}}")},
|
||||||
|
Self::IterateInRange(exp1, exp2) => {write!(f, "{exp1}..{exp2}")}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl fmt::Display for Unary {
|
||||||
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
|
match self {
|
||||||
|
Self::Not => write!(f, "not"),
|
||||||
|
Self::Rand => write!(f, "rand"),
|
||||||
|
Self::Empty => write!(f, ".empty"),
|
||||||
|
Self::Length => write!(f, ".length"),
|
||||||
|
Self::ToStr => write!(f, ".tostr"),
|
||||||
|
Self::Qualifier(q) => write!(f, ".{q}"),
|
||||||
|
Self::ToEl => write!(f, ".toel"),
|
||||||
|
Self::Source => write!(f, ".source"),
|
||||||
|
Self::Target => write!(f, ".target"),
|
||||||
|
Self::Neighbours => write!(f, ".neighbours"),
|
||||||
|
Self::System => write!(f, ".system"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl fmt::Display for QualifierRestricted {
|
||||||
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
|
match self {
|
||||||
|
Self::Entities => write!(f, "Entities"),
|
||||||
|
Self::Context => write!(f, "Context"),
|
||||||
|
Self::Reactants => write!(f, "Reactants"),
|
||||||
|
Self::ReactantsAbsent => write!(f, "ReactantsAbsent"),
|
||||||
|
Self::Inhibitors => write!(f, "Inhibitors"),
|
||||||
|
Self::InhibitorsPresent => write!(f, "InhibitorsPresent"),
|
||||||
|
Self::Products => write!(f, "Products"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl fmt::Display for QualifierLabel {
|
||||||
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
|
match self {
|
||||||
|
Self::AvailableEntities => write!(f, "AvailableEntities"),
|
||||||
|
Self::AllReactants => write!(f, "AllReactants"),
|
||||||
|
Self::AllInhibitors => write!(f, "AllInhibitors"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl fmt::Display for QualifierSystem {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
|
match self {
|
||||||
|
Self::Context => write!(f, "context"),
|
||||||
|
Self::Entities => write!(f, "entities"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl fmt::Display for Qualifier {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
|
match self {
|
||||||
|
Self::Label(q) => write!(f, "{q}"),
|
||||||
|
Self::Restricted(q) => write!(f, "{q}"),
|
||||||
|
Self::System(q) => write!(f, "{q}"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl fmt::Display for Binary {
|
||||||
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
|
match self {
|
||||||
|
Self::And => write!(f, "&&"),
|
||||||
|
Self::Or => write!(f, "||"),
|
||||||
|
Self::Xor => write!(f, "^^"),
|
||||||
|
Self::Less => write!(f, "<"),
|
||||||
|
Self::LessEq => write!(f, "<="),
|
||||||
|
Self::More => write!(f, ">"),
|
||||||
|
Self::MoreEq => write!(f, ">="),
|
||||||
|
Self::Eq => write!(f, "=="),
|
||||||
|
Self::NotEq => write!(f, "!="),
|
||||||
|
Self::Plus => write!(f, "+"),
|
||||||
|
Self::Minus => write!(f, "-"),
|
||||||
|
Self::Times => write!(f, "*"),
|
||||||
|
Self::Exponential => write!(f, "^"),
|
||||||
|
Self::Quotient => write!(f, "/"),
|
||||||
|
Self::Reminder => write!(f, "%"),
|
||||||
|
Self::Concat => write!(f, "::"),
|
||||||
|
Self::SubStr => write!(f, "substr"),
|
||||||
|
Self::Min => write!(f, "min"),
|
||||||
|
Self::Max => write!(f, "max"),
|
||||||
|
Self::CommonSubStr => write!(f, "commonsubstr"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl fmt::Display for AssertReturnValue {
|
||||||
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
|
match self {
|
||||||
|
Self::Boolean(b) => write!(f, "{b}"),
|
||||||
|
Self::Integer(i) => write!(f, "{i}"),
|
||||||
|
Self::String(s) => write!(f, r#""{s}""#),
|
||||||
|
Self::Label(l) => write!(f, "{{debug: {l:?}}}"),
|
||||||
|
Self::Set(set) => write!(f, "{{debug: {set:?}}}"),
|
||||||
|
Self::Element(el) => write!(f, "{{debug: {el:?}}}"),
|
||||||
|
Self::Edge(edge) => write!(f, "{{debug: {edge:?}}}"),
|
||||||
|
Self::Node(node) => write!(f, "{{debug: {node:?}}}"),
|
||||||
|
Self::Neighbours(node) =>
|
||||||
|
write!(f, "{{debug: {node:?}}}.neighbours"),
|
||||||
|
Self::System(sys) => write!(f, "{{debug: {sys:?}}}"),
|
||||||
|
Self::Context(ctx) => write!(f, "{{debug: {ctx:?}}}"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl fmt::Display for AssertionTypes {
|
||||||
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
|
match self {
|
||||||
|
Self::Boolean => write!(f, "boolean"),
|
||||||
|
Self::Integer => write!(f, "integer"),
|
||||||
|
Self::String => write!(f, "string"),
|
||||||
|
Self::Label => write!(f, "label"),
|
||||||
|
Self::Set => write!(f, "set"),
|
||||||
|
Self::Element => write!(f, "element"),
|
||||||
|
Self::System => write!(f, "system"),
|
||||||
|
Self::Context => write!(f, "context"),
|
||||||
|
Self::NoType => write!(f, "no type"),
|
||||||
|
Self::RangeInteger => write!(f, "range of integers"),
|
||||||
|
Self::RangeSet => write!(f, "range of set"),
|
||||||
|
Self::RangeNeighbours => write!(f, "range of edges"),
|
||||||
|
Self::Edge => write!(f, "edge"),
|
||||||
|
Self::Node => write!(f, "node"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
1442
src/rsprocess/assert_tests.rs
Normal file
1442
src/rsprocess/assert_tests.rs
Normal file
File diff suppressed because it is too large
Load Diff
@ -5,7 +5,7 @@ use crate::rsprocess::structure::{RSset,
|
|||||||
RSprocess,
|
RSprocess,
|
||||||
RSenvironment,
|
RSenvironment,
|
||||||
RSsystem,
|
RSsystem,
|
||||||
RSlabel,
|
// RSlabel,
|
||||||
RSreaction};
|
RSreaction};
|
||||||
use crate::rsprocess::structure::assert;
|
use crate::rsprocess::structure::assert;
|
||||||
use crate::rsprocess::translator::{Translator, IdType};
|
use crate::rsprocess::translator::{Translator, IdType};
|
||||||
@ -180,164 +180,174 @@ Env_term: (IdType, RSprocess) = {
|
|||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// AssertParser
|
// AssertParser
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
pub Assert: Box<assert::RSassert> = {
|
// pub Assert: Box<assert::RSassert> = {
|
||||||
"label" "{" <f: AssertTree> "}" =>
|
// "label" "{" <f: AssertTree> "}" =>
|
||||||
Box::new(assert::RSassert{tree: f}),
|
// Box::new(assert::RSassert{tree: f}),
|
||||||
};
|
// };
|
||||||
|
|
||||||
AssertTree: assert::Tree = {
|
// AssertTree: assert::Tree = {
|
||||||
<t1: AssertTree2> ";" <t2: AssertTree> =>
|
// <t1: AssertTree2> ";" <t2: AssertTree> =>
|
||||||
assert::Tree::Concat(Box::new(t1), Box::new(t2)),
|
// assert::Tree::Concat(Box::new(t1), Box::new(t2)),
|
||||||
<t: AssertTree2> => t,
|
// <t: AssertTree2> => t,
|
||||||
}
|
// }
|
||||||
|
|
||||||
AssertTree2: assert::Tree = {
|
// AssertTree2: assert::Tree = {
|
||||||
"if" <e: AssertExpression>
|
// "if" <e: AssertExpression>
|
||||||
"then" "{" <t: AssertTree> "}" =>
|
// "then" "{" <t: AssertTree> "}" =>
|
||||||
assert::Tree::If(Box::new(e), Box::new(t)),
|
// assert::Tree::If(Box::new(e), Box::new(t)),
|
||||||
|
|
||||||
"if" <e: AssertExpression>
|
// "if" <e: AssertExpression>
|
||||||
"then" "{" <t1: AssertTree> "}"
|
// "then" "{" <t1: AssertTree> "}"
|
||||||
"else" "{" <t2: AssertTree> "}" =>
|
// "else" "{" <t2: AssertTree> "}" =>
|
||||||
assert::Tree::IfElse(Box::new(e), Box::new(t1), Box::new(t2)),
|
// assert::Tree::IfElse(Box::new(e), Box::new(t1), Box::new(t2)),
|
||||||
|
|
||||||
"let" <v: AssertAssignmentVar> "=" <e: AssertExpression> =>
|
// "let" <v: AssertVariable> <q: AssertQualifierLet?> "=" <e: AssertExpression> =>
|
||||||
assert::Tree::Assignment(v, Box::new(e)),
|
// assert::Tree::Assignment(v, q, Box::new(e)),
|
||||||
|
|
||||||
"return" <e: AssertExpression> =>
|
// "return" <e: AssertExpression> =>
|
||||||
assert::Tree::Return(Box::new(e)),
|
// assert::Tree::Return(Box::new(e)),
|
||||||
|
|
||||||
"for" <v: AssertVariable> "in" <r: AssertRange> "{" <t: AssertTree> "}" =>
|
// "for" <v: AssertVariable> "in" <r: AssertRange> "{" <t: AssertTree> "}" =>
|
||||||
assert::Tree::For(v, r, Box::new(t)),
|
// assert::Tree::For(v, r, Box::new(t)),
|
||||||
}
|
// }
|
||||||
|
|
||||||
AssertAssignmentVar: assert::AssignmentVariable = {
|
// AssertQualifierLet: assert::Qualifier {
|
||||||
<v: AssertVariable> => assert::AssignmentVariable::Var(v),
|
// "Entities" => assert::QualifierRestricted::Entities,
|
||||||
<v: AssertVariable> "." <q: AssertQualifierRestricted> =>
|
// "Context" => assert::QualifierRestricted::Context,
|
||||||
assert::AssignmentVariable::QualifiedVar(v, q),
|
// "Reactants" => assert::QualifierRestricted::Reactants,
|
||||||
}
|
// "ReactantsAbsent" => assert::QualifierRestricted::ReactantsAbsent,
|
||||||
|
// "Inhibitors" => assert::QualifierRestricted::Inhibitors,
|
||||||
|
// "InhibitorsPresent" => assert::QualifierRestricted::InhibitorsPresent,
|
||||||
|
// "Products" => assert::QualifierRestricted::Products,
|
||||||
|
// }
|
||||||
|
|
||||||
AssertVariable: assert::Variable = {
|
// AssertAssignmentVar: assert::AssignmentVariable = {
|
||||||
"label" => assert::Variable::Label,
|
// <v: AssertVariable> => assert::AssignmentVariable::Var(v),
|
||||||
"edge" => assert::Variable::Edge,
|
// <v: AssertVariable> "." <q: AssertQualifierRestricted> =>
|
||||||
<v: Literal> => assert::Variable::Id(v),
|
// assert::AssignmentVariable::QualifiedVar(v, q),
|
||||||
}
|
// }
|
||||||
|
|
||||||
AssertExpression: assert::Expression = {
|
// AssertVariable: assert::Variable = {
|
||||||
<unp: AssertUnaryPrefix> <e: AssertExpression> =>
|
// "label" => assert::Variable::Label,
|
||||||
assert::Expression::Unary(unp, Box::new(e)),
|
// "edge" => assert::Variable::Edge,
|
||||||
"(" <e: AssertExpression> ")" <uns: AssertUnarySuffix> =>
|
// <v: Literal> => assert::Variable::Id(v),
|
||||||
assert::Expression::Unary(uns, Box::new(e)),
|
// }
|
||||||
|
|
||||||
"(" <e1: AssertExpression> <b: AssertBinary> <e2: AssertExpression> ")" =>
|
// AssertExpression: assert::Expression = {
|
||||||
assert::Expression::Binary(b, Box::new(e1), Box::new(e2)),
|
// <unp: AssertUnaryPrefix> <e: AssertExpression> =>
|
||||||
<b: AssertBinaryPrefix>
|
// assert::Expression::Unary(unp, Box::new(e)),
|
||||||
"(" <e1: AssertExpression> "," <e2: AssertExpression> ")" =>
|
// "(" <e: AssertExpression> ")" <uns: AssertUnarySuffix> =>
|
||||||
assert::Expression::Binary(b, Box::new(e1), Box::new(e2)),
|
// assert::Expression::Unary(uns, Box::new(e)),
|
||||||
|
|
||||||
"(" <e: AssertExpression> ")" => e,
|
// "(" <e1: AssertExpression> <b: AssertBinary> <e2: AssertExpression> ")" =>
|
||||||
"true" => assert::Expression::True,
|
// assert::Expression::Binary(b, Box::new(e1), Box::new(e2)),
|
||||||
"false" => assert::Expression::False,
|
// <b: AssertBinaryPrefix>
|
||||||
|
// "(" <e1: AssertExpression> "," <e2: AssertExpression> ")" =>
|
||||||
|
// assert::Expression::Binary(b, Box::new(e1), Box::new(e2)),
|
||||||
|
|
||||||
<v: AssertAssignmentVar> => assert::Expression::Var(v),
|
// "(" <e: AssertExpression> ")" => e,
|
||||||
|
// "true" => assert::Expression::True,
|
||||||
|
// "false" => assert::Expression::False,
|
||||||
|
|
||||||
// If changing IntegerType in assert.rs, also change from Num to another
|
// <v: AssertAssignmentVar> => assert::Expression::Var(v),
|
||||||
// similar parser with different return type
|
|
||||||
<i: Num> => assert::Expression::Integer(i),
|
|
||||||
|
|
||||||
<lab: AssertLabel> => assert::Expression::Label(Box::new(lab)),
|
// // If changing IntegerType in assert.rs, also change from Num to another
|
||||||
<set: Set_of_entities> => assert::Expression::Set(set),
|
// // similar parser with different return type
|
||||||
"'" <el: Literal> "'" => assert::Expression::Element(translator.encode(el)),
|
// <i: Num> => assert::Expression::Integer(i),
|
||||||
|
|
||||||
// strings
|
// <lab: AssertLabel> => assert::Expression::Label(Box::new(lab)),
|
||||||
PATH => assert::Expression::String(<>.trim_end_matches("\"")
|
// <set: Set_of_entities> => assert::Expression::Set(set),
|
||||||
.trim_start_matches("\"")
|
// "'" <el: Literal> "'" => assert::Expression::Element(translator.encode(el)),
|
||||||
.to_string()),
|
|
||||||
}
|
|
||||||
|
|
||||||
AssertUnaryPrefix: assert::Unary = {
|
// // strings
|
||||||
"not" => assert::Unary::Not,
|
// PATH => assert::Expression::String(<>.trim_end_matches("\"")
|
||||||
"rand" => assert::Unary::Rand,
|
// .trim_start_matches("\"")
|
||||||
}
|
// .to_string()),
|
||||||
|
// }
|
||||||
|
|
||||||
AssertUnarySuffix: assert::Unary = {
|
// AssertUnaryPrefix: assert::Unary = {
|
||||||
".empty" => assert::Unary::Empty,
|
// "not" => assert::Unary::Not,
|
||||||
".length" => assert::Unary::Length,
|
// "rand" => assert::Unary::Rand,
|
||||||
".tostr" => assert::Unary::ToStr,
|
// }
|
||||||
".toel" => assert::Unary::ToEl,
|
|
||||||
".source" => assert::Unary::Source,
|
|
||||||
".target" => assert::Unary::Target,
|
|
||||||
".neighbours" => assert::Unary::Neighbours,
|
|
||||||
".system" => assert::Unary::System,
|
|
||||||
"." <q: AssertQualifierLabel> => assert::Unary::QualifierLabel(q),
|
|
||||||
"." <q: AssertQualifierSystem> => assert::Unary::QualifierSystem(q),
|
|
||||||
}
|
|
||||||
|
|
||||||
AssertBinary: assert::Binary = {
|
// AssertUnarySuffix: assert::Unary = {
|
||||||
"&&" => assert::Binary::And,
|
// ".empty" => assert::Unary::Empty,
|
||||||
"||" => assert::Binary::Or,
|
// ".length" => assert::Unary::Length,
|
||||||
"^^" => assert::Binary::Xor,
|
// ".tostr" => assert::Unary::ToStr,
|
||||||
"<" => assert::Binary::Less,
|
// ".toel" => assert::Unary::ToEl,
|
||||||
"<=" => assert::Binary::LessEq,
|
// ".source" => assert::Unary::Source,
|
||||||
">" => assert::Binary::More,
|
// ".target" => assert::Unary::Target,
|
||||||
">=" => assert::Binary::MoreEq,
|
// ".neighbours" => assert::Unary::Neighbours,
|
||||||
"==" => assert::Binary::Eq,
|
// ".system" => assert::Unary::System,
|
||||||
"!=" => assert::Binary::NotEq,
|
// "." <q: AssertQualifierLabel> => assert::Unary::QualifierLabel(q),
|
||||||
"+" => assert::Binary::Plus,
|
// "." <q: AssertQualifierSystem> => assert::Unary::QualifierSystem(q),
|
||||||
"-" => assert::Binary::Minus,
|
// }
|
||||||
"*" => assert::Binary::Times,
|
|
||||||
"^" => assert::Binary::Exponential,
|
|
||||||
"/" => assert::Binary::Quotient,
|
|
||||||
"%" => assert::Binary::Reminder,
|
|
||||||
"::" => assert::Binary::Concat,
|
|
||||||
}
|
|
||||||
|
|
||||||
AssertBinaryPrefix: assert::Binary = {
|
// AssertBinary: assert::Binary = {
|
||||||
"substr" => assert::Binary::SubStr,
|
// "&&" => assert::Binary::And,
|
||||||
"min" => assert::Binary::Min,
|
// "||" => assert::Binary::Or,
|
||||||
"max" => assert::Binary::Max,
|
// "^^" => assert::Binary::Xor,
|
||||||
"commonsubstr" => assert::Binary::CommonSubStr,
|
// "<" => assert::Binary::Less,
|
||||||
}
|
// "<=" => assert::Binary::LessEq,
|
||||||
|
// ">" => assert::Binary::More,
|
||||||
|
// ">=" => assert::Binary::MoreEq,
|
||||||
|
// "==" => assert::Binary::Eq,
|
||||||
|
// "!=" => assert::Binary::NotEq,
|
||||||
|
// "+" => assert::Binary::Plus,
|
||||||
|
// "-" => assert::Binary::Minus,
|
||||||
|
// "*" => assert::Binary::Times,
|
||||||
|
// "^" => assert::Binary::Exponential,
|
||||||
|
// "/" => assert::Binary::Quotient,
|
||||||
|
// "%" => assert::Binary::Reminder,
|
||||||
|
// "::" => assert::Binary::Concat,
|
||||||
|
// }
|
||||||
|
|
||||||
AssertQualifierSystem: assert::QualifierSystem = {
|
// AssertBinaryPrefix: assert::Binary = {
|
||||||
"SystemEntities" => assert::QualifierSystem::Entities,
|
// "substr" => assert::Binary::SubStr,
|
||||||
"SystemContext" => assert::QualifierSystem::Context,
|
// "min" => assert::Binary::Min,
|
||||||
}
|
// "max" => assert::Binary::Max,
|
||||||
|
// "commonsubstr" => assert::Binary::CommonSubStr,
|
||||||
|
// }
|
||||||
|
|
||||||
AssertQualifierLabel: assert::QualifierLabel = {
|
// AssertQualifierSystem: assert::QualifierSystem = {
|
||||||
"AvailableEntities" => assert::QualifierLabel::AvailableEntities,
|
// "SystemEntities" => assert::QualifierSystem::Entities,
|
||||||
"AllReactants" => assert::QualifierLabel::AllReactants,
|
// "SystemContext" => assert::QualifierSystem::Context,
|
||||||
"AllInhibitors" => assert::QualifierLabel::AllInhibitors,
|
// }
|
||||||
<q: AssertQualifierRestricted> => assert::QualifierLabel::Restricted(q),
|
|
||||||
}
|
|
||||||
|
|
||||||
AssertQualifierRestricted: assert::QualifierRestricted = {
|
// AssertQualifierLabel: assert::QualifierLabel = {
|
||||||
"Entities" => assert::QualifierRestricted::Entities,
|
// "AvailableEntities" => assert::QualifierLabel::AvailableEntities,
|
||||||
"Context" => assert::QualifierRestricted::Context,
|
// "AllReactants" => assert::QualifierLabel::AllReactants,
|
||||||
"Reactants" => assert::QualifierRestricted::Reactants,
|
// "AllInhibitors" => assert::QualifierLabel::AllInhibitors,
|
||||||
"ReactantsAbsent" => assert::QualifierRestricted::ReactantsAbsent,
|
// <q: AssertQualifierRestricted> => assert::QualifierLabel::Restricted(q),
|
||||||
"Inhibitors" => assert::QualifierRestricted::Inhibitors,
|
// }
|
||||||
"InhibitorsPresent" => assert::QualifierRestricted::InhibitorsPresent,
|
|
||||||
"Products" => assert::QualifierRestricted::Products,
|
|
||||||
}
|
|
||||||
|
|
||||||
AssertLabel: RSlabel = {
|
// AssertQualifierRestricted: assert::QualifierRestricted = {
|
||||||
"["
|
// "Entities" => assert::QualifierRestricted::Entities,
|
||||||
"Entities" ":" <e: Set_of_entities> ","
|
// "Context" => assert::QualifierRestricted::Context,
|
||||||
"Context" ":" <c: Set_of_entities> ","
|
// "Reactants" => assert::QualifierRestricted::Reactants,
|
||||||
"Reactants" ":" <r: Set_of_entities> ","
|
// "ReactantsAbsent" => assert::QualifierRestricted::ReactantsAbsent,
|
||||||
"ReactantsAbsent" ":" <r_a: Set_of_entities> ","
|
// "Inhibitors" => assert::QualifierRestricted::Inhibitors,
|
||||||
"Inhibitors" ":" <i: Set_of_entities> ","
|
// "InhibitorsPresent" => assert::QualifierRestricted::InhibitorsPresent,
|
||||||
"InhibitorsPresent" ":" <i_p: Set_of_entities> ","
|
// "Products" => assert::QualifierRestricted::Products,
|
||||||
"Products" ":" <p: Set_of_entities> ","
|
// }
|
||||||
"]" => RSlabel::create(e, c, r, r_a, i, i_p, p)
|
|
||||||
}
|
|
||||||
|
|
||||||
AssertRange: assert::Range = {
|
// AssertLabel: RSlabel = {
|
||||||
"{" <e: AssertExpression> "}" => assert::Range::IterateOverSet(Box::new(e)),
|
// "["
|
||||||
"{" <e1: AssertExpression> ".." <e2: AssertExpression> "}" =>
|
// "Entities" ":" <e: Set_of_entities> ","
|
||||||
assert::Range::IterateInRange(Box::new(e1), Box::new(e2)),
|
// "Context" ":" <c: Set_of_entities> ","
|
||||||
}
|
// "Reactants" ":" <r: Set_of_entities> ","
|
||||||
|
// "ReactantsAbsent" ":" <r_a: Set_of_entities> ","
|
||||||
|
// "Inhibitors" ":" <i: Set_of_entities> ","
|
||||||
|
// "InhibitorsPresent" ":" <i_p: Set_of_entities> ","
|
||||||
|
// "Products" ":" <p: Set_of_entities> ","
|
||||||
|
// "]" => RSlabel::create(e, c, r, r_a, i, i_p, p)
|
||||||
|
// }
|
||||||
|
|
||||||
|
// AssertRange: assert::Range = {
|
||||||
|
// "{" <e: AssertExpression> "}" => assert::Range::IterateOverSet(Box::new(e)),
|
||||||
|
// "{" <e1: AssertExpression> ".." <e2: AssertExpression> "}" =>
|
||||||
|
// assert::Range::IterateInRange(Box::new(e1), Box::new(e2)),
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
@ -727,9 +737,16 @@ Instruction: presets::Instruction = {
|
|||||||
presets::Instruction::FastFrequency { experiment: p, so },
|
presets::Instruction::FastFrequency { experiment: p, so },
|
||||||
"Digraph" ">" <gso: Separated_Or<GraphSaveOptions, "|">> =>
|
"Digraph" ">" <gso: Separated_Or<GraphSaveOptions, "|">> =>
|
||||||
presets::Instruction::Digraph { gso },
|
presets::Instruction::Digraph { gso },
|
||||||
"Bisimilarity" "(" <p: Path> ")" "relabel" <edge_relabeler: Assert>
|
// <edge_relabeler: Assert>
|
||||||
|
"Bisimilarity" "(" <p: Path> ")" "relabel"
|
||||||
">" <so: SaveOptions> =>
|
">" <so: SaveOptions> =>
|
||||||
presets::Instruction::Bisimilarity { system_b: p, edge_relabeler, so },
|
presets::Instruction::Bisimilarity {
|
||||||
|
system_b: p,
|
||||||
|
edge_relabeler: Box::new(assert::RSassert {
|
||||||
|
tree: assert::Tree::Return(Box::new(assert::Expression::True))
|
||||||
|
}),
|
||||||
|
so
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
pub Run: presets::Instructions = {
|
pub Run: presets::Instructions = {
|
||||||
|
|||||||
Reference in New Issue
Block a user