fmt
This commit is contained in:
@ -100,8 +100,8 @@ pub enum BasicValue {
|
||||
value: (Vec<u32>, Vec<rsprocess::set::Set>),
|
||||
},
|
||||
Graph {
|
||||
value: petgraph::Graph<rsprocess::system::System,
|
||||
rsprocess::label::Label>,
|
||||
value:
|
||||
petgraph::Graph<rsprocess::system::System, rsprocess::label::Label>,
|
||||
},
|
||||
AssertFunction {
|
||||
value: assert::relabel::Assert,
|
||||
@ -160,8 +160,10 @@ pub enum BasicValue {
|
||||
value: Vec<rsprocess::reaction::PositiveReaction>,
|
||||
},
|
||||
PositiveGraph {
|
||||
value: petgraph::Graph<rsprocess::system::PositiveSystem,
|
||||
rsprocess::label::PositiveLabel>,
|
||||
value: petgraph::Graph<
|
||||
rsprocess::system::PositiveSystem,
|
||||
rsprocess::label::PositiveLabel,
|
||||
>,
|
||||
},
|
||||
GroupFunction {
|
||||
value: assert::grouping::Assert,
|
||||
@ -436,16 +438,24 @@ impl NodeInstruction {
|
||||
| Self::ToPositiveContext => vec![("value", Context)],
|
||||
| Self::ToPositiveEnvironment => vec![("value", Environment)],
|
||||
| Self::ToPositiveReactions => vec![("value", Reactions)],
|
||||
| Self::OverwriteContextEntities => vec![("system", System), ("elements", Set)],
|
||||
| Self::OverwriteReactionEntities => vec![("system", System), ("elements", Set)],
|
||||
| Self::PositiveOverwriteContextEntities => vec![("system", PositiveSystem), ("elements", PositiveSet)],
|
||||
| Self::PositiveOverwriteReactionEntities => vec![("system", PositiveSystem), ("elements", PositiveSet)],
|
||||
| Self::OverwriteContextEntities =>
|
||||
vec![("system", System), ("elements", Set)],
|
||||
| Self::OverwriteReactionEntities =>
|
||||
vec![("system", System), ("elements", Set)],
|
||||
| Self::PositiveOverwriteContextEntities =>
|
||||
vec![("system", PositiveSystem), ("elements", PositiveSet)],
|
||||
| Self::PositiveOverwriteReactionEntities =>
|
||||
vec![("system", PositiveSystem), ("elements", PositiveSet)],
|
||||
| Self::PositiveGraph => vec![("sys", PositiveSystem)],
|
||||
| Self::GroupFunction => vec![("value", String)],
|
||||
| Self::GroupNodes => vec![("graph", Graph), ("grouping", GroupFunction)],
|
||||
| Self::GroupNodes =>
|
||||
vec![("graph", Graph), ("grouping", GroupFunction)],
|
||||
| Self::PositiveAssertFunction => vec![("value", String)],
|
||||
| Self::PositiveGroupFunction => vec![("value", String)],
|
||||
| Self::PositiveGroupNodes => vec![("graph", PositiveGraph), ("grouping", PositiveGroupFunction)],
|
||||
| Self::PositiveGroupNodes => vec![
|
||||
("graph", PositiveGraph),
|
||||
("grouping", PositiveGroupFunction),
|
||||
],
|
||||
| Self::PositiveDot => vec![
|
||||
("graph", PositiveGraph),
|
||||
("display node", DisplayNode),
|
||||
@ -548,21 +558,29 @@ impl NodeInstruction {
|
||||
| Self::ToPositiveReactions => vec![("out", PositiveReactions)],
|
||||
| Self::OverwriteContextEntities => vec![("out", System)],
|
||||
| Self::OverwriteReactionEntities => vec![("out", System)],
|
||||
| Self::PositiveOverwriteContextEntities => vec![("out", PositiveSystem)],
|
||||
| Self::PositiveOverwriteReactionEntities => vec![("out", PositiveSystem)],
|
||||
| Self::PositiveOverwriteContextEntities =>
|
||||
vec![("out", PositiveSystem)],
|
||||
| Self::PositiveOverwriteReactionEntities =>
|
||||
vec![("out", PositiveSystem)],
|
||||
| Self::PositiveGraph => vec![("out", PositiveGraph)],
|
||||
| Self::PositiveDot => vec![("out", String)],
|
||||
| Self::PositiveGraphML => vec![("out", String)],
|
||||
| Self::GroupFunction => vec![("out", GroupFunction)],
|
||||
| Self::GroupNodes => vec![("out", Graph)],
|
||||
| Self::PositiveAssertFunction => vec![("out", PositiveAssertFunction)],
|
||||
| Self::PositiveGroupFunction => vec![("out", PositiveGroupFunction)],
|
||||
| Self::PositiveAssertFunction =>
|
||||
vec![("out", PositiveAssertFunction)],
|
||||
| Self::PositiveGroupFunction =>
|
||||
vec![("out", PositiveGroupFunction)],
|
||||
| Self::PositiveGroupNodes => vec![("out", PositiveGraph)],
|
||||
| Self::PositiveBisimilarityKanellakisSmolka => vec![("out", String)],
|
||||
| Self::PositiveBisimilarityPaigeTarjanNoLabels => vec![("out", String)],
|
||||
| Self::PositiveBisimilarityKanellakisSmolka =>
|
||||
vec![("out", String)],
|
||||
| Self::PositiveBisimilarityPaigeTarjanNoLabels =>
|
||||
vec![("out", String)],
|
||||
| Self::PositiveBisimilarityPaigeTarjan => vec![("out", String)],
|
||||
};
|
||||
res.into_iter().map(|res| (res.0.to_string(), res.1)).collect::<_>()
|
||||
res.into_iter()
|
||||
.map(|res| (res.0.to_string(), res.1))
|
||||
.collect::<_>()
|
||||
}
|
||||
|
||||
#[allow(clippy::type_complexity)]
|
||||
@ -640,20 +658,28 @@ impl NodeInstruction {
|
||||
),
|
||||
| BasicDataType::PositiveSet =>
|
||||
helper!(PositiveSet, rsprocess::set::PositiveSet::default()),
|
||||
| BasicDataType::PositiveEnvironment =>
|
||||
helper!(PositiveEnvironment, rsprocess::environment::PositiveEnvironment::default()),
|
||||
| BasicDataType::PositiveContext =>
|
||||
helper!(PositiveContext, rsprocess::process::PositiveProcess::default()),
|
||||
| BasicDataType::PositiveEnvironment => helper!(
|
||||
PositiveEnvironment,
|
||||
rsprocess::environment::PositiveEnvironment::default()
|
||||
),
|
||||
| BasicDataType::PositiveContext => helper!(
|
||||
PositiveContext,
|
||||
rsprocess::process::PositiveProcess::default()
|
||||
),
|
||||
| BasicDataType::PositiveReactions =>
|
||||
helper!(PositiveReactions, vec![]),
|
||||
| BasicDataType::PositiveGraph =>
|
||||
helper!(PositiveGraph, petgraph::Graph::new()),
|
||||
| BasicDataType::GroupFunction =>
|
||||
helper!(GroupFunction, assert::grouping::Assert::default()),
|
||||
| BasicDataType::PositiveAssertFunction =>
|
||||
helper!(PositiveAssertFunction, assert::positive_relabel::PositiveAssert::default()),
|
||||
| BasicDataType::PositiveGroupFunction =>
|
||||
helper!(PositiveGroupFunction, assert::positive_grouping::PositiveAssert::default()),
|
||||
| BasicDataType::PositiveAssertFunction => helper!(
|
||||
PositiveAssertFunction,
|
||||
assert::positive_relabel::PositiveAssert::default()
|
||||
),
|
||||
| BasicDataType::PositiveGroupFunction => helper!(
|
||||
PositiveGroupFunction,
|
||||
assert::positive_grouping::PositiveAssert::default()
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@ -699,13 +725,16 @@ impl NodeInstruction {
|
||||
| BasicDataType::Trace => helper!(Trace),
|
||||
| BasicDataType::PositiveTrace => helper!(PositiveTrace),
|
||||
| BasicDataType::PositiveSet => helper!(PositiveSet),
|
||||
| BasicDataType::PositiveEnvironment => helper!(PositiveEnvironment),
|
||||
| BasicDataType::PositiveEnvironment =>
|
||||
helper!(PositiveEnvironment),
|
||||
| BasicDataType::PositiveContext => helper!(PositiveContext),
|
||||
| BasicDataType::PositiveReactions => helper!(PositiveReactions),
|
||||
| BasicDataType::PositiveGraph => helper!(PositiveGraph),
|
||||
| BasicDataType::GroupFunction => helper!(GroupFunction),
|
||||
| BasicDataType::PositiveAssertFunction => helper!(PositiveAssertFunction),
|
||||
| BasicDataType::PositiveGroupFunction => helper!(PositiveGroupFunction),
|
||||
| BasicDataType::PositiveAssertFunction =>
|
||||
helper!(PositiveAssertFunction),
|
||||
| BasicDataType::PositiveGroupFunction =>
|
||||
helper!(PositiveGroupFunction),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -895,8 +924,10 @@ impl DataTypeTrait<GlobalState> for BasicDataType {
|
||||
| Self::PositiveReactions => egui::Color32::from_rgb(50, 10, 20),
|
||||
| Self::PositiveGraph => egui::Color32::from_rgb(100, 130, 90),
|
||||
| Self::GroupFunction => egui::Color32::from_rgb(0, 0, 0),
|
||||
| Self::PositiveAssertFunction => egui::Color32::from_rgb(200, 150, 120),
|
||||
| Self::PositiveGroupFunction => egui::Color32::from_rgb(150, 120, 200),
|
||||
| Self::PositiveAssertFunction =>
|
||||
egui::Color32::from_rgb(200, 150, 120),
|
||||
| Self::PositiveGroupFunction =>
|
||||
egui::Color32::from_rgb(150, 120, 200),
|
||||
}
|
||||
}
|
||||
|
||||
@ -924,13 +955,16 @@ impl DataTypeTrait<GlobalState> for BasicDataType {
|
||||
| Self::Trace => Cow::Borrowed("trace"),
|
||||
| Self::PositiveTrace => Cow::Borrowed("positive trace"),
|
||||
| Self::PositiveSet => Cow::Borrowed("positive set"),
|
||||
| Self::PositiveEnvironment => Cow::Borrowed("positive environment"),
|
||||
| Self::PositiveEnvironment =>
|
||||
Cow::Borrowed("positive environment"),
|
||||
| Self::PositiveContext => Cow::Borrowed("positive context"),
|
||||
| Self::PositiveReactions => Cow::Borrowed("positive reactions"),
|
||||
| Self::PositiveGraph => Cow::Borrowed("positive graph"),
|
||||
| Self::GroupFunction => Cow::Borrowed("grouping function"),
|
||||
| Self::PositiveAssertFunction => Cow::Borrowed("positive assert function"),
|
||||
| Self::PositiveGroupFunction => Cow::Borrowed("positive group function"),
|
||||
| Self::PositiveAssertFunction =>
|
||||
Cow::Borrowed("positive assert function"),
|
||||
| Self::PositiveGroupFunction =>
|
||||
Cow::Borrowed("positive group function"),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -947,7 +981,8 @@ impl NodeTemplateTrait for NodeInstruction {
|
||||
&self,
|
||||
_user_state: &mut Self::UserState,
|
||||
) -> Cow<'_, str> {
|
||||
Cow::Borrowed(match self { // TODO rename to something more appropriate
|
||||
Cow::Borrowed(match self {
|
||||
// TODO rename to something more appropriate
|
||||
| Self::String => "String",
|
||||
| Self::Path => "Path",
|
||||
| Self::ReadPath => "Read a file",
|
||||
@ -995,7 +1030,7 @@ impl NodeTemplateTrait for NodeInstruction {
|
||||
| Self::ToPositiveSet => "Convert to Positive Set",
|
||||
| Self::PositiveComposeSystem => "Compose a positive system",
|
||||
| Self::DecomposeSystem => "Decompose a system",
|
||||
| Self::PositiveDecomposeSystem => "Decompose a positive system",
|
||||
| Self::PositiveDecomposeSystem => "Decompose a positive system",
|
||||
| Self::TraceToString => "Trace to string",
|
||||
| Self::PositiveTraceToString => "Positive trace to string",
|
||||
| Self::PositiveEnvironment => "Positive Environment",
|
||||
@ -1006,19 +1041,26 @@ impl NodeTemplateTrait for NodeInstruction {
|
||||
| Self::ToPositiveReactions => "Convert to Positive Reactions",
|
||||
| Self::OverwriteContextEntities => "Overwrite context entities",
|
||||
| Self::OverwriteReactionEntities => "Overwirite reaction entities",
|
||||
| Self::PositiveOverwriteContextEntities => "Overwrite context entities of Positive System",
|
||||
| Self::PositiveOverwriteReactionEntities => "Overwrite reaction entities of Positive System",
|
||||
| Self::PositiveOverwriteContextEntities =>
|
||||
"Overwrite context entities of Positive System",
|
||||
| Self::PositiveOverwriteReactionEntities =>
|
||||
"Overwrite reaction entities of Positive System",
|
||||
| Self::PositiveGraph => "Graph of a Positive System",
|
||||
| Self::PositiveDot => "Create Dot file of Positive System",
|
||||
| Self::PositiveGraphML => "Create GraphML file of Positive System",
|
||||
| Self::GroupFunction => "Grouping Function",
|
||||
| Self::GroupNodes => "Group Nodes",
|
||||
| Self::PositiveAssertFunction => "Positive Grouping of Edges on Graph",
|
||||
| Self::PositiveGroupFunction => "Positive Grouping of Nodes on Graph",
|
||||
| Self::PositiveAssertFunction =>
|
||||
"Positive Grouping of Edges on Graph",
|
||||
| Self::PositiveGroupFunction =>
|
||||
"Positive Grouping of Nodes on Graph",
|
||||
| Self::PositiveGroupNodes => "Positive Group Nodes",
|
||||
| Self::PositiveBisimilarityKanellakisSmolka => "Positive Bisimilarity Kanellakis & Smolka",
|
||||
| Self::PositiveBisimilarityPaigeTarjanNoLabels => "Positive Paige & Torjan (ignore labels)",
|
||||
| Self::PositiveBisimilarityPaigeTarjan => "Positive Paige & Torjan",
|
||||
| Self::PositiveBisimilarityKanellakisSmolka =>
|
||||
"Positive Bisimilarity Kanellakis & Smolka",
|
||||
| Self::PositiveBisimilarityPaigeTarjanNoLabels =>
|
||||
"Positive Paige & Torjan (ignore labels)",
|
||||
| Self::PositiveBisimilarityPaigeTarjan =>
|
||||
"Positive Paige & Torjan",
|
||||
})
|
||||
}
|
||||
|
||||
@ -1027,7 +1069,8 @@ impl NodeTemplateTrait for NodeInstruction {
|
||||
&self,
|
||||
_user_state: &mut Self::UserState,
|
||||
) -> Vec<&'static str> {
|
||||
match self { // TODO reorder?
|
||||
match self {
|
||||
// TODO reorder?
|
||||
| Self::String
|
||||
| Self::Path
|
||||
| Self::ReadPath
|
||||
@ -1046,9 +1089,8 @@ impl NodeTemplateTrait for NodeInstruction {
|
||||
| Self::DecomposeSystem
|
||||
| Self::OverwriteContextEntities
|
||||
| Self::OverwriteReactionEntities => vec!["System"],
|
||||
| Self::Frequency
|
||||
| Self::LimitFrequency
|
||||
| Self::FastFrequency => vec!["System", "Frequency"],
|
||||
| Self::Frequency | Self::LimitFrequency | Self::FastFrequency =>
|
||||
vec!["System", "Frequency"],
|
||||
| Self::Experiment => vec!["Frequency", "Positive Frequency"],
|
||||
| Self::BisimilarityKanellakisSmolka
|
||||
| Self::BisimilarityPaigeTarjanNoLabels
|
||||
@ -1065,7 +1107,8 @@ impl NodeTemplateTrait for NodeInstruction {
|
||||
| Self::GraphML => vec!["Graph"],
|
||||
| Self::PositiveFrequency
|
||||
| Self::PositiveLimitFrequency
|
||||
| Self::PositiveFastFrequency => vec!["Positive System", "Positive Frequency"],
|
||||
| Self::PositiveFastFrequency =>
|
||||
vec!["Positive System", "Positive Frequency"],
|
||||
| Self::PositiveSystem
|
||||
| Self::PositiveTarget
|
||||
| Self::PositiveRun
|
||||
@ -1081,13 +1124,15 @@ impl NodeTemplateTrait for NodeInstruction {
|
||||
| Self::ToPositiveEnvironment
|
||||
| Self::ToPositiveReactions
|
||||
| Self::PositiveOverwriteContextEntities
|
||||
| Self::PositiveOverwriteReactionEntities => vec!["Positive System"],
|
||||
| Self::PositiveOverwriteReactionEntities =>
|
||||
vec!["Positive System"],
|
||||
| Self::PositiveGraph
|
||||
| Self::PositiveDot
|
||||
| Self::PositiveGraphML
|
||||
| Self::PositiveAssertFunction => vec!["Positive System", "Positive Graph"],
|
||||
| Self::PositiveGroupFunction
|
||||
| Self::PositiveGroupNodes => vec!["Positive Graph"],
|
||||
| Self::PositiveAssertFunction =>
|
||||
vec!["Positive System", "Positive Graph"],
|
||||
| Self::PositiveGroupFunction | Self::PositiveGroupNodes =>
|
||||
vec!["Positive Graph"],
|
||||
| Self::Trace => vec!["Trace", "System"],
|
||||
| Self::PositiveTrace => vec!["Trace", "Positive System"],
|
||||
| Self::SliceTrace
|
||||
@ -1096,7 +1141,8 @@ impl NodeTemplateTrait for NodeInstruction {
|
||||
| Self::PositiveTraceToString => vec!["Trace"],
|
||||
| Self::PositiveBisimilarityKanellakisSmolka
|
||||
| Self::PositiveBisimilarityPaigeTarjanNoLabels
|
||||
| Self::PositiveBisimilarityPaigeTarjan => vec!["Positive Graph", "Positive Bisimilarity"],
|
||||
| Self::PositiveBisimilarityPaigeTarjan =>
|
||||
vec!["Positive Graph", "Positive Bisimilarity"],
|
||||
}
|
||||
}
|
||||
|
||||
@ -1371,7 +1417,7 @@ impl NodeDataTrait for NodeData {
|
||||
match (is_active, graph[node_id].user_data.template) {
|
||||
| (_, ni) if ni.output().len() > 1 => {
|
||||
// no buttons for nodes with more than one output
|
||||
}
|
||||
},
|
||||
| (_, NodeInstruction::SaveString) => {
|
||||
// no need to see the output, just write to file
|
||||
if ui.button("Write").clicked() {
|
||||
@ -1385,20 +1431,22 @@ impl NodeDataTrait for NodeData {
|
||||
// file
|
||||
let button = egui::Button::new(
|
||||
egui::RichText::new("👁 Active").color(egui::Color32::BLACK),
|
||||
).fill(egui::Color32::GOLD);
|
||||
)
|
||||
.fill(egui::Color32::GOLD);
|
||||
if ui.add(button).clicked() {
|
||||
responses.push(NodeResponse::User(
|
||||
CustomResponse::ClearActiveNode,
|
||||
));
|
||||
}
|
||||
|
||||
let button = egui::Button::new(egui::RichText::new("Update file"));
|
||||
let button =
|
||||
egui::Button::new(egui::RichText::new("Update file"));
|
||||
if ui.add(button).clicked() {
|
||||
responses.push(NodeResponse::User(
|
||||
CustomResponse::FieldModified(node_id),
|
||||
));
|
||||
}
|
||||
}
|
||||
},
|
||||
| (false, NodeInstruction::ReadPath) => {
|
||||
// since no filewatcher we simply give the option to reload the
|
||||
// file
|
||||
@ -1407,13 +1455,14 @@ impl NodeDataTrait for NodeData {
|
||||
CustomResponse::SetActiveNode(node_id),
|
||||
));
|
||||
}
|
||||
let button = egui::Button::new(egui::RichText::new("Update file"));
|
||||
let button =
|
||||
egui::Button::new(egui::RichText::new("Update file"));
|
||||
if ui.add(button).clicked() {
|
||||
responses.push(NodeResponse::User(
|
||||
CustomResponse::FieldModified(node_id),
|
||||
));
|
||||
}
|
||||
}
|
||||
},
|
||||
| (true, _) => {
|
||||
let button = egui::Button::new(
|
||||
egui::RichText::new("👁 Active").color(egui::Color32::BLACK),
|
||||
@ -1630,8 +1679,10 @@ impl eframe::App for AppHandle {
|
||||
},
|
||||
| NodeResponse::User(CustomResponse::FieldModified(node)) => {
|
||||
self.user_state.cache.invalidate_last_state();
|
||||
self.user_state.cache.invalidate_outputs(&self.state.graph, *node);
|
||||
}
|
||||
self.user_state
|
||||
.cache
|
||||
.invalidate_outputs(&self.state.graph, *node);
|
||||
},
|
||||
| NodeResponse::DisconnectEvent { output, input: _ } => {
|
||||
self.user_state.cache.invalidate_cache(output);
|
||||
},
|
||||
@ -1896,15 +1947,18 @@ fn get_layout(
|
||||
),
|
||||
| BasicValue::PositiveSet { value } => text.append(
|
||||
&format!("{}", Formatter::from(translator, &value)),
|
||||
0., Default::default(),
|
||||
0.,
|
||||
Default::default(),
|
||||
),
|
||||
| BasicValue::PositiveEnvironment { value } => text.append(
|
||||
&format!("{}", Formatter::from(translator, &value)),
|
||||
0., Default::default(),
|
||||
0.,
|
||||
Default::default(),
|
||||
),
|
||||
| BasicValue::PositiveContext { value } => text.append(
|
||||
&format!("{}", Formatter::from(translator, &value)),
|
||||
0., Default::default(),
|
||||
0.,
|
||||
Default::default(),
|
||||
),
|
||||
| BasicValue::PositiveReactions { value } => {
|
||||
text.append("(", 0., TextFormat {
|
||||
|
||||
@ -38,15 +38,9 @@ pub fn evaluate_node(
|
||||
// populates the cache
|
||||
for node_id in to_evaluate {
|
||||
let node = &graph[node_id];
|
||||
let outputs = graph[node_id]
|
||||
.user_data
|
||||
.template
|
||||
.output();
|
||||
let outputs = graph[node_id].user_data.template.output();
|
||||
let output_names =
|
||||
outputs
|
||||
.iter()
|
||||
.map(|el| el.0.as_str())
|
||||
.collect::<Vec<_>>();
|
||||
outputs.iter().map(|el| el.0.as_str()).collect::<Vec<_>>();
|
||||
|
||||
match process_template(
|
||||
graph,
|
||||
@ -312,7 +306,6 @@ fn process_template(
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
match template {
|
||||
| NodeInstruction::String => {
|
||||
let s = retrieve_from_cache![1];
|
||||
@ -320,7 +313,11 @@ fn process_template(
|
||||
|
||||
if let BasicValue::String { value: _ } = s {
|
||||
let res = s;
|
||||
set_cache_output!((output_names.first().unwrap(), res, hash_inputs));
|
||||
set_cache_output!((
|
||||
output_names.first().unwrap(),
|
||||
res,
|
||||
hash_inputs
|
||||
));
|
||||
} else {
|
||||
anyhow::bail!("Not a string");
|
||||
}
|
||||
@ -331,7 +328,11 @@ fn process_template(
|
||||
|
||||
if let BasicValue::String { value } = s {
|
||||
let res = BasicValue::Path { value };
|
||||
set_cache_output!((output_names.first().unwrap(), res, hash_inputs));
|
||||
set_cache_output!((
|
||||
output_names.first().unwrap(),
|
||||
res,
|
||||
hash_inputs
|
||||
));
|
||||
} else {
|
||||
anyhow::bail!("Not a string");
|
||||
}
|
||||
@ -352,7 +353,11 @@ fn process_template(
|
||||
})),
|
||||
};
|
||||
let res = BasicValue::String { value: file };
|
||||
set_cache_output!((output_names.first().unwrap(), res, hash_inputs));
|
||||
set_cache_output!((
|
||||
output_names.first().unwrap(),
|
||||
res,
|
||||
hash_inputs
|
||||
));
|
||||
} else {
|
||||
anyhow::bail!("Not a path");
|
||||
}
|
||||
@ -377,7 +382,11 @@ fn process_template(
|
||||
},
|
||||
};
|
||||
let res = BasicValue::System { value: sys };
|
||||
set_cache_output!((output_names.first().unwrap(), res, hash_inputs));
|
||||
set_cache_output!((
|
||||
output_names.first().unwrap(),
|
||||
res,
|
||||
hash_inputs
|
||||
));
|
||||
} else {
|
||||
anyhow::bail!("Not a string");
|
||||
}
|
||||
@ -390,7 +399,11 @@ fn process_template(
|
||||
let res = BasicValue::String {
|
||||
value: value.statistics(translator),
|
||||
};
|
||||
set_cache_output!((output_names.first().unwrap(), res, hash_inputs));
|
||||
set_cache_output!((
|
||||
output_names.first().unwrap(),
|
||||
res,
|
||||
hash_inputs
|
||||
));
|
||||
} else {
|
||||
anyhow::bail!("Not a system");
|
||||
}
|
||||
@ -422,7 +435,11 @@ fn process_template(
|
||||
Formatter::from(translator, &limit.1)
|
||||
),
|
||||
};
|
||||
set_cache_output!((output_names.first().unwrap(), res, hash_inputs));
|
||||
set_cache_output!((
|
||||
output_names.first().unwrap(),
|
||||
res,
|
||||
hash_inputs
|
||||
));
|
||||
},
|
||||
| (BasicValue::System { value: _ }, _) =>
|
||||
anyhow::bail!("Not an integer"),
|
||||
@ -462,7 +479,11 @@ fn process_template(
|
||||
));
|
||||
}
|
||||
let res = BasicValue::String { value: output };
|
||||
set_cache_output!((output_names.first().unwrap(), res, hash_inputs));
|
||||
set_cache_output!((
|
||||
output_names.first().unwrap(),
|
||||
res,
|
||||
hash_inputs
|
||||
));
|
||||
},
|
||||
| (BasicValue::System { value: _ }, _) =>
|
||||
anyhow::bail!("Not an integer"),
|
||||
@ -497,7 +518,11 @@ fn process_template(
|
||||
));
|
||||
}
|
||||
let res = BasicValue::String { value: output };
|
||||
set_cache_output!((output_names.first().unwrap(), res, hash_inputs));
|
||||
set_cache_output!((
|
||||
output_names.first().unwrap(),
|
||||
res,
|
||||
hash_inputs
|
||||
));
|
||||
},
|
||||
| (BasicValue::System { value: _ }, _) =>
|
||||
anyhow::bail!("Not an integer"),
|
||||
@ -512,7 +537,11 @@ fn process_template(
|
||||
|
||||
if let BasicValue::String { value } = s {
|
||||
let res = BasicValue::Symbol { value };
|
||||
set_cache_output!((output_names.first().unwrap(), res, hash_inputs));
|
||||
set_cache_output!((
|
||||
output_names.first().unwrap(),
|
||||
res,
|
||||
hash_inputs
|
||||
));
|
||||
} else {
|
||||
anyhow::bail!("Not a string");
|
||||
}
|
||||
@ -533,7 +562,11 @@ fn process_template(
|
||||
Formatter::from(translator, &res)
|
||||
);
|
||||
let res = BasicValue::String { value: output };
|
||||
set_cache_output!((output_names.first().unwrap(), res, hash_inputs));
|
||||
set_cache_output!((
|
||||
output_names.first().unwrap(),
|
||||
res,
|
||||
hash_inputs
|
||||
));
|
||||
} else {
|
||||
anyhow::bail!("Not a system");
|
||||
}
|
||||
@ -563,7 +596,11 @@ fn process_template(
|
||||
Formatter::from(translator, &l)
|
||||
),
|
||||
};
|
||||
set_cache_output!((output_names.first().unwrap(), res, hash_inputs));
|
||||
set_cache_output!((
|
||||
output_names.first().unwrap(),
|
||||
res,
|
||||
hash_inputs
|
||||
));
|
||||
},
|
||||
| (BasicValue::System { value: _ }, _) =>
|
||||
anyhow::bail!("Not an experiment"),
|
||||
@ -588,7 +625,11 @@ fn process_template(
|
||||
})),
|
||||
};
|
||||
let res = BasicValue::Experiment { value };
|
||||
set_cache_output!((output_names.first().unwrap(), res, hash_inputs));
|
||||
set_cache_output!((
|
||||
output_names.first().unwrap(),
|
||||
res,
|
||||
hash_inputs
|
||||
));
|
||||
} else {
|
||||
anyhow::bail!("Not a string");
|
||||
}
|
||||
@ -619,7 +660,11 @@ fn process_template(
|
||||
Formatter::from(translator, &l)
|
||||
),
|
||||
};
|
||||
set_cache_output!((output_names.first().unwrap(), res, hash_inputs));
|
||||
set_cache_output!((
|
||||
output_names.first().unwrap(),
|
||||
res,
|
||||
hash_inputs
|
||||
));
|
||||
},
|
||||
| (BasicValue::System { value: _ }, _) =>
|
||||
anyhow::bail!("Not an experiment"),
|
||||
@ -654,7 +699,11 @@ fn process_template(
|
||||
let res = BasicValue::String {
|
||||
value: format!("{l}"),
|
||||
};
|
||||
set_cache_output!((output_names.first().unwrap(), res, hash_inputs));
|
||||
set_cache_output!((
|
||||
output_names.first().unwrap(),
|
||||
res,
|
||||
hash_inputs
|
||||
));
|
||||
},
|
||||
| (_, _, _) => anyhow::bail!("Invalid inputs to bisimilarity."),
|
||||
}
|
||||
@ -679,11 +728,15 @@ fn process_template(
|
||||
},
|
||||
};
|
||||
match res.typecheck() {
|
||||
Ok(_) => {},
|
||||
Err(e) => anyhow::bail!(e),
|
||||
| Ok(_) => {},
|
||||
| Err(e) => anyhow::bail!(e),
|
||||
};
|
||||
let res = BasicValue::AssertFunction { value: *res };
|
||||
set_cache_output!((output_names.first().unwrap(), res, hash_inputs));
|
||||
set_cache_output!((
|
||||
output_names.first().unwrap(),
|
||||
res,
|
||||
hash_inputs
|
||||
));
|
||||
} else {
|
||||
anyhow::bail!("Not a string");
|
||||
}
|
||||
@ -714,7 +767,11 @@ fn process_template(
|
||||
let res = BasicValue::String {
|
||||
value: format!("{l}"),
|
||||
};
|
||||
set_cache_output!((output_names.first().unwrap(), res, hash_inputs));
|
||||
set_cache_output!((
|
||||
output_names.first().unwrap(),
|
||||
res,
|
||||
hash_inputs
|
||||
));
|
||||
},
|
||||
| (_, _, _) => anyhow::bail!("Invalid inputs to bisimilarity."),
|
||||
}
|
||||
@ -748,7 +805,11 @@ fn process_template(
|
||||
let res = BasicValue::String {
|
||||
value: format!("{l}"),
|
||||
};
|
||||
set_cache_output!((output_names.first().unwrap(), res, hash_inputs));
|
||||
set_cache_output!((
|
||||
output_names.first().unwrap(),
|
||||
res,
|
||||
hash_inputs
|
||||
));
|
||||
},
|
||||
| (_, _, _) => anyhow::bail!("Invalid inputs to bisimilarity."),
|
||||
}
|
||||
@ -763,7 +824,11 @@ fn process_template(
|
||||
| Err(e) => anyhow::bail!(e),
|
||||
};
|
||||
let res = BasicValue::Graph { value };
|
||||
set_cache_output!((output_names.first().unwrap(), res, hash_inputs));
|
||||
set_cache_output!((
|
||||
output_names.first().unwrap(),
|
||||
res,
|
||||
hash_inputs
|
||||
));
|
||||
} else {
|
||||
anyhow::bail!("Not a system");
|
||||
}
|
||||
@ -852,7 +917,11 @@ fn process_template(
|
||||
let res = BasicValue::String {
|
||||
value: format!("{dot}"),
|
||||
};
|
||||
set_cache_output!((output_names.first().unwrap(), res, hash_inputs));
|
||||
set_cache_output!((
|
||||
output_names.first().unwrap(),
|
||||
res,
|
||||
hash_inputs
|
||||
));
|
||||
},
|
||||
| _ => {
|
||||
anyhow::bail!("Values of wrong type");
|
||||
@ -880,7 +949,11 @@ fn process_template(
|
||||
},
|
||||
};
|
||||
let res = BasicValue::DisplayNode { value: res };
|
||||
set_cache_output!((output_names.first().unwrap(), res, hash_inputs));
|
||||
set_cache_output!((
|
||||
output_names.first().unwrap(),
|
||||
res,
|
||||
hash_inputs
|
||||
));
|
||||
} else {
|
||||
anyhow::bail!("Not a string");
|
||||
}
|
||||
@ -906,7 +979,11 @@ fn process_template(
|
||||
},
|
||||
};
|
||||
let res = BasicValue::DisplayEdge { value: res };
|
||||
set_cache_output!((output_names.first().unwrap(), res, hash_inputs));
|
||||
set_cache_output!((
|
||||
output_names.first().unwrap(),
|
||||
res,
|
||||
hash_inputs
|
||||
));
|
||||
} else {
|
||||
anyhow::bail!("Not a string");
|
||||
}
|
||||
@ -932,7 +1009,11 @@ fn process_template(
|
||||
},
|
||||
};
|
||||
let res = BasicValue::ColorNode { value: res };
|
||||
set_cache_output!((output_names.first().unwrap(), res, hash_inputs));
|
||||
set_cache_output!((
|
||||
output_names.first().unwrap(),
|
||||
res,
|
||||
hash_inputs
|
||||
));
|
||||
} else {
|
||||
anyhow::bail!("Not a string");
|
||||
}
|
||||
@ -958,7 +1039,11 @@ fn process_template(
|
||||
},
|
||||
};
|
||||
let res = BasicValue::ColorEdge { value: res };
|
||||
set_cache_output!((output_names.first().unwrap(), res, hash_inputs));
|
||||
set_cache_output!((
|
||||
output_names.first().unwrap(),
|
||||
res,
|
||||
hash_inputs
|
||||
));
|
||||
} else {
|
||||
anyhow::bail!("Not a string");
|
||||
}
|
||||
@ -997,7 +1082,11 @@ fn process_template(
|
||||
let res = BasicValue::String {
|
||||
value: format!("{graphml}"),
|
||||
};
|
||||
set_cache_output!((output_names.first().unwrap(), res, hash_inputs));
|
||||
set_cache_output!((
|
||||
output_names.first().unwrap(),
|
||||
res,
|
||||
hash_inputs
|
||||
));
|
||||
},
|
||||
| _ => {
|
||||
anyhow::bail!("Values of wrong type");
|
||||
@ -1038,7 +1127,11 @@ fn process_template(
|
||||
Rc::new(reactions),
|
||||
),
|
||||
};
|
||||
set_cache_output!((output_names.first().unwrap(), res, hash_inputs));
|
||||
set_cache_output!((
|
||||
output_names.first().unwrap(),
|
||||
res,
|
||||
hash_inputs
|
||||
));
|
||||
},
|
||||
| _ => {
|
||||
anyhow::bail!("Values of wrong type");
|
||||
@ -1065,7 +1158,11 @@ fn process_template(
|
||||
},
|
||||
};
|
||||
let res = BasicValue::Environment { value: *env };
|
||||
set_cache_output!((output_names.first().unwrap(), res, hash_inputs));
|
||||
set_cache_output!((
|
||||
output_names.first().unwrap(),
|
||||
res,
|
||||
hash_inputs
|
||||
));
|
||||
} else {
|
||||
anyhow::bail!("Not a string");
|
||||
}
|
||||
@ -1090,7 +1187,11 @@ fn process_template(
|
||||
},
|
||||
};
|
||||
let res = BasicValue::Set { value: set };
|
||||
set_cache_output!((output_names.first().unwrap(), res, hash_inputs));
|
||||
set_cache_output!((
|
||||
output_names.first().unwrap(),
|
||||
res,
|
||||
hash_inputs
|
||||
));
|
||||
} else {
|
||||
anyhow::bail!("Not a string");
|
||||
}
|
||||
@ -1115,7 +1216,11 @@ fn process_template(
|
||||
},
|
||||
};
|
||||
let res = BasicValue::Context { value: context };
|
||||
set_cache_output!((output_names.first().unwrap(), res, hash_inputs));
|
||||
set_cache_output!((
|
||||
output_names.first().unwrap(),
|
||||
res,
|
||||
hash_inputs
|
||||
));
|
||||
} else {
|
||||
anyhow::bail!("Not a string");
|
||||
}
|
||||
@ -1140,7 +1245,11 @@ fn process_template(
|
||||
},
|
||||
};
|
||||
let res = BasicValue::Reactions { value: reactions };
|
||||
set_cache_output!((output_names.first().unwrap(), res, hash_inputs));
|
||||
set_cache_output!((
|
||||
output_names.first().unwrap(),
|
||||
res,
|
||||
hash_inputs
|
||||
));
|
||||
} else {
|
||||
anyhow::bail!("Not a string");
|
||||
}
|
||||
@ -1153,7 +1262,11 @@ fn process_template(
|
||||
let res = BasicValue::PositiveSystem {
|
||||
value: value.into(),
|
||||
};
|
||||
set_cache_output!((output_names.first().unwrap(), res, hash_inputs));
|
||||
set_cache_output!((
|
||||
output_names.first().unwrap(),
|
||||
res,
|
||||
hash_inputs
|
||||
));
|
||||
} else {
|
||||
anyhow::bail!("Not a system");
|
||||
}
|
||||
@ -1185,7 +1298,11 @@ fn process_template(
|
||||
Formatter::from(translator, &limit.1)
|
||||
),
|
||||
};
|
||||
set_cache_output!((output_names.first().unwrap(), res, hash_inputs));
|
||||
set_cache_output!((
|
||||
output_names.first().unwrap(),
|
||||
res,
|
||||
hash_inputs
|
||||
));
|
||||
},
|
||||
| (BasicValue::PositiveSystem { value: _ }, _) =>
|
||||
anyhow::bail!("Not an integer"),
|
||||
@ -1225,7 +1342,11 @@ fn process_template(
|
||||
));
|
||||
}
|
||||
let res = BasicValue::String { value: output };
|
||||
set_cache_output!((output_names.first().unwrap(), res, hash_inputs));
|
||||
set_cache_output!((
|
||||
output_names.first().unwrap(),
|
||||
res,
|
||||
hash_inputs
|
||||
));
|
||||
},
|
||||
| (BasicValue::PositiveSystem { value: _ }, _) =>
|
||||
anyhow::bail!("Not an integer"),
|
||||
@ -1260,7 +1381,11 @@ fn process_template(
|
||||
));
|
||||
}
|
||||
let res = BasicValue::String { value: output };
|
||||
set_cache_output!((output_names.first().unwrap(), res, hash_inputs));
|
||||
set_cache_output!((
|
||||
output_names.first().unwrap(),
|
||||
res,
|
||||
hash_inputs
|
||||
));
|
||||
},
|
||||
| (BasicValue::PositiveSystem { value: _ }, _) =>
|
||||
anyhow::bail!("Not an integer"),
|
||||
@ -1283,7 +1408,11 @@ fn process_template(
|
||||
Formatter::from(translator, &res)
|
||||
);
|
||||
let res = BasicValue::String { value: output };
|
||||
set_cache_output!((output_names.first().unwrap(), res, hash_inputs));
|
||||
set_cache_output!((
|
||||
output_names.first().unwrap(),
|
||||
res,
|
||||
hash_inputs
|
||||
));
|
||||
} else {
|
||||
anyhow::bail!("Not a positive system");
|
||||
}
|
||||
@ -1314,7 +1443,11 @@ fn process_template(
|
||||
Formatter::from(translator, &l)
|
||||
),
|
||||
};
|
||||
set_cache_output!((output_names.first().unwrap(), res, hash_inputs));
|
||||
set_cache_output!((
|
||||
output_names.first().unwrap(),
|
||||
res,
|
||||
hash_inputs
|
||||
));
|
||||
},
|
||||
| (BasicValue::PositiveSystem { value: _ }, _) =>
|
||||
anyhow::bail!("Not an experiment"),
|
||||
@ -1350,7 +1483,11 @@ fn process_template(
|
||||
Formatter::from(translator, &l)
|
||||
),
|
||||
};
|
||||
set_cache_output!((output_names.first().unwrap(), res, hash_inputs));
|
||||
set_cache_output!((
|
||||
output_names.first().unwrap(),
|
||||
res,
|
||||
hash_inputs
|
||||
));
|
||||
},
|
||||
| (BasicValue::PositiveSystem { value: _ }, _) =>
|
||||
anyhow::bail!("Not an experiment"),
|
||||
@ -1380,7 +1517,11 @@ fn process_template(
|
||||
}
|
||||
};
|
||||
let res = BasicValue::Trace { value: trace };
|
||||
set_cache_output!((output_names.first().unwrap(), res, hash_inputs));
|
||||
set_cache_output!((
|
||||
output_names.first().unwrap(),
|
||||
res,
|
||||
hash_inputs
|
||||
));
|
||||
},
|
||||
| (BasicValue::System { value: _ }, _) =>
|
||||
anyhow::bail!("Not a positive integer"),
|
||||
@ -1410,7 +1551,11 @@ fn process_template(
|
||||
}
|
||||
};
|
||||
let res = BasicValue::PositiveTrace { value: trace };
|
||||
set_cache_output!((output_names.first().unwrap(), res, hash_inputs));
|
||||
set_cache_output!((
|
||||
output_names.first().unwrap(),
|
||||
res,
|
||||
hash_inputs
|
||||
));
|
||||
},
|
||||
| (BasicValue::PositiveSystem { value: _ }, _) =>
|
||||
anyhow::bail!("Not a positive integer"),
|
||||
@ -1434,7 +1579,11 @@ fn process_template(
|
||||
};
|
||||
|
||||
let res = BasicValue::Trace { value: new_trace };
|
||||
set_cache_output!((output_names.first().unwrap(), res, hash_inputs));
|
||||
set_cache_output!((
|
||||
output_names.first().unwrap(),
|
||||
res,
|
||||
hash_inputs
|
||||
));
|
||||
},
|
||||
| (BasicValue::Trace { value: _ }, _) =>
|
||||
anyhow::bail!("Not a set"),
|
||||
@ -1458,7 +1607,11 @@ fn process_template(
|
||||
};
|
||||
|
||||
let res = BasicValue::PositiveTrace { value: new_trace };
|
||||
set_cache_output!((output_names.first().unwrap(), res, hash_inputs));
|
||||
set_cache_output!((
|
||||
output_names.first().unwrap(),
|
||||
res,
|
||||
hash_inputs
|
||||
));
|
||||
},
|
||||
| (BasicValue::PositiveTrace { value: _ }, _) =>
|
||||
anyhow::bail!("Not a set"),
|
||||
@ -1487,7 +1640,11 @@ fn process_template(
|
||||
},
|
||||
};
|
||||
let res = BasicValue::PositiveSet { value: set };
|
||||
set_cache_output!((output_names.first().unwrap(), res, hash_inputs));
|
||||
set_cache_output!((
|
||||
output_names.first().unwrap(),
|
||||
res,
|
||||
hash_inputs
|
||||
));
|
||||
} else {
|
||||
anyhow::bail!("Not a string");
|
||||
}
|
||||
@ -1501,7 +1658,11 @@ fn process_template(
|
||||
value: value
|
||||
.to_positive_set(rsprocess::element::IdState::Positive),
|
||||
};
|
||||
set_cache_output!((output_names.first().unwrap(), res, hash_inputs));
|
||||
set_cache_output!((
|
||||
output_names.first().unwrap(),
|
||||
res,
|
||||
hash_inputs
|
||||
));
|
||||
} else {
|
||||
anyhow::bail!("Not a string");
|
||||
}
|
||||
@ -1539,7 +1700,11 @@ fn process_template(
|
||||
Rc::new(reactions),
|
||||
),
|
||||
};
|
||||
set_cache_output!((output_names.first().unwrap(), res, hash_inputs));
|
||||
set_cache_output!((
|
||||
output_names.first().unwrap(),
|
||||
res,
|
||||
hash_inputs
|
||||
));
|
||||
},
|
||||
| _ => {
|
||||
anyhow::bail!("Values of wrong type");
|
||||
@ -1561,10 +1726,17 @@ fn process_template(
|
||||
let context = BasicValue::Context { value: context };
|
||||
let reactions = BasicValue::Reactions { value: reactions };
|
||||
|
||||
|
||||
set_cache_output!((output_names[0], env, hash_inputs.clone()));
|
||||
set_cache_output!((output_names[1], initial, hash_inputs.clone()));
|
||||
set_cache_output!((output_names[2], context, hash_inputs.clone()));
|
||||
set_cache_output!((
|
||||
output_names[1],
|
||||
initial,
|
||||
hash_inputs.clone()
|
||||
));
|
||||
set_cache_output!((
|
||||
output_names[2],
|
||||
context,
|
||||
hash_inputs.clone()
|
||||
));
|
||||
set_cache_output!((output_names[3], reactions, hash_inputs));
|
||||
} else {
|
||||
anyhow::bail!("Not a system");
|
||||
@ -1583,12 +1755,20 @@ fn process_template(
|
||||
let env = BasicValue::PositiveEnvironment { value: env };
|
||||
let initial = BasicValue::PositiveSet { value: initial };
|
||||
let context = BasicValue::PositiveContext { value: context };
|
||||
let reactions = BasicValue::PositiveReactions { value: reactions };
|
||||
|
||||
let reactions =
|
||||
BasicValue::PositiveReactions { value: reactions };
|
||||
|
||||
set_cache_output!((output_names[0], env, hash_inputs.clone()));
|
||||
set_cache_output!((output_names[1], initial, hash_inputs.clone()));
|
||||
set_cache_output!((output_names[2], context, hash_inputs.clone()));
|
||||
set_cache_output!((
|
||||
output_names[1],
|
||||
initial,
|
||||
hash_inputs.clone()
|
||||
));
|
||||
set_cache_output!((
|
||||
output_names[2],
|
||||
context,
|
||||
hash_inputs.clone()
|
||||
));
|
||||
set_cache_output!((output_names[3], reactions, hash_inputs));
|
||||
} else {
|
||||
anyhow::bail!("Not a positive system");
|
||||
@ -1602,7 +1782,11 @@ fn process_template(
|
||||
let res = BasicValue::String {
|
||||
value: format!("{}", Formatter::from(translator, &value)),
|
||||
};
|
||||
set_cache_output!((output_names.first().unwrap(), res, hash_inputs));
|
||||
set_cache_output!((
|
||||
output_names.first().unwrap(),
|
||||
res,
|
||||
hash_inputs
|
||||
));
|
||||
} else {
|
||||
anyhow::bail!("Not a trace");
|
||||
}
|
||||
@ -1615,7 +1799,11 @@ fn process_template(
|
||||
let res = BasicValue::String {
|
||||
value: format!("{}", Formatter::from(translator, &value)),
|
||||
};
|
||||
set_cache_output!((output_names.first().unwrap(), res, hash_inputs));
|
||||
set_cache_output!((
|
||||
output_names.first().unwrap(),
|
||||
res,
|
||||
hash_inputs
|
||||
));
|
||||
} else {
|
||||
anyhow::bail!("Not a positive trace");
|
||||
}
|
||||
@ -1625,7 +1813,9 @@ fn process_template(
|
||||
let hash_inputs = hash_inputs!(s);
|
||||
|
||||
if let BasicValue::String { value } = s {
|
||||
let res = grammar_separated::grammar::PositiveEnvironmentParser::new()
|
||||
let res =
|
||||
grammar_separated::grammar::PositiveEnvironmentParser::new(
|
||||
)
|
||||
.parse(translator, &value);
|
||||
let env = match res {
|
||||
| Ok(s) => s,
|
||||
@ -1640,7 +1830,11 @@ fn process_template(
|
||||
},
|
||||
};
|
||||
let res = BasicValue::PositiveEnvironment { value: *env };
|
||||
set_cache_output!((output_names.first().unwrap(), res, hash_inputs));
|
||||
set_cache_output!((
|
||||
output_names.first().unwrap(),
|
||||
res,
|
||||
hash_inputs
|
||||
));
|
||||
} else {
|
||||
anyhow::bail!("Not a string");
|
||||
}
|
||||
@ -1650,8 +1844,9 @@ fn process_template(
|
||||
let hash_inputs = hash_inputs!(s);
|
||||
|
||||
if let BasicValue::String { value } = s {
|
||||
let res = grammar_separated::grammar::PositiveContextParser::new()
|
||||
.parse(translator, &value);
|
||||
let res =
|
||||
grammar_separated::grammar::PositiveContextParser::new()
|
||||
.parse(translator, &value);
|
||||
let context = match res {
|
||||
| Ok(s) => s,
|
||||
| Err(parse_error) => {
|
||||
@ -1665,7 +1860,11 @@ fn process_template(
|
||||
},
|
||||
};
|
||||
let res = BasicValue::PositiveContext { value: context };
|
||||
set_cache_output!((output_names.first().unwrap(), res, hash_inputs));
|
||||
set_cache_output!((
|
||||
output_names.first().unwrap(),
|
||||
res,
|
||||
hash_inputs
|
||||
));
|
||||
} else {
|
||||
anyhow::bail!("Not a string");
|
||||
}
|
||||
@ -1675,8 +1874,9 @@ fn process_template(
|
||||
let hash_inputs = hash_inputs!(s);
|
||||
|
||||
if let BasicValue::String { value } = s {
|
||||
let res = grammar_separated::grammar::PositiveReactionsParser::new()
|
||||
.parse(translator, &value);
|
||||
let res =
|
||||
grammar_separated::grammar::PositiveReactionsParser::new()
|
||||
.parse(translator, &value);
|
||||
let reactions = match res {
|
||||
| Ok(s) => s,
|
||||
| Err(parse_error) => {
|
||||
@ -1690,7 +1890,11 @@ fn process_template(
|
||||
},
|
||||
};
|
||||
let res = BasicValue::PositiveReactions { value: reactions };
|
||||
set_cache_output!((output_names.first().unwrap(), res, hash_inputs));
|
||||
set_cache_output!((
|
||||
output_names.first().unwrap(),
|
||||
res,
|
||||
hash_inputs
|
||||
));
|
||||
} else {
|
||||
anyhow::bail!("Not a string");
|
||||
}
|
||||
@ -1703,7 +1907,11 @@ fn process_template(
|
||||
let res = BasicValue::PositiveContext {
|
||||
value: value.into(),
|
||||
};
|
||||
set_cache_output!((output_names.first().unwrap(), res, hash_inputs));
|
||||
set_cache_output!((
|
||||
output_names.first().unwrap(),
|
||||
res,
|
||||
hash_inputs
|
||||
));
|
||||
} else {
|
||||
anyhow::bail!("Not a context");
|
||||
}
|
||||
@ -1716,7 +1924,11 @@ fn process_template(
|
||||
let res = BasicValue::PositiveEnvironment {
|
||||
value: value.into(),
|
||||
};
|
||||
set_cache_output!((output_names.first().unwrap(), res, hash_inputs));
|
||||
set_cache_output!((
|
||||
output_names.first().unwrap(),
|
||||
res,
|
||||
hash_inputs
|
||||
));
|
||||
} else {
|
||||
anyhow::bail!("Not an environment");
|
||||
}
|
||||
@ -1727,9 +1939,16 @@ fn process_template(
|
||||
|
||||
if let BasicValue::Reactions { value } = s {
|
||||
let res = BasicValue::PositiveReactions {
|
||||
value: rsprocess::reaction::PositiveReaction::from_reactions(&value),
|
||||
value:
|
||||
rsprocess::reaction::PositiveReaction::from_reactions(
|
||||
&value,
|
||||
),
|
||||
};
|
||||
set_cache_output!((output_names.first().unwrap(), res, hash_inputs));
|
||||
set_cache_output!((
|
||||
output_names.first().unwrap(),
|
||||
res,
|
||||
hash_inputs
|
||||
));
|
||||
} else {
|
||||
anyhow::bail!("Not reactions");
|
||||
}
|
||||
@ -1746,7 +1965,11 @@ fn process_template(
|
||||
let mut new_sys = sys.clone();
|
||||
new_sys.overwrite_context_elements(set);
|
||||
let res = BasicValue::System { value: new_sys };
|
||||
set_cache_output!((output_names.first().unwrap(), res, hash_inputs));
|
||||
set_cache_output!((
|
||||
output_names.first().unwrap(),
|
||||
res,
|
||||
hash_inputs
|
||||
));
|
||||
},
|
||||
| (BasicValue::System { value: _ }, _) =>
|
||||
anyhow::bail!("Not a set"),
|
||||
@ -1767,7 +1990,11 @@ fn process_template(
|
||||
let mut new_sys = sys.clone();
|
||||
new_sys.overwrite_product_elements(set);
|
||||
let res = BasicValue::System { value: new_sys };
|
||||
set_cache_output!((output_names.first().unwrap(), res, hash_inputs));
|
||||
set_cache_output!((
|
||||
output_names.first().unwrap(),
|
||||
res,
|
||||
hash_inputs
|
||||
));
|
||||
},
|
||||
| (BasicValue::System { value: _ }, _) =>
|
||||
anyhow::bail!("Not a set"),
|
||||
@ -1788,7 +2015,11 @@ fn process_template(
|
||||
let mut new_sys = sys.clone();
|
||||
new_sys.overwrite_context_elements(set);
|
||||
let res = BasicValue::PositiveSystem { value: new_sys };
|
||||
set_cache_output!((output_names.first().unwrap(), res, hash_inputs));
|
||||
set_cache_output!((
|
||||
output_names.first().unwrap(),
|
||||
res,
|
||||
hash_inputs
|
||||
));
|
||||
},
|
||||
| (BasicValue::PositiveSystem { value: _ }, _) =>
|
||||
anyhow::bail!("Not a set"),
|
||||
@ -1809,7 +2040,11 @@ fn process_template(
|
||||
let mut new_sys = sys.clone();
|
||||
new_sys.overwrite_product_elements(set);
|
||||
let res = BasicValue::PositiveSystem { value: new_sys };
|
||||
set_cache_output!((output_names.first().unwrap(), res, hash_inputs));
|
||||
set_cache_output!((
|
||||
output_names.first().unwrap(),
|
||||
res,
|
||||
hash_inputs
|
||||
));
|
||||
},
|
||||
| (BasicValue::PositiveSystem { value: _ }, _) =>
|
||||
anyhow::bail!("Not a set"),
|
||||
@ -1828,7 +2063,11 @@ fn process_template(
|
||||
| Err(e) => anyhow::bail!(e),
|
||||
};
|
||||
let res = BasicValue::PositiveGraph { value };
|
||||
set_cache_output!((output_names.first().unwrap(), res, hash_inputs));
|
||||
set_cache_output!((
|
||||
output_names.first().unwrap(),
|
||||
res,
|
||||
hash_inputs
|
||||
));
|
||||
} else {
|
||||
anyhow::bail!("Not a system");
|
||||
}
|
||||
@ -1853,11 +2092,15 @@ fn process_template(
|
||||
},
|
||||
};
|
||||
match res.typecheck() {
|
||||
Ok(_) => {},
|
||||
Err(e) => anyhow::bail!(e),
|
||||
| Ok(_) => {},
|
||||
| Err(e) => anyhow::bail!(e),
|
||||
};
|
||||
let res = BasicValue::GroupFunction { value: *res };
|
||||
set_cache_output!((output_names.first().unwrap(), res, hash_inputs));
|
||||
set_cache_output!((
|
||||
output_names.first().unwrap(),
|
||||
res,
|
||||
hash_inputs
|
||||
));
|
||||
} else {
|
||||
anyhow::bail!("Not a string");
|
||||
}
|
||||
@ -1867,21 +2110,28 @@ fn process_template(
|
||||
let hash_inputs = hash_inputs!(g, grouping);
|
||||
|
||||
match (g, grouping) {
|
||||
| (BasicValue::Graph { value: g },
|
||||
BasicValue::GroupFunction { value: grouping }) =>
|
||||
{
|
||||
| (
|
||||
BasicValue::Graph { value: g },
|
||||
BasicValue::GroupFunction { value: grouping },
|
||||
) => {
|
||||
use execution::data;
|
||||
let mut graph = g.clone();
|
||||
match data::grouping(&mut graph, &grouping, translator) {
|
||||
Ok(_) => {},
|
||||
Err(e) => anyhow::bail!(e),
|
||||
| Ok(_) => {},
|
||||
| Err(e) => anyhow::bail!(e),
|
||||
};
|
||||
|
||||
let res = BasicValue::Graph { value: graph };
|
||||
set_cache_output!((output_names.first().unwrap(), res, hash_inputs));
|
||||
}
|
||||
| (BasicValue::Graph { value: _ }, _) => anyhow::bail!("Not a group function"),
|
||||
| (_, BasicValue::GroupFunction { value: _ }) => anyhow::bail!("Not a graph"),
|
||||
set_cache_output!((
|
||||
output_names.first().unwrap(),
|
||||
res,
|
||||
hash_inputs
|
||||
));
|
||||
},
|
||||
| (BasicValue::Graph { value: _ }, _) =>
|
||||
anyhow::bail!("Not a group function"),
|
||||
| (_, BasicValue::GroupFunction { value: _ }) =>
|
||||
anyhow::bail!("Not a graph"),
|
||||
| _ => anyhow::bail!("Inputs all wrong"),
|
||||
}
|
||||
},
|
||||
@ -1890,8 +2140,9 @@ fn process_template(
|
||||
let hash_inputs = hash_inputs!(s);
|
||||
|
||||
if let BasicValue::String { value } = s {
|
||||
let res = grammar_separated::positive_assert::AssertParser::new()
|
||||
.parse(translator, &value);
|
||||
let res =
|
||||
grammar_separated::positive_assert::AssertParser::new()
|
||||
.parse(translator, &value);
|
||||
let res = match res {
|
||||
| Ok(s) => s,
|
||||
| Err(parse_error) => {
|
||||
@ -1905,11 +2156,15 @@ fn process_template(
|
||||
},
|
||||
};
|
||||
match res.typecheck() {
|
||||
Ok(_) => {},
|
||||
Err(e) => anyhow::bail!(e),
|
||||
| Ok(_) => {},
|
||||
| Err(e) => anyhow::bail!(e),
|
||||
};
|
||||
let res = BasicValue::PositiveAssertFunction { value: *res };
|
||||
set_cache_output!((output_names.first().unwrap(), res, hash_inputs));
|
||||
set_cache_output!((
|
||||
output_names.first().unwrap(),
|
||||
res,
|
||||
hash_inputs
|
||||
));
|
||||
} else {
|
||||
anyhow::bail!("Not a string");
|
||||
}
|
||||
@ -1919,8 +2174,9 @@ fn process_template(
|
||||
let hash_inputs = hash_inputs!(s);
|
||||
|
||||
if let BasicValue::String { value } = s {
|
||||
let res = grammar_separated::positive_grouping::GroupParser::new()
|
||||
.parse(translator, &value);
|
||||
let res =
|
||||
grammar_separated::positive_grouping::GroupParser::new()
|
||||
.parse(translator, &value);
|
||||
let res = match res {
|
||||
| Ok(s) => s,
|
||||
| Err(parse_error) => {
|
||||
@ -1934,11 +2190,15 @@ fn process_template(
|
||||
},
|
||||
};
|
||||
match res.typecheck() {
|
||||
Ok(_) => {},
|
||||
Err(e) => anyhow::bail!(e),
|
||||
| Ok(_) => {},
|
||||
| Err(e) => anyhow::bail!(e),
|
||||
};
|
||||
let res = BasicValue::PositiveGroupFunction { value: *res };
|
||||
set_cache_output!((output_names.first().unwrap(), res, hash_inputs));
|
||||
set_cache_output!((
|
||||
output_names.first().unwrap(),
|
||||
res,
|
||||
hash_inputs
|
||||
));
|
||||
} else {
|
||||
anyhow::bail!("Not a string");
|
||||
}
|
||||
@ -1948,21 +2208,30 @@ fn process_template(
|
||||
let hash_inputs = hash_inputs!(g, grouping);
|
||||
|
||||
match (g, grouping) {
|
||||
| (BasicValue::PositiveGraph { value: g },
|
||||
BasicValue::PositiveGroupFunction { value: grouping }) =>
|
||||
{
|
||||
| (
|
||||
BasicValue::PositiveGraph { value: g },
|
||||
BasicValue::PositiveGroupFunction { value: grouping },
|
||||
) => {
|
||||
use execution::data;
|
||||
let mut graph = g.clone();
|
||||
match data::positive_grouping(&mut graph, &grouping, translator) {
|
||||
Ok(_) => {},
|
||||
Err(e) => anyhow::bail!(e),
|
||||
match data::positive_grouping(
|
||||
&mut graph, &grouping, translator,
|
||||
) {
|
||||
| Ok(_) => {},
|
||||
| Err(e) => anyhow::bail!(e),
|
||||
};
|
||||
|
||||
let res = BasicValue::PositiveGraph { value: graph };
|
||||
set_cache_output!((output_names.first().unwrap(), res, hash_inputs));
|
||||
set_cache_output!((
|
||||
output_names.first().unwrap(),
|
||||
res,
|
||||
hash_inputs
|
||||
));
|
||||
},
|
||||
| (BasicValue::PositiveGraph { value: _ }, _) => anyhow::bail!("Not a positive group function"),
|
||||
| (_, BasicValue::PositiveGroupFunction { value: _ }) => anyhow::bail!("Not a positive graph"),
|
||||
| (BasicValue::PositiveGraph { value: _ }, _) =>
|
||||
anyhow::bail!("Not a positive group function"),
|
||||
| (_, BasicValue::PositiveGroupFunction { value: _ }) =>
|
||||
anyhow::bail!("Not a positive graph"),
|
||||
| _ => anyhow::bail!("Inputs all wrong"),
|
||||
}
|
||||
},
|
||||
@ -1992,7 +2261,11 @@ fn process_template(
|
||||
let res = BasicValue::String {
|
||||
value: format!("{l}"),
|
||||
};
|
||||
set_cache_output!((output_names.first().unwrap(), res, hash_inputs));
|
||||
set_cache_output!((
|
||||
output_names.first().unwrap(),
|
||||
res,
|
||||
hash_inputs
|
||||
));
|
||||
},
|
||||
| (_, _, _) => anyhow::bail!("Invalid inputs to bisimilarity."),
|
||||
}
|
||||
@ -2023,7 +2296,11 @@ fn process_template(
|
||||
let res = BasicValue::String {
|
||||
value: format!("{l}"),
|
||||
};
|
||||
set_cache_output!((output_names.first().unwrap(), res, hash_inputs));
|
||||
set_cache_output!((
|
||||
output_names.first().unwrap(),
|
||||
res,
|
||||
hash_inputs
|
||||
));
|
||||
},
|
||||
| (_, _, _) => anyhow::bail!("Invalid inputs to bisimilarity."),
|
||||
}
|
||||
@ -2057,7 +2334,11 @@ fn process_template(
|
||||
let res = BasicValue::String {
|
||||
value: format!("{l}"),
|
||||
};
|
||||
set_cache_output!((output_names.first().unwrap(), res, hash_inputs));
|
||||
set_cache_output!((
|
||||
output_names.first().unwrap(),
|
||||
res,
|
||||
hash_inputs
|
||||
));
|
||||
},
|
||||
| (_, _, _) => anyhow::bail!("Invalid inputs to bisimilarity."),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user