Context operation for positive
This commit is contained in:
@ -1320,7 +1320,8 @@ where
|
|||||||
| Range::IterateOverSet(exp) => {
|
| Range::IterateOverSet(exp) => {
|
||||||
let type_exp = typecheck_expression(exp, c)?;
|
let type_exp = typecheck_expression(exp, c)?;
|
||||||
match type_exp {
|
match type_exp {
|
||||||
| AssertionTypes::Set => Ok(AssertionTypes::RangeSet),
|
| AssertionTypes::Set =>
|
||||||
|
Ok(AssertionTypes::RangeSet),
|
||||||
| AssertionTypes::RangeNeighbours =>
|
| AssertionTypes::RangeNeighbours =>
|
||||||
Ok(AssertionTypes::RangeNeighbours),
|
Ok(AssertionTypes::RangeNeighbours),
|
||||||
| AssertionTypes::RangeContexts =>
|
| AssertionTypes::RangeContexts =>
|
||||||
|
|||||||
@ -126,6 +126,25 @@ pub enum QualifierSystem {
|
|||||||
Context,
|
Context,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Copy, Serialize, Deserialize, Hash)]
|
||||||
|
pub enum QualifierContext {
|
||||||
|
IsNill,
|
||||||
|
IsIdentifier,
|
||||||
|
IsSet,
|
||||||
|
IsGuarded,
|
||||||
|
IsRepeated,
|
||||||
|
IsSummation,
|
||||||
|
IsNondeterministicChoice,
|
||||||
|
|
||||||
|
GetSet,
|
||||||
|
GetGuardReactants,
|
||||||
|
GetGuardProducts,
|
||||||
|
GetRepeatedCounter,
|
||||||
|
GetRepeatedProcess,
|
||||||
|
|
||||||
|
GetNextProcesses,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Serialize, Deserialize, Hash)]
|
#[derive(Clone, Copy, Serialize, Deserialize, Hash)]
|
||||||
pub enum QualifierEdge {
|
pub enum QualifierEdge {
|
||||||
Source,
|
Source,
|
||||||
@ -142,6 +161,7 @@ pub enum QualifierNode {
|
|||||||
#[derive(Clone, Copy, Serialize, Deserialize, Hash)]
|
#[derive(Clone, Copy, Serialize, Deserialize, Hash)]
|
||||||
pub enum PositiveQualifier {
|
pub enum PositiveQualifier {
|
||||||
System(QualifierSystem),
|
System(QualifierSystem),
|
||||||
|
Context(QualifierContext),
|
||||||
Label(QualifierLabel),
|
Label(QualifierLabel),
|
||||||
Restricted(QualifierRestricted),
|
Restricted(QualifierRestricted),
|
||||||
Edge(QualifierEdge),
|
Edge(QualifierEdge),
|
||||||
@ -187,6 +207,7 @@ pub(super) enum PositiveAssertionTypes {
|
|||||||
RangeInteger,
|
RangeInteger,
|
||||||
RangeSet,
|
RangeSet,
|
||||||
RangeNeighbours,
|
RangeNeighbours,
|
||||||
|
RangeContexts,
|
||||||
|
|
||||||
Node,
|
Node,
|
||||||
Edge,
|
Edge,
|
||||||
@ -205,6 +226,7 @@ pub enum PositiveAssertReturnValue {
|
|||||||
Neighbours(petgraph::graph::NodeIndex),
|
Neighbours(petgraph::graph::NodeIndex),
|
||||||
System(system::PositiveSystem),
|
System(system::PositiveSystem),
|
||||||
Context(process::PositiveProcess),
|
Context(process::PositiveProcess),
|
||||||
|
RangeContext(process::PositiveProcess),
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
@ -290,6 +312,105 @@ impl QualifierSystem {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl QualifierContext {
|
||||||
|
pub(super) fn get(&self, l: &process::PositiveProcess) -> PositiveAssertReturnValue {
|
||||||
|
use process::PositiveProcess::*;
|
||||||
|
match self {
|
||||||
|
| Self::IsNill => PositiveAssertReturnValue::Boolean(matches!(l, Nill)),
|
||||||
|
| Self::IsIdentifier =>
|
||||||
|
PositiveAssertReturnValue::Boolean(matches!(l, RecursiveIdentifier {
|
||||||
|
identifier: _,
|
||||||
|
})),
|
||||||
|
| Self::IsSet =>
|
||||||
|
PositiveAssertReturnValue::Boolean(matches!(l, EntitySet {
|
||||||
|
entities: _,
|
||||||
|
next_process: _,
|
||||||
|
})),
|
||||||
|
| Self::IsGuarded =>
|
||||||
|
PositiveAssertReturnValue::Boolean(matches!(l, Guarded {
|
||||||
|
reaction: _,
|
||||||
|
next_process: _,
|
||||||
|
})),
|
||||||
|
| Self::IsRepeated =>
|
||||||
|
PositiveAssertReturnValue::Boolean(matches!(l, WaitEntity {
|
||||||
|
repeat: _,
|
||||||
|
repeated_process: _,
|
||||||
|
next_process: _,
|
||||||
|
})),
|
||||||
|
| Self::IsSummation =>
|
||||||
|
PositiveAssertReturnValue::Boolean(matches!(l, Summation {
|
||||||
|
children: _,
|
||||||
|
})),
|
||||||
|
| Self::IsNondeterministicChoice => PositiveAssertReturnValue::Boolean(
|
||||||
|
matches!(l, NondeterministicChoice { children: _ }),
|
||||||
|
),
|
||||||
|
|
||||||
|
| Self::GetSet => PositiveAssertReturnValue::Set(
|
||||||
|
if let EntitySet {
|
||||||
|
entities,
|
||||||
|
next_process: _,
|
||||||
|
} = l
|
||||||
|
{
|
||||||
|
entities.clone()
|
||||||
|
} else {
|
||||||
|
Default::default()
|
||||||
|
},
|
||||||
|
),
|
||||||
|
| Self::GetGuardReactants => PositiveAssertReturnValue::Set(
|
||||||
|
if let Guarded {
|
||||||
|
reaction,
|
||||||
|
next_process: _,
|
||||||
|
} = l
|
||||||
|
{
|
||||||
|
reaction.reactants.clone()
|
||||||
|
} else {
|
||||||
|
Default::default()
|
||||||
|
},
|
||||||
|
),
|
||||||
|
| Self::GetGuardProducts => PositiveAssertReturnValue::Set(
|
||||||
|
if let Guarded {
|
||||||
|
reaction,
|
||||||
|
next_process: _,
|
||||||
|
} = l
|
||||||
|
{
|
||||||
|
reaction.products.clone()
|
||||||
|
} else {
|
||||||
|
Default::default()
|
||||||
|
},
|
||||||
|
),
|
||||||
|
| Self::GetRepeatedCounter => PositiveAssertReturnValue::Integer(
|
||||||
|
if let WaitEntity {
|
||||||
|
repeat,
|
||||||
|
repeated_process: _,
|
||||||
|
next_process: _,
|
||||||
|
} = l
|
||||||
|
{
|
||||||
|
*repeat
|
||||||
|
} else {
|
||||||
|
0
|
||||||
|
},
|
||||||
|
),
|
||||||
|
| Self::GetRepeatedProcess => {
|
||||||
|
PositiveAssertReturnValue::Context(
|
||||||
|
if let WaitEntity {
|
||||||
|
repeat: _,
|
||||||
|
repeated_process,
|
||||||
|
next_process: _,
|
||||||
|
} = l
|
||||||
|
{
|
||||||
|
(**repeated_process).clone()
|
||||||
|
} else {
|
||||||
|
Default::default() // nill
|
||||||
|
},
|
||||||
|
)
|
||||||
|
},
|
||||||
|
|
||||||
|
| Self::GetNextProcesses =>
|
||||||
|
PositiveAssertReturnValue::RangeContext(l.clone()),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl PositiveUnary {
|
impl PositiveUnary {
|
||||||
pub(super) fn is_prefix(&self) -> bool {
|
pub(super) fn is_prefix(&self) -> bool {
|
||||||
match self {
|
match self {
|
||||||
@ -381,6 +502,78 @@ impl PositiveUnary {
|
|||||||
)),
|
)),
|
||||||
PositiveAssertionTypes::System,
|
PositiveAssertionTypes::System,
|
||||||
) => Ok(PositiveAssertionTypes::Context),
|
) => Ok(PositiveAssertionTypes::Context),
|
||||||
|
| (
|
||||||
|
Self::Qualifier(PositiveQualifier::Context(QualifierContext::IsNill)),
|
||||||
|
PositiveAssertionTypes::Context,
|
||||||
|
) => Ok(PositiveAssertionTypes::Boolean),
|
||||||
|
| (
|
||||||
|
Self::Qualifier(PositiveQualifier::Context(
|
||||||
|
QualifierContext::IsIdentifier,
|
||||||
|
)),
|
||||||
|
PositiveAssertionTypes::Context,
|
||||||
|
) => Ok(PositiveAssertionTypes::Boolean),
|
||||||
|
| (
|
||||||
|
Self::Qualifier(PositiveQualifier::Context(QualifierContext::IsSet)),
|
||||||
|
PositiveAssertionTypes::Context,
|
||||||
|
) => Ok(PositiveAssertionTypes::Boolean),
|
||||||
|
| (
|
||||||
|
Self::Qualifier(PositiveQualifier::Context(
|
||||||
|
QualifierContext::IsGuarded,
|
||||||
|
)),
|
||||||
|
PositiveAssertionTypes::Context,
|
||||||
|
) => Ok(PositiveAssertionTypes::Boolean),
|
||||||
|
| (
|
||||||
|
Self::Qualifier(PositiveQualifier::Context(
|
||||||
|
QualifierContext::IsRepeated,
|
||||||
|
)),
|
||||||
|
PositiveAssertionTypes::Context,
|
||||||
|
) => Ok(PositiveAssertionTypes::Boolean),
|
||||||
|
| (
|
||||||
|
Self::Qualifier(PositiveQualifier::Context(
|
||||||
|
QualifierContext::IsSummation,
|
||||||
|
)),
|
||||||
|
PositiveAssertionTypes::Context,
|
||||||
|
) => Ok(PositiveAssertionTypes::Boolean),
|
||||||
|
| (
|
||||||
|
Self::Qualifier(PositiveQualifier::Context(
|
||||||
|
QualifierContext::IsNondeterministicChoice,
|
||||||
|
)),
|
||||||
|
PositiveAssertionTypes::Context,
|
||||||
|
) => Ok(PositiveAssertionTypes::Boolean),
|
||||||
|
| (
|
||||||
|
Self::Qualifier(PositiveQualifier::Context(QualifierContext::GetSet)),
|
||||||
|
PositiveAssertionTypes::Context,
|
||||||
|
) => Ok(PositiveAssertionTypes::Set),
|
||||||
|
| (
|
||||||
|
Self::Qualifier(PositiveQualifier::Context(
|
||||||
|
QualifierContext::GetGuardReactants,
|
||||||
|
)),
|
||||||
|
PositiveAssertionTypes::Context,
|
||||||
|
) => Ok(PositiveAssertionTypes::Set),
|
||||||
|
| (
|
||||||
|
Self::Qualifier(PositiveQualifier::Context(
|
||||||
|
QualifierContext::GetGuardProducts,
|
||||||
|
)),
|
||||||
|
PositiveAssertionTypes::Context,
|
||||||
|
) => Ok(PositiveAssertionTypes::Set),
|
||||||
|
| (
|
||||||
|
Self::Qualifier(PositiveQualifier::Context(
|
||||||
|
QualifierContext::GetRepeatedCounter,
|
||||||
|
)),
|
||||||
|
PositiveAssertionTypes::Context,
|
||||||
|
) => Ok(PositiveAssertionTypes::Integer),
|
||||||
|
| (
|
||||||
|
Self::Qualifier(PositiveQualifier::Context(
|
||||||
|
QualifierContext::GetRepeatedProcess,
|
||||||
|
)),
|
||||||
|
PositiveAssertionTypes::Context,
|
||||||
|
) => Ok(PositiveAssertionTypes::Context),
|
||||||
|
| (
|
||||||
|
Self::Qualifier(PositiveQualifier::Context(
|
||||||
|
QualifierContext::GetNextProcesses,
|
||||||
|
)),
|
||||||
|
PositiveAssertionTypes::Context,
|
||||||
|
) => Ok(PositiveAssertionTypes::RangeContexts),
|
||||||
| (
|
| (
|
||||||
Self::Qualifier(PositiveQualifier::Node(QualifierNode::System)),
|
Self::Qualifier(PositiveQualifier::Node(QualifierNode::System)),
|
||||||
PositiveAssertionTypes::Node,
|
PositiveAssertionTypes::Node,
|
||||||
@ -809,6 +1002,10 @@ impl TypeContext {
|
|||||||
self.data.insert(v.clone(), PositiveAssertionTypes::Edge);
|
self.data.insert(v.clone(), PositiveAssertionTypes::Edge);
|
||||||
Ok(())
|
Ok(())
|
||||||
},
|
},
|
||||||
|
| PositiveAssertionTypes::RangeContexts => {
|
||||||
|
self.data.insert(v.clone(), PositiveAssertionTypes::Context);
|
||||||
|
Ok(())
|
||||||
|
},
|
||||||
| _ => Err(format!("Range has incorrect type {ty:?}.")),
|
| _ => Err(format!("Range has incorrect type {ty:?}.")),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1032,6 +1229,10 @@ impl PositiveAssertReturnValue {
|
|||||||
PositiveAssertReturnValue::System(sys),
|
PositiveAssertReturnValue::System(sys),
|
||||||
PositiveUnary::Qualifier(PositiveQualifier::System(q)),
|
PositiveUnary::Qualifier(PositiveQualifier::System(q)),
|
||||||
) => Ok(q.get(&sys)),
|
) => Ok(q.get(&sys)),
|
||||||
|
| (
|
||||||
|
PositiveAssertReturnValue::Context(c),
|
||||||
|
PositiveUnary::Qualifier(PositiveQualifier::Context(q)),
|
||||||
|
) => Ok(q.get(&c)),
|
||||||
| (val, u) => Err(format!(
|
| (val, u) => Err(format!(
|
||||||
"Incompatible unary operation {u:?} on value \
|
"Incompatible unary operation {u:?} on value \
|
||||||
{val:?}."
|
{val:?}."
|
||||||
@ -1290,6 +1491,8 @@ where
|
|||||||
Ok(PositiveAssertionTypes::RangeSet),
|
Ok(PositiveAssertionTypes::RangeSet),
|
||||||
| PositiveAssertionTypes::RangeNeighbours =>
|
| PositiveAssertionTypes::RangeNeighbours =>
|
||||||
Ok(PositiveAssertionTypes::RangeNeighbours),
|
Ok(PositiveAssertionTypes::RangeNeighbours),
|
||||||
|
| PositiveAssertionTypes::RangeContexts =>
|
||||||
|
Ok(PositiveAssertionTypes::RangeContexts),
|
||||||
| _ => Err(format!(
|
| _ => Err(format!(
|
||||||
"Expressions in range is not a set or \
|
"Expressions in range is not a set or \
|
||||||
neighbours of a node, but is: {type_exp:?}."
|
neighbours of a node, but is: {type_exp:?}."
|
||||||
@ -1381,6 +1584,46 @@ where
|
|||||||
.map(|x| PositiveAssertReturnValue::Edge(x.id()))
|
.map(|x| PositiveAssertReturnValue::Edge(x.id()))
|
||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>()
|
||||||
.into_iter()),
|
.into_iter()),
|
||||||
|
| PositiveAssertReturnValue::RangeContext(ctxs) => {
|
||||||
|
use process::PositiveProcess::*;
|
||||||
|
Ok(match ctxs {
|
||||||
|
| Nill => vec![].into_iter(),
|
||||||
|
| RecursiveIdentifier { identifier: _ } =>
|
||||||
|
vec![].into_iter(),
|
||||||
|
| EntitySet {
|
||||||
|
entities: _,
|
||||||
|
next_process,
|
||||||
|
} => vec![PositiveAssertReturnValue::Context(
|
||||||
|
(*next_process).clone(),
|
||||||
|
)]
|
||||||
|
.into_iter(),
|
||||||
|
| Guarded {
|
||||||
|
reaction: _,
|
||||||
|
next_process,
|
||||||
|
} => vec![PositiveAssertReturnValue::Context(
|
||||||
|
(*next_process).clone(),
|
||||||
|
)]
|
||||||
|
.into_iter(),
|
||||||
|
| WaitEntity {
|
||||||
|
repeat: _,
|
||||||
|
repeated_process,
|
||||||
|
next_process: _,
|
||||||
|
} => vec![PositiveAssertReturnValue::Context(
|
||||||
|
(*repeated_process).clone(),
|
||||||
|
)]
|
||||||
|
.into_iter(),
|
||||||
|
| Summation { children } => children
|
||||||
|
.iter()
|
||||||
|
.map(|c| PositiveAssertReturnValue::Context((**c).clone()))
|
||||||
|
.collect::<Vec<_>>()
|
||||||
|
.into_iter(),
|
||||||
|
| NondeterministicChoice { children } => children
|
||||||
|
.iter()
|
||||||
|
.map(|c| PositiveAssertReturnValue::Context((**c).clone()))
|
||||||
|
.collect::<Vec<_>>()
|
||||||
|
.into_iter(),
|
||||||
|
})
|
||||||
|
}
|
||||||
| _ => Err(format!("{val:?} is not a set in for cycle.")),
|
| _ => Err(format!("{val:?} is not a set in for cycle.")),
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -176,6 +176,29 @@ impl fmt::Debug for QualifierSystem {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl fmt::Debug for QualifierContext {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
|
match self {
|
||||||
|
| Self::IsNill => write!(f, "isNill"),
|
||||||
|
| Self::IsIdentifier => write!(f, "isIdentifier"),
|
||||||
|
| Self::IsSet => write!(f, "isSet"),
|
||||||
|
| Self::IsGuarded => write!(f, "isGuarded"),
|
||||||
|
| Self::IsRepeated => write!(f, "isRepeated"),
|
||||||
|
| Self::IsSummation => write!(f, "isSummation"),
|
||||||
|
| Self::IsNondeterministicChoice =>
|
||||||
|
write!(f, "isNondeterministicChoice"),
|
||||||
|
|
||||||
|
| Self::GetSet => write!(f, "getSet"),
|
||||||
|
| Self::GetGuardReactants => write!(f, "getGuardReactants"),
|
||||||
|
| Self::GetGuardProducts => write!(f, "getGuardProducts"),
|
||||||
|
| Self::GetRepeatedCounter => write!(f, "getRepeatedCounter"),
|
||||||
|
| Self::GetRepeatedProcess => write!(f, "getRepeatedProcess"),
|
||||||
|
|
||||||
|
| Self::GetNextProcesses => write!(f, "getNextProcesses"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl fmt::Debug for QualifierEdge {
|
impl fmt::Debug for QualifierEdge {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
match self {
|
match self {
|
||||||
@ -201,6 +224,7 @@ impl fmt::Debug for PositiveQualifier {
|
|||||||
| Self::Label(q) => write!(f, "{q:?}"),
|
| Self::Label(q) => write!(f, "{q:?}"),
|
||||||
| Self::Restricted(q) => write!(f, "{q:?}"),
|
| Self::Restricted(q) => write!(f, "{q:?}"),
|
||||||
| Self::System(q) => write!(f, "{q:?}"),
|
| Self::System(q) => write!(f, "{q:?}"),
|
||||||
|
| Self::Context(q) => write!(f, "{q:?}"),
|
||||||
| Self::Edge(q) => write!(f, "{q:?}"),
|
| Self::Edge(q) => write!(f, "{q:?}"),
|
||||||
| Self::Node(q) => write!(f, "{q:?}"),
|
| Self::Node(q) => write!(f, "{q:?}"),
|
||||||
}
|
}
|
||||||
@ -250,6 +274,7 @@ impl fmt::Debug for PositiveAssertReturnValue {
|
|||||||
},
|
},
|
||||||
| Self::System(sys) => write!(f, "{{debug: {sys:?}}}"),
|
| Self::System(sys) => write!(f, "{{debug: {sys:?}}}"),
|
||||||
| Self::Context(ctx) => write!(f, "{{debug: {ctx:?}}}"),
|
| Self::Context(ctx) => write!(f, "{{debug: {ctx:?}}}"),
|
||||||
|
| Self::RangeContext(ctx) => write!(f, "{{debug: {ctx:?}}}"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -269,6 +294,7 @@ impl fmt::Debug for PositiveAssertionTypes {
|
|||||||
| Self::RangeInteger => write!(f, "range of integers"),
|
| Self::RangeInteger => write!(f, "range of integers"),
|
||||||
| Self::RangeSet => write!(f, "range of set"),
|
| Self::RangeSet => write!(f, "range of set"),
|
||||||
| Self::RangeNeighbours => write!(f, "range of edges"),
|
| Self::RangeNeighbours => write!(f, "range of edges"),
|
||||||
|
| Self::RangeContexts => write!(f, "range of contexts"),
|
||||||
| Self::Edge => write!(f, "edge"),
|
| Self::Edge => write!(f, "edge"),
|
||||||
| Self::Node => write!(f, "node"),
|
| Self::Node => write!(f, "node"),
|
||||||
}
|
}
|
||||||
@ -523,6 +549,16 @@ impl PrintableWithTranslator for QualifierSystem {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl PrintableWithTranslator for QualifierContext {
|
||||||
|
fn print(
|
||||||
|
&self,
|
||||||
|
f: &mut fmt::Formatter,
|
||||||
|
_translator: &Translator,
|
||||||
|
) -> fmt::Result {
|
||||||
|
write!(f, "{self:?}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl PrintableWithTranslator for QualifierEdge {
|
impl PrintableWithTranslator for QualifierEdge {
|
||||||
fn print(
|
fn print(
|
||||||
&self,
|
&self,
|
||||||
@ -557,6 +593,9 @@ impl PrintableWithTranslator for PositiveQualifier {
|
|||||||
| Self::System(q) => {
|
| Self::System(q) => {
|
||||||
write!(f, "{}", Formatter::from(translator, q))
|
write!(f, "{}", Formatter::from(translator, q))
|
||||||
},
|
},
|
||||||
|
| Self::Context(q) => {
|
||||||
|
write!(f, "{}", Formatter::from(translator, q))
|
||||||
|
},
|
||||||
| Self::Edge(q) => write!(f, "{}", Formatter::from(translator, q)),
|
| Self::Edge(q) => write!(f, "{}", Formatter::from(translator, q)),
|
||||||
| Self::Node(q) => write!(f, "{}", Formatter::from(translator, q)),
|
| Self::Node(q) => write!(f, "{}", Formatter::from(translator, q)),
|
||||||
}
|
}
|
||||||
@ -601,6 +640,13 @@ impl PrintableWithTranslator for PositiveAssertReturnValue {
|
|||||||
| Self::Context(ctx) => {
|
| Self::Context(ctx) => {
|
||||||
write!(f, "{}", Formatter::from(translator, ctx))
|
write!(f, "{}", Formatter::from(translator, ctx))
|
||||||
},
|
},
|
||||||
|
| Self::RangeContext(ctx) => {
|
||||||
|
write!(
|
||||||
|
f,
|
||||||
|
"{{next processes of: {}}}",
|
||||||
|
Formatter::from(translator, ctx)
|
||||||
|
)
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -38,6 +38,7 @@ pub mod useful_types_edge_relabeler {
|
|||||||
QualifierRestricted,
|
QualifierRestricted,
|
||||||
QualifierLabel,
|
QualifierLabel,
|
||||||
QualifierSystem,
|
QualifierSystem,
|
||||||
|
QualifierContext,
|
||||||
QualifierEdge,
|
QualifierEdge,
|
||||||
QualifierNode,
|
QualifierNode,
|
||||||
Qualifier,
|
Qualifier,
|
||||||
@ -211,6 +212,7 @@ pub mod useful_types_node_relabeler {
|
|||||||
QualifierRestricted,
|
QualifierRestricted,
|
||||||
QualifierLabel,
|
QualifierLabel,
|
||||||
QualifierSystem,
|
QualifierSystem,
|
||||||
|
QualifierContext,
|
||||||
QualifierEdge,
|
QualifierEdge,
|
||||||
QualifierNode,
|
QualifierNode,
|
||||||
Qualifier,
|
Qualifier,
|
||||||
@ -395,6 +397,7 @@ pub mod useful_types_positive_edge_relabeler {
|
|||||||
QualifierRestricted,
|
QualifierRestricted,
|
||||||
QualifierLabel,
|
QualifierLabel,
|
||||||
QualifierSystem,
|
QualifierSystem,
|
||||||
|
QualifierContext,
|
||||||
QualifierEdge,
|
QualifierEdge,
|
||||||
QualifierNode,
|
QualifierNode,
|
||||||
PositiveQualifier,
|
PositiveQualifier,
|
||||||
@ -510,6 +513,7 @@ impl positivedsl::PositiveAssert<PositiveEdgeRelablerInput> {
|
|||||||
.into()),
|
.into()),
|
||||||
| positivedsl::PositiveAssertionTypes::RangeInteger
|
| positivedsl::PositiveAssertionTypes::RangeInteger
|
||||||
| positivedsl::PositiveAssertionTypes::RangeSet
|
| positivedsl::PositiveAssertionTypes::RangeSet
|
||||||
|
| positivedsl::PositiveAssertionTypes::RangeContexts
|
||||||
| positivedsl::PositiveAssertionTypes::RangeNeighbours =>
|
| positivedsl::PositiveAssertionTypes::RangeNeighbours =>
|
||||||
Err(format!("Returned type {ty:?} is not a valid return type.")),
|
Err(format!("Returned type {ty:?} is not a valid return type.")),
|
||||||
}
|
}
|
||||||
@ -579,6 +583,7 @@ pub mod useful_types_positive_node_relabeler {
|
|||||||
QualifierRestricted,
|
QualifierRestricted,
|
||||||
QualifierLabel,
|
QualifierLabel,
|
||||||
QualifierSystem,
|
QualifierSystem,
|
||||||
|
QualifierContext,
|
||||||
QualifierEdge,
|
QualifierEdge,
|
||||||
QualifierNode,
|
QualifierNode,
|
||||||
PositiveQualifier,
|
PositiveQualifier,
|
||||||
@ -704,6 +709,7 @@ impl positivedsl::PositiveAssert<PositiveNodeRelablerInput> {
|
|||||||
.into()),
|
.into()),
|
||||||
| positivedsl::PositiveAssertionTypes::RangeInteger
|
| positivedsl::PositiveAssertionTypes::RangeInteger
|
||||||
| positivedsl::PositiveAssertionTypes::RangeSet
|
| positivedsl::PositiveAssertionTypes::RangeSet
|
||||||
|
| positivedsl::PositiveAssertionTypes::RangeContexts
|
||||||
| positivedsl::PositiveAssertionTypes::RangeNeighbours =>
|
| positivedsl::PositiveAssertionTypes::RangeNeighbours =>
|
||||||
Err(format!("Returned type {ty:?} is not a valid return type.")),
|
Err(format!("Returned type {ty:?} is not a valid return type.")),
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,13 +19,17 @@ extern {
|
|||||||
// order
|
// order
|
||||||
match {
|
match {
|
||||||
"!", "!=", "%", "&&", "'", "(", ")", "*", "+", ",", "-", "..", "/", ":",
|
"!", "!=", "%", "&&", "'", "(", ")", "*", "+", ",", "-", "..", "/", ":",
|
||||||
"::", ";", "<", "<=", "=", "==", ">", ">=", "AllInhibitors", "AllReactants",
|
"::", ";", "<", "<=", "=", "==", ">", ">=", "AllInhibitors",
|
||||||
"AvailableEntities", "Context", "Entities", "Inhibitors",
|
"AllReactants", "AvailableEntities", "Context", "Entities",
|
||||||
"InhibitorsPresent", "Products", "Reactants", "ReactantsAbsent",
|
"GetGuardInhibitors", "GetGuardProducts", "GetGuardReactants",
|
||||||
"SystemContext", "SystemEntities", "[", "\"", "]", "^", "^^", "edge",
|
"GetIdentifier", "GetNextProcesses", "GetRepeatedCounter",
|
||||||
"else", "empty", "false", "for", "if", "in", "label", "length", "let",
|
"GetRepeatedProcess", "GetSet", "Inhibitors", "InhibitorsPresent",
|
||||||
"neighbours", "not", "rand", "return", "source", "system", "target", "then",
|
"IsGuarded", "IsIdentifier", "IsNill", "IsNondeterministicChoice",
|
||||||
"toel", "tostr", "true", "{", "||", "}",
|
"IsRepeated", "IsSet", "IsSummation", "Products", "Reactants",
|
||||||
|
"ReactantsAbsent", "SystemContext", "SystemEntities", "[", "\"", "]", "^",
|
||||||
|
"^^", "edge", "else", "empty", "false", "for", "if", "in", "label",
|
||||||
|
"length", "let", "neighbours", "not", "rand", "return", "source",
|
||||||
|
"system", "target", "then", "toel", "tostr", "true", "{", "||", "}",
|
||||||
} else {
|
} else {
|
||||||
r"[0-9]+" => NUMBER
|
r"[0-9]+" => NUMBER
|
||||||
} else {
|
} else {
|
||||||
@ -248,6 +252,26 @@ AssertQualifierSystem: relabel::QualifierSystem = {
|
|||||||
"SystemContext" => relabel::QualifierSystem::Context,
|
"SystemContext" => relabel::QualifierSystem::Context,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AssertQualifierContext: relabel::QualifierContext = {
|
||||||
|
"isNill" => relabel::QualifierContext::IsNill,
|
||||||
|
"isIdentifier" => relabel::QualifierContext::IsIdentifier,
|
||||||
|
"isSet" => relabel::QualifierContext::IsSet,
|
||||||
|
"isGuarded" => relabel::QualifierContext::IsGuarded,
|
||||||
|
"isRepeated" => relabel::QualifierContext::IsRepeated,
|
||||||
|
"isSummation" => relabel::QualifierContext::IsSummation,
|
||||||
|
"isNondeterministicChoice" => relabel::QualifierContext::IsNondeterministicChoice,
|
||||||
|
|
||||||
|
"getIdentifier" => relabel::QualifierContext::GetIdentifier,
|
||||||
|
"getSet" => relabel::QualifierContext::GetSet,
|
||||||
|
"getGuardReactants" => relabel::QualifierContext::GetGuardReactants,
|
||||||
|
"getGuardInhibitors" => relabel::QualifierContext::GetGuardInhibitors,
|
||||||
|
"getGuardProducts" => relabel::QualifierContext::GetGuardProducts,
|
||||||
|
"getRepeatedCounter" => relabel::QualifierContext::GetRepeatedCounter,
|
||||||
|
"getRepeatedProcess" => relabel::QualifierContext::GetRepeatedProcess,
|
||||||
|
|
||||||
|
"getNextProcesses" => relabel::QualifierContext::GetNextProcesses,
|
||||||
|
}
|
||||||
|
|
||||||
AssertQualifierEdge: relabel::QualifierEdge = {
|
AssertQualifierEdge: relabel::QualifierEdge = {
|
||||||
"source" => relabel::QualifierEdge::Source,
|
"source" => relabel::QualifierEdge::Source,
|
||||||
"target" => relabel::QualifierEdge::Target,
|
"target" => relabel::QualifierEdge::Target,
|
||||||
@ -261,6 +285,7 @@ AssertQualifierNode: relabel::QualifierNode = {
|
|||||||
|
|
||||||
AssertQualifier: relabel::Qualifier = {
|
AssertQualifier: relabel::Qualifier = {
|
||||||
<q: AssertQualifierSystem> => relabel::Qualifier::System(q),
|
<q: AssertQualifierSystem> => relabel::Qualifier::System(q),
|
||||||
|
<q: AssertQualifierContext> => relabel::Qualifier::Context(q),
|
||||||
<q: AssertQualifierLabel> => relabel::Qualifier::Label(q),
|
<q: AssertQualifierLabel> => relabel::Qualifier::Label(q),
|
||||||
<q: AssertQualifierRestricted> => relabel::Qualifier::Restricted(q),
|
<q: AssertQualifierRestricted> => relabel::Qualifier::Restricted(q),
|
||||||
<q: AssertQualifierEdge> => relabel::Qualifier::Edge(q),
|
<q: AssertQualifierEdge> => relabel::Qualifier::Edge(q),
|
||||||
|
|||||||
@ -21,12 +21,16 @@ extern {
|
|||||||
match {
|
match {
|
||||||
"!", "!=", "%", "&&", "'", "(", ")", "*", "+", ",", "-", "..", "/", ":",
|
"!", "!=", "%", "&&", "'", "(", ")", "*", "+", ",", "-", "..", "/", ":",
|
||||||
"::", ";", "<", "<=", "=", "==", ">", ">=", "AllInhibitors", "AllReactants",
|
"::", ";", "<", "<=", "=", "==", ">", ">=", "AllInhibitors", "AllReactants",
|
||||||
"AvailableEntities", "Context", "Entities", "Inhibitors",
|
"AvailableEntities", "Context", "Entities", "getGuardInhibitors",
|
||||||
"InhibitorsPresent", "Products", "Reactants", "ReactantsAbsent",
|
"getGuardProducts", "getGuardReactants", "getIdentifier",
|
||||||
"SystemContext", "SystemEntities", "[", "\"", "]", "^", "^^", "edge",
|
"getNextProcesses", "getRepeatedCounter", "getRepeatedProcess", "getSet",
|
||||||
"else", "empty", "false", "for", "if", "in", "label", "length", "let",
|
"Inhibitors", "InhibitorsPresent", "isGuarded", "isIdentifier", "isNill",
|
||||||
"neighbours", "not", "rand", "return", "source", "system", "target", "then",
|
"isNondeterministicChoice", "isRepeated", "isSet", "isSummation",
|
||||||
"toel", "tostr", "true", "{", "||", "}", "node", "entities",
|
"Products", "Reactants", "ReactantsAbsent", "SystemContext",
|
||||||
|
"SystemEntities", "[", "\"", "]", "^", "^^", "edge", "else", "empty",
|
||||||
|
"entities", "false", "for", "if", "in", "label", "length", "let",
|
||||||
|
"neighbours", "node", "not", "rand", "return", "source", "system", "target",
|
||||||
|
"then", "toel", "tostr", "true", "{", "||", "}",
|
||||||
} else {
|
} else {
|
||||||
r"[0-9]+" => NUMBER
|
r"[0-9]+" => NUMBER
|
||||||
} else {
|
} else {
|
||||||
@ -249,6 +253,26 @@ GroupQualifierSystem: grouping::QualifierSystem = {
|
|||||||
"SystemContext" => grouping::QualifierSystem::Context,
|
"SystemContext" => grouping::QualifierSystem::Context,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GroupQualifierContext: grouping::QualifierContext = {
|
||||||
|
"isNill" => grouping::QualifierContext::IsNill,
|
||||||
|
"isIdentifier" => grouping::QualifierContext::IsIdentifier,
|
||||||
|
"isSet" => grouping::QualifierContext::IsSet,
|
||||||
|
"isGuarded" => grouping::QualifierContext::IsGuarded,
|
||||||
|
"isRepeated" => grouping::QualifierContext::IsRepeated,
|
||||||
|
"isSummation" => grouping::QualifierContext::IsSummation,
|
||||||
|
"isNondeterministicChoice" => grouping::QualifierContext::IsNondeterministicChoice,
|
||||||
|
|
||||||
|
"getIdentifier" => grouping::QualifierContext::GetIdentifier,
|
||||||
|
"getSet" => grouping::QualifierContext::GetSet,
|
||||||
|
"getGuardReactants" => grouping::QualifierContext::GetGuardReactants,
|
||||||
|
"getGuardInhibitors" => grouping::QualifierContext::GetGuardInhibitors,
|
||||||
|
"getGuardProducts" => grouping::QualifierContext::GetGuardProducts,
|
||||||
|
"getRepeatedCounter" => grouping::QualifierContext::GetRepeatedCounter,
|
||||||
|
"getRepeatedProcess" => grouping::QualifierContext::GetRepeatedProcess,
|
||||||
|
|
||||||
|
"getNextProcesses" => grouping::QualifierContext::GetNextProcesses,
|
||||||
|
}
|
||||||
|
|
||||||
GroupQualifierEdge: grouping::QualifierEdge = {
|
GroupQualifierEdge: grouping::QualifierEdge = {
|
||||||
"source" => grouping::QualifierEdge::Source,
|
"source" => grouping::QualifierEdge::Source,
|
||||||
"target" => grouping::QualifierEdge::Target,
|
"target" => grouping::QualifierEdge::Target,
|
||||||
@ -262,6 +286,7 @@ GroupQualifierNode: grouping::QualifierNode = {
|
|||||||
|
|
||||||
GroupQualifier: grouping::Qualifier = {
|
GroupQualifier: grouping::Qualifier = {
|
||||||
<q: GroupQualifierSystem> => grouping::Qualifier::System(q),
|
<q: GroupQualifierSystem> => grouping::Qualifier::System(q),
|
||||||
|
<q: GroupQualifierContext> => grouping::Qualifier::Context(q),
|
||||||
<q: GroupQualifierLabel> => grouping::Qualifier::Label(q),
|
<q: GroupQualifierLabel> => grouping::Qualifier::Label(q),
|
||||||
<q: GroupQualifierRestricted> => grouping::Qualifier::Restricted(q),
|
<q: GroupQualifierRestricted> => grouping::Qualifier::Restricted(q),
|
||||||
<q: GroupQualifierEdge> => grouping::Qualifier::Edge(q),
|
<q: GroupQualifierEdge> => grouping::Qualifier::Edge(q),
|
||||||
|
|||||||
@ -23,9 +23,12 @@ match {
|
|||||||
"AvailableEntities", "Context", "Entities", "Inhibitors",
|
"AvailableEntities", "Context", "Entities", "Inhibitors",
|
||||||
"InhibitorsPresent", "Products", "Reactants", "ReactantsAbsent",
|
"InhibitorsPresent", "Products", "Reactants", "ReactantsAbsent",
|
||||||
"SystemContext", "SystemEntities", "[", "\"", "]", "^", "^^", "edge",
|
"SystemContext", "SystemEntities", "[", "\"", "]", "^", "^^", "edge",
|
||||||
"else", "empty", "false", "for", "if", "in", "label", "length", "let",
|
"else", "empty", "false", "for", "getGuardProducts", "getGuardReactants",
|
||||||
"neighbours", "not", "rand", "return", "source", "system", "target", "then",
|
"getNextProcesses", "getRepeatedCounter", "getRepeatedProcess", "getSet",
|
||||||
"toel", "tostr", "true", "{", "||", "}",
|
"if", "in", "isGuarded", "isIdentifier", "isNill",
|
||||||
|
"isNondeterministicChoice", "isRepeated", "isSet", "isSummation", "label",
|
||||||
|
"length", "let", "neighbours", "not", "rand", "return", "source", "system",
|
||||||
|
"target", "then", "toel", "tostr", "true", "{", "||", "}",
|
||||||
} else {
|
} else {
|
||||||
r"[0-9]+" => NUMBER
|
r"[0-9]+" => NUMBER
|
||||||
} else {
|
} else {
|
||||||
@ -252,6 +255,24 @@ AssertQualifierSystem: positive_relabel::QualifierSystem = {
|
|||||||
"SystemContext" => positive_relabel::QualifierSystem::Context,
|
"SystemContext" => positive_relabel::QualifierSystem::Context,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AssertQualifierContext: positive_relabel::QualifierContext = {
|
||||||
|
"isNill" => positive_relabel::QualifierContext::IsNill,
|
||||||
|
"isIdentifier" => positive_relabel::QualifierContext::IsIdentifier,
|
||||||
|
"isSet" => positive_relabel::QualifierContext::IsSet,
|
||||||
|
"isGuarded" => positive_relabel::QualifierContext::IsGuarded,
|
||||||
|
"isRepeated" => positive_relabel::QualifierContext::IsRepeated,
|
||||||
|
"isSummation" => positive_relabel::QualifierContext::IsSummation,
|
||||||
|
"isNondeterministicChoice" => positive_relabel::QualifierContext::IsNondeterministicChoice,
|
||||||
|
|
||||||
|
"getSet" => positive_relabel::QualifierContext::GetSet,
|
||||||
|
"getGuardReactants" => positive_relabel::QualifierContext::GetGuardReactants,
|
||||||
|
"getGuardProducts" => positive_relabel::QualifierContext::GetGuardProducts,
|
||||||
|
"getRepeatedCounter" => positive_relabel::QualifierContext::GetRepeatedCounter,
|
||||||
|
"getRepeatedProcess" => positive_relabel::QualifierContext::GetRepeatedProcess,
|
||||||
|
|
||||||
|
"getNextProcesses" => positive_relabel::QualifierContext::GetNextProcesses,
|
||||||
|
}
|
||||||
|
|
||||||
AssertQualifierEdge: positive_relabel::QualifierEdge = {
|
AssertQualifierEdge: positive_relabel::QualifierEdge = {
|
||||||
"source" => positive_relabel::QualifierEdge::Source,
|
"source" => positive_relabel::QualifierEdge::Source,
|
||||||
"target" => positive_relabel::QualifierEdge::Target,
|
"target" => positive_relabel::QualifierEdge::Target,
|
||||||
@ -265,6 +286,7 @@ AssertQualifierNode: positive_relabel::QualifierNode = {
|
|||||||
|
|
||||||
AssertQualifier: positive_relabel::PositiveQualifier = {
|
AssertQualifier: positive_relabel::PositiveQualifier = {
|
||||||
<q: AssertQualifierSystem> => positive_relabel::PositiveQualifier::System(q),
|
<q: AssertQualifierSystem> => positive_relabel::PositiveQualifier::System(q),
|
||||||
|
<q: AssertQualifierContext> => positive_relabel::PositiveQualifier::Context(q),
|
||||||
<q: AssertQualifierLabel> => positive_relabel::PositiveQualifier::Label(q),
|
<q: AssertQualifierLabel> => positive_relabel::PositiveQualifier::Label(q),
|
||||||
<q: AssertQualifierRestricted> => positive_relabel::PositiveQualifier::Restricted(q),
|
<q: AssertQualifierRestricted> => positive_relabel::PositiveQualifier::Restricted(q),
|
||||||
<q: AssertQualifierEdge> => positive_relabel::PositiveQualifier::Edge(q),
|
<q: AssertQualifierEdge> => positive_relabel::PositiveQualifier::Edge(q),
|
||||||
|
|||||||
@ -24,9 +24,12 @@ match {
|
|||||||
"AvailableEntities", "Context", "Entities", "Inhibitors",
|
"AvailableEntities", "Context", "Entities", "Inhibitors",
|
||||||
"InhibitorsPresent", "Products", "Reactants", "ReactantsAbsent",
|
"InhibitorsPresent", "Products", "Reactants", "ReactantsAbsent",
|
||||||
"SystemContext", "SystemEntities", "[", "\"", "]", "^", "^^", "edge",
|
"SystemContext", "SystemEntities", "[", "\"", "]", "^", "^^", "edge",
|
||||||
"else", "empty", "false", "for", "if", "in", "label", "length", "let",
|
"else", "empty", "false", "for", "getGuardProducts", "getGuardReactants",
|
||||||
"neighbours", "not", "rand", "return", "source", "system", "target", "then",
|
"getNextProcesses", "getRepeatedCounter", "getRepeatedProcess", "getSet",
|
||||||
"toel", "tostr", "true", "{", "||", "}", "node",
|
"if", "in", "isGuarded", "isIdentifier", "isNill",
|
||||||
|
"isNondeterministicChoice", "isRepeated", "isSet", "isSummation", "label",
|
||||||
|
"length", "let", "neighbours", "node", "not", "rand", "return", "source",
|
||||||
|
"system", "target", "then", "toel", "tostr", "true", "{", "||", "}",
|
||||||
} else {
|
} else {
|
||||||
r"[0-9]+" => NUMBER
|
r"[0-9]+" => NUMBER
|
||||||
} else {
|
} else {
|
||||||
@ -253,6 +256,24 @@ GroupQualifierSystem: positive_grouping::QualifierSystem = {
|
|||||||
"SystemContext" => positive_grouping::QualifierSystem::Context,
|
"SystemContext" => positive_grouping::QualifierSystem::Context,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GroupQualifierContext: positive_grouping::QualifierContext = {
|
||||||
|
"isNill" => positive_grouping::QualifierContext::IsNill,
|
||||||
|
"isIdentifier" => positive_grouping::QualifierContext::IsIdentifier,
|
||||||
|
"isSet" => positive_grouping::QualifierContext::IsSet,
|
||||||
|
"isGuarded" => positive_grouping::QualifierContext::IsGuarded,
|
||||||
|
"isRepeated" => positive_grouping::QualifierContext::IsRepeated,
|
||||||
|
"isSummation" => positive_grouping::QualifierContext::IsSummation,
|
||||||
|
"isNondeterministicChoice" => positive_grouping::QualifierContext::IsNondeterministicChoice,
|
||||||
|
|
||||||
|
"getSet" => positive_grouping::QualifierContext::GetSet,
|
||||||
|
"getGuardReactants" => positive_grouping::QualifierContext::GetGuardReactants,
|
||||||
|
"getGuardProducts" => positive_grouping::QualifierContext::GetGuardProducts,
|
||||||
|
"getRepeatedCounter" => positive_grouping::QualifierContext::GetRepeatedCounter,
|
||||||
|
"getRepeatedProcess" => positive_grouping::QualifierContext::GetRepeatedProcess,
|
||||||
|
|
||||||
|
"getNextProcesses" => positive_grouping::QualifierContext::GetNextProcesses,
|
||||||
|
}
|
||||||
|
|
||||||
GroupQualifierEdge: positive_grouping::QualifierEdge = {
|
GroupQualifierEdge: positive_grouping::QualifierEdge = {
|
||||||
"source" => positive_grouping::QualifierEdge::Source,
|
"source" => positive_grouping::QualifierEdge::Source,
|
||||||
"target" => positive_grouping::QualifierEdge::Target,
|
"target" => positive_grouping::QualifierEdge::Target,
|
||||||
@ -266,6 +287,7 @@ GroupQualifierNode: positive_grouping::QualifierNode = {
|
|||||||
|
|
||||||
GroupQualifier: positive_grouping::PositiveQualifier = {
|
GroupQualifier: positive_grouping::PositiveQualifier = {
|
||||||
<q: GroupQualifierSystem> => positive_grouping::PositiveQualifier::System(q),
|
<q: GroupQualifierSystem> => positive_grouping::PositiveQualifier::System(q),
|
||||||
|
<q: GroupQualifierContext> => positive_grouping::PositiveQualifier::Context(q),
|
||||||
<q: GroupQualifierLabel> => positive_grouping::PositiveQualifier::Label(q),
|
<q: GroupQualifierLabel> => positive_grouping::PositiveQualifier::Label(q),
|
||||||
<q: GroupQualifierRestricted> => positive_grouping::PositiveQualifier::Restricted(q),
|
<q: GroupQualifierRestricted> => positive_grouping::PositiveQualifier::Restricted(q),
|
||||||
<q: GroupQualifierEdge> => positive_grouping::PositiveQualifier::Edge(q),
|
<q: GroupQualifierEdge> => positive_grouping::PositiveQualifier::Edge(q),
|
||||||
|
|||||||
Reference in New Issue
Block a user