Working compilation
This commit is contained in:
@ -49,8 +49,10 @@ match {
|
|||||||
} else {
|
} else {
|
||||||
r"([[:alpha:]])([[:word:]])*" => WORD
|
r"([[:alpha:]])([[:word:]])*" => WORD
|
||||||
// r"(\p{L}|\p{Emoji})(\p{L}|\p{Emoji}|\p{Dash}|\p{N})*" => WORD,
|
// r"(\p{L}|\p{Emoji})(\p{L}|\p{Emoji}|\p{Dash}|\p{N})*" => WORD,
|
||||||
|
// } else {
|
||||||
|
// r#"'([^']+)'"# => SEPARATOR,
|
||||||
} else {
|
} else {
|
||||||
r#"".*""# => PATH,
|
r#""[^"]+""# => PATH, // "
|
||||||
} else {
|
} else {
|
||||||
_
|
_
|
||||||
}
|
}
|
||||||
@ -233,9 +235,11 @@ pub Experiment: (Vec<u32>, Vec<RSset>) = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ~~~~~~~~~~~~~~~~~~~
|
||||||
// Instruction Parsing
|
// Instruction Parsing
|
||||||
|
// ~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
/// Decides whetherer to print to stdout or to save to file
|
||||||
Helper_SO: presets::SaveOptions = {
|
Helper_SO: presets::SaveOptions = {
|
||||||
"Print" =>
|
"Print" =>
|
||||||
presets::SaveOptions {print: true, save: None},
|
presets::SaveOptions {print: true, save: None},
|
||||||
@ -243,6 +247,7 @@ Helper_SO: presets::SaveOptions = {
|
|||||||
presets::SaveOptions {print: false, save: Some(vec![p])}
|
presets::SaveOptions {print: false, save: Some(vec![p])}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// we could need to save to multiple files
|
||||||
SaveOptions: presets::SaveOptions = {
|
SaveOptions: presets::SaveOptions = {
|
||||||
<p: Separated_Or<Helper_SO, ";">> => {
|
<p: Separated_Or<Helper_SO, ";">> => {
|
||||||
p.into_iter()
|
p.into_iter()
|
||||||
@ -251,7 +256,7 @@ SaveOptions: presets::SaveOptions = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Match for strings between nodes formatters
|
||||||
LiteralSeparatorNode: presets::NodeDisplay = {
|
LiteralSeparatorNode: presets::NodeDisplay = {
|
||||||
PATH =>
|
PATH =>
|
||||||
presets::NodeDisplay::Separator(
|
presets::NodeDisplay::Separator(
|
||||||
@ -259,6 +264,7 @@ LiteralSeparatorNode: presets::NodeDisplay = {
|
|||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// Match for strings between edge formatters
|
||||||
LiteralSeparatorEdge: presets::EdgeDisplay = {
|
LiteralSeparatorEdge: presets::EdgeDisplay = {
|
||||||
PATH =>
|
PATH =>
|
||||||
presets::EdgeDisplay::Separator(
|
presets::EdgeDisplay::Separator(
|
||||||
@ -274,6 +280,7 @@ NodeDisplay: presets::NodeDisplay = {
|
|||||||
"Context" => presets::NodeDisplay::Display(graph::GraphMapNodes::Context)
|
"Context" => presets::NodeDisplay::Display(graph::GraphMapNodes::Context)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Node display formatters separated by arbitrary strings in quotes
|
||||||
SeparatorNode: Vec<presets::NodeDisplay> = {
|
SeparatorNode: Vec<presets::NodeDisplay> = {
|
||||||
<v: NodeDisplay> => vec![v],
|
<v: NodeDisplay> => vec![v],
|
||||||
<v:(<NodeDisplay> <LiteralSeparatorNode>)+> <e: NodeDisplay?> =>
|
<v:(<NodeDisplay> <LiteralSeparatorNode>)+> <e: NodeDisplay?> =>
|
||||||
@ -306,6 +313,7 @@ EdgeDisplay: presets::EdgeDisplay = {
|
|||||||
"MaskEntitiesAdded" <mask: Set> => presets::EdgeDisplay::Display(graph::GraphMapEdges::MaskEntitiesAdded{ mask }),
|
"MaskEntitiesAdded" <mask: Set> => presets::EdgeDisplay::Display(graph::GraphMapEdges::MaskEntitiesAdded{ mask }),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Edge display formatters separated by arbitrary strings in quotes
|
||||||
SeparatorEdge: Vec<presets::EdgeDisplay> = {
|
SeparatorEdge: Vec<presets::EdgeDisplay> = {
|
||||||
<v: EdgeDisplay> => vec![v],
|
<v: EdgeDisplay> => vec![v],
|
||||||
<v:(<EdgeDisplay> <LiteralSeparatorEdge>)+> <e: EdgeDisplay?> =>
|
<v:(<EdgeDisplay> <LiteralSeparatorEdge>)+> <e: EdgeDisplay?> =>
|
||||||
@ -325,6 +333,10 @@ GraphSaveOptions: presets::GraphSaveOptions = {
|
|||||||
<so: SaveOptions> =>
|
<so: SaveOptions> =>
|
||||||
presets::GraphSaveOptions::Dot { node_display: s_node,
|
presets::GraphSaveOptions::Dot { node_display: s_node,
|
||||||
edge_display: s_edge,
|
edge_display: s_edge,
|
||||||
|
node_color: graph::NodeColor {
|
||||||
|
conditionals: vec![],
|
||||||
|
base_color: "white".into()
|
||||||
|
},
|
||||||
so },
|
so },
|
||||||
"GraphML" <s_node: SeparatorNode> "|" <s_edge: SeparatorEdge> ">"
|
"GraphML" <s_node: SeparatorNode> "|" <s_edge: SeparatorEdge> ">"
|
||||||
<so: SaveOptions> =>
|
<so: SaveOptions> =>
|
||||||
|
|||||||
@ -4,7 +4,7 @@ use petgraph::{Graph, Directed};
|
|||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use super::structure::{RSlabel, RSsystem, RSset, RSprocess};
|
use super::structure::{RSlabel, RSsystem, RSset, RSprocess};
|
||||||
use super::support_structures::TransitionsIterator;
|
use super::support_structures::TransitionsIterator;
|
||||||
use super::translator;
|
use super::translator::{self, IdType};
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
type RSgraph = Graph<RSsystem, RSlabel, Directed, u32>;
|
type RSgraph = Graph<RSsystem, RSlabel, Directed, u32>;
|
||||||
@ -368,39 +368,176 @@ use petgraph::visit::{IntoNodeReferences, IntoEdgeReferences, EdgeRef};
|
|||||||
|
|
||||||
type RSdotGraph = Graph<String, String, Directed, u32>;
|
type RSdotGraph = Graph<String, String, Directed, u32>;
|
||||||
type RSformatNodeTy =
|
type RSformatNodeTy =
|
||||||
dyn Fn(&RSdotGraph, <&RSdotGraph as IntoNodeReferences>::NodeRef) -> String;
|
dyn Fn(
|
||||||
|
&RSdotGraph,
|
||||||
|
<&RSdotGraph as IntoNodeReferences>::NodeRef
|
||||||
|
) -> Option<String>;
|
||||||
|
|
||||||
type RSformatEdgeTy =
|
type RSformatEdgeTy =
|
||||||
dyn Fn(&RSdotGraph, <&RSdotGraph as IntoEdgeReferences>::EdgeRef) -> String;
|
dyn Fn(
|
||||||
|
&RSdotGraph,
|
||||||
|
<&RSdotGraph as IntoEdgeReferences>::EdgeRef
|
||||||
|
) -> String;
|
||||||
|
|
||||||
pub fn default_node_formatter(
|
#[derive(Clone, Copy)]
|
||||||
original_graph: Rc<RSgraph>
|
pub enum OperationType {
|
||||||
|
Equals,
|
||||||
|
Subset,
|
||||||
|
SubsetEqual,
|
||||||
|
Superset,
|
||||||
|
SupersetEqual
|
||||||
|
}
|
||||||
|
|
||||||
|
impl OperationType {
|
||||||
|
pub fn evaluate(&self, a: &RSset, b: &RSset) -> bool {
|
||||||
|
match self {
|
||||||
|
Self::Equals => {
|
||||||
|
a.is_subset(b) && b.is_subset(a)
|
||||||
|
},
|
||||||
|
Self::Subset => {
|
||||||
|
a.is_subset(b) && !b.is_subset(a)
|
||||||
|
},
|
||||||
|
Self::SubsetEqual => {
|
||||||
|
a.is_subset(b)
|
||||||
|
},
|
||||||
|
Self::Superset => {
|
||||||
|
b.is_subset(a) && !a.is_subset(b)
|
||||||
|
},
|
||||||
|
Self::SupersetEqual => {
|
||||||
|
b.is_subset(a)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone)]
|
||||||
|
pub enum ContextColorConditional {
|
||||||
|
Nill,
|
||||||
|
RecursiveIdentifier(IdType),
|
||||||
|
EntitySet(OperationType, RSset),
|
||||||
|
NonDeterministicChoice,
|
||||||
|
Summation,
|
||||||
|
WaitEntity
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#[derive(Clone)]
|
||||||
|
pub enum NodeColorConditional {
|
||||||
|
ContextConditional(ContextColorConditional),
|
||||||
|
EntitiesConditional(OperationType, RSset)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone)]
|
||||||
|
pub struct NodeColor {
|
||||||
|
pub conditionals: Vec<(NodeColorConditional, String)>,
|
||||||
|
pub base_color: String
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn node_formatter(
|
||||||
|
original_graph: Rc<RSgraph>,
|
||||||
|
rule: NodeColorConditional,
|
||||||
|
color: String,
|
||||||
|
star: Option<IdType>,
|
||||||
) -> Box<RSformatNodeTy>
|
) -> Box<RSformatNodeTy>
|
||||||
{
|
{
|
||||||
|
match rule {
|
||||||
|
NodeColorConditional::ContextConditional(ccc) => {
|
||||||
|
match ccc {
|
||||||
|
ContextColorConditional::Nill => {
|
||||||
Box::new(
|
Box::new(
|
||||||
move |_g, n|
|
move |_, n| {
|
||||||
String::from(
|
let rssystem = original_graph.node_weight(n.0).unwrap();
|
||||||
match original_graph.node_weight(n.0).unwrap().context_process
|
if rssystem.context_process == RSprocess::Nill {
|
||||||
{
|
Some(", fillcolor=".to_string() + &color)
|
||||||
RSprocess::Nill =>
|
} else {
|
||||||
", fillcolor=white",
|
None
|
||||||
RSprocess::RecursiveIdentifier { identifier: _ } =>
|
}
|
||||||
", fillcolor=\"#BBFF99\"",
|
|
||||||
RSprocess::EntitySet { entities: _, next_process: _ } =>
|
|
||||||
", fillcolor=\"#AAEEFF\"",
|
|
||||||
RSprocess::NondeterministicChoice { children: _ } =>
|
|
||||||
", fillcolor=\"#FFEE99\"",
|
|
||||||
RSprocess::Summation { children: _ } =>
|
|
||||||
", fillcolor=\"#CC99FF\"",
|
|
||||||
RSprocess::WaitEntity
|
|
||||||
{ repeat: _, repeated_process: _, next_process: _ } =>
|
|
||||||
", fillcolor=\"#FF99AA\"",
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
},
|
||||||
|
ContextColorConditional::RecursiveIdentifier(s) => {
|
||||||
|
Box::new(
|
||||||
|
move |_, n| {
|
||||||
|
let rssystem = original_graph.node_weight(n.0).unwrap();
|
||||||
|
match (Some(s) == star, &rssystem.context_process) {
|
||||||
|
(true, RSprocess::RecursiveIdentifier { identifier: _ }) => {
|
||||||
|
Some(", fillcolor=".to_string() + &color)
|
||||||
|
},
|
||||||
|
(false, RSprocess::RecursiveIdentifier { identifier: id }) if id == &s => {
|
||||||
|
Some(", fillcolor=".to_string() + &color)
|
||||||
|
},
|
||||||
|
_ => {None}
|
||||||
|
}
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
},
|
||||||
|
ContextColorConditional::EntitySet(ot, set) => {
|
||||||
|
Box::new(
|
||||||
|
move |_, n| {
|
||||||
|
let rssystem = original_graph.node_weight(n.0).unwrap();
|
||||||
|
match &rssystem.context_process {
|
||||||
|
RSprocess::EntitySet { entities, next_process: _ } if ot.evaluate(entities, &set) => {
|
||||||
|
Some(", fillcolor=".to_string() + &color)
|
||||||
|
},
|
||||||
|
_ => {None}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
},
|
||||||
|
ContextColorConditional::NonDeterministicChoice => {
|
||||||
|
Box::new(
|
||||||
|
move |_, n| {
|
||||||
|
let rssystem = original_graph.node_weight(n.0).unwrap();
|
||||||
|
if let RSprocess::NondeterministicChoice { children: _ } = rssystem.context_process {
|
||||||
|
Some(", fillcolor=".to_string() + &color)
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
},
|
||||||
|
ContextColorConditional::Summation => {
|
||||||
|
Box::new(
|
||||||
|
move |_, n| {
|
||||||
|
let rssystem = original_graph.node_weight(n.0).unwrap();
|
||||||
|
if let RSprocess::Summation { children: _ } = rssystem.context_process {
|
||||||
|
Some(", fillcolor=".to_string() + &color)
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
},
|
||||||
|
ContextColorConditional::WaitEntity => {
|
||||||
|
Box::new(
|
||||||
|
move |_, n| {
|
||||||
|
let rssystem = original_graph.node_weight(n.0).unwrap();
|
||||||
|
if let RSprocess::WaitEntity { repeat: _, repeated_process: _, next_process: _ } = &rssystem.context_process {
|
||||||
|
Some(", fillcolor=".to_string() + &color)
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
NodeColorConditional::EntitiesConditional(ot, set) => {
|
||||||
|
Box::new(
|
||||||
|
move |_, n| {
|
||||||
|
let rssystem = original_graph.node_weight(n.0).unwrap();
|
||||||
|
if ot.evaluate(&rssystem.available_entities, &set) {
|
||||||
|
Some(", fillcolor=".to_string() + &color)
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
},
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn default_edge_formatter(
|
pub fn edge_formatter(
|
||||||
original_graph: Rc<RSgraph>
|
original_graph: Rc<RSgraph>
|
||||||
) -> Box<RSformatEdgeTy>
|
) -> Box<RSformatEdgeTy>
|
||||||
{
|
{
|
||||||
|
|||||||
@ -64,6 +64,7 @@ pub enum NodeDisplay {
|
|||||||
Display(graph::GraphMapNodes),
|
Display(graph::GraphMapNodes),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub enum EdgeDisplay {
|
pub enum EdgeDisplay {
|
||||||
Separator(String),
|
Separator(String),
|
||||||
@ -74,6 +75,7 @@ pub enum GraphSaveOptions {
|
|||||||
Dot {
|
Dot {
|
||||||
node_display: Vec<NodeDisplay>,
|
node_display: Vec<NodeDisplay>,
|
||||||
edge_display: Vec<EdgeDisplay>,
|
edge_display: Vec<EdgeDisplay>,
|
||||||
|
node_color: graph::NodeColor,
|
||||||
so: SaveOptions,
|
so: SaveOptions,
|
||||||
},
|
},
|
||||||
GraphML {
|
GraphML {
|
||||||
@ -195,10 +197,24 @@ where
|
|||||||
ParseError::UnrecognizedToken {
|
ParseError::UnrecognizedToken {
|
||||||
token: (l, t, r),
|
token: (l, t, r),
|
||||||
expected,
|
expected,
|
||||||
} => Err(format!(
|
} => {
|
||||||
|
let mut err = format!(
|
||||||
"Unrecognized token \"{t}\" \
|
"Unrecognized token \"{t}\" \
|
||||||
between positions {l} and {r}. Expected: {expected:?}"
|
between positions {l} and {r}. Expected: "
|
||||||
)),
|
);
|
||||||
|
let mut it = expected.iter().peekable();
|
||||||
|
while let Some(s) = it.next() {
|
||||||
|
err.push('(');
|
||||||
|
err.push_str(&s);
|
||||||
|
err.push(')');
|
||||||
|
if it.peek().is_some() {
|
||||||
|
err.push(',');
|
||||||
|
err.push(' ');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
Err(err)
|
||||||
|
},
|
||||||
ParseError::User { error } => Err(error.to_string()),
|
ParseError::User { error } => Err(error.to_string()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -534,11 +550,37 @@ fn generate_edge_pringting_fn<'a>(
|
|||||||
accumulator
|
accumulator
|
||||||
}
|
}
|
||||||
|
|
||||||
|
use petgraph::visit::IntoNodeReferences;
|
||||||
|
#[allow(clippy::type_complexity)]
|
||||||
|
fn generate_node_color_fn<'a>(
|
||||||
|
node_color: &'a graph::NodeColor,
|
||||||
|
original_graph: Rc<Graph<RSsystem, RSlabel>>,
|
||||||
|
translator: Rc<Translator>,
|
||||||
|
) -> Box<dyn Fn(&Graph<String, String>, <&Graph<String, String, petgraph::Directed, u32> as IntoNodeReferences>::NodeRef) -> String + 'a> {
|
||||||
|
Box::new(
|
||||||
|
move |i, n| {
|
||||||
|
let cloned_node_color = node_color.clone();
|
||||||
|
for (rule, color) in cloned_node_color.conditionals {
|
||||||
|
if let Some(s) = graph::node_formatter(
|
||||||
|
original_graph.clone(),
|
||||||
|
rule,
|
||||||
|
color,
|
||||||
|
translator.encode_not_mut("*")
|
||||||
|
)(i, n) {
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
}
|
||||||
|
node_color.base_color.to_string()
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
/// Writes the specified graph to a file in .dot format.
|
/// Writes the specified graph to a file in .dot format.
|
||||||
pub fn dot(
|
pub fn dot(
|
||||||
system: &EvaluatedSystem,
|
system: &EvaluatedSystem,
|
||||||
node_display: Vec<NodeDisplay>,
|
node_display: Vec<NodeDisplay>,
|
||||||
edge_display: Vec<EdgeDisplay>,
|
edge_display: Vec<EdgeDisplay>,
|
||||||
|
node_color: &graph::NodeColor
|
||||||
) -> Result<String, String> {
|
) -> Result<String, String> {
|
||||||
match system {
|
match system {
|
||||||
EvaluatedSystem::System {
|
EvaluatedSystem::System {
|
||||||
@ -554,20 +596,20 @@ pub fn dot(
|
|||||||
generate_node_pringting_fn(&node_display,
|
generate_node_pringting_fn(&node_display,
|
||||||
Rc::clone(&rc_translator)),
|
Rc::clone(&rc_translator)),
|
||||||
generate_edge_pringting_fn(&edge_display,
|
generate_edge_pringting_fn(&edge_display,
|
||||||
rc_translator),
|
Rc::clone(&rc_translator)),
|
||||||
);
|
);
|
||||||
|
|
||||||
let graph = Rc::new(graph.to_owned());
|
let graph = Rc::new(graph.to_owned());
|
||||||
|
|
||||||
let edge_formatter =
|
// let edge_formatter =
|
||||||
graph::default_edge_formatter(Rc::clone(&graph));
|
// graph::default_edge_formatter(Rc::clone(&graph));
|
||||||
let node_formatter =
|
let node_formatter =
|
||||||
graph::default_node_formatter(Rc::clone(&graph));
|
generate_node_color_fn(node_color, graph, rc_translator);
|
||||||
|
|
||||||
let dot = rsdot::RSDot::with_attr_getters(
|
let dot = rsdot::RSDot::with_attr_getters(
|
||||||
&modified_graph,
|
&modified_graph,
|
||||||
&[],
|
&[],
|
||||||
&edge_formatter,
|
&|_, _| String::new(), // &edge_formatter,
|
||||||
&node_formatter,
|
&node_formatter,
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -577,7 +619,11 @@ pub fn dot(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Writes the specified graph to a file in .graphml format.
|
/// Writes the specified graph to a file in .graphml format.
|
||||||
pub fn graphml(system: &EvaluatedSystem) -> Result<String, String> {
|
pub fn graphml(
|
||||||
|
system: &EvaluatedSystem,
|
||||||
|
node_display: Vec<NodeDisplay>,
|
||||||
|
edge_display: Vec<EdgeDisplay>,
|
||||||
|
) -> Result<String, String> {
|
||||||
match system {
|
match system {
|
||||||
EvaluatedSystem::System {
|
EvaluatedSystem::System {
|
||||||
sys: _,
|
sys: _,
|
||||||
@ -588,24 +634,10 @@ pub fn graphml(system: &EvaluatedSystem) -> Result<String, String> {
|
|||||||
|
|
||||||
// map each value to the corresponding value we want to display
|
// map each value to the corresponding value we want to display
|
||||||
let modified_graph = graph.map(
|
let modified_graph = graph.map(
|
||||||
|id, node| {
|
generate_node_pringting_fn(&node_display,
|
||||||
graph::GraphMapNodesTy::from(
|
Rc::clone(&rc_translator)),
|
||||||
graph::GraphMapNodes::Entities,
|
generate_edge_pringting_fn(&edge_display,
|
||||||
Rc::clone(&rc_translator),
|
rc_translator),
|
||||||
)
|
|
||||||
.get()(id, node)
|
|
||||||
+ "; "
|
|
||||||
+ &graph::GraphMapNodesTy::from(
|
|
||||||
graph::GraphMapNodes::Context,
|
|
||||||
Rc::clone(&rc_translator),
|
|
||||||
)
|
|
||||||
.get()(id, node)
|
|
||||||
},
|
|
||||||
graph::GraphMapEdgesTy::from(
|
|
||||||
graph::GraphMapEdges::EntitiesAdded,
|
|
||||||
Rc::clone(&rc_translator),
|
|
||||||
)
|
|
||||||
.get(),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
use petgraph_graphml::GraphMl;
|
use petgraph_graphml::GraphMl;
|
||||||
@ -726,16 +758,17 @@ fn execute(
|
|||||||
GraphSaveOptions::Dot {
|
GraphSaveOptions::Dot {
|
||||||
node_display: nd,
|
node_display: nd,
|
||||||
edge_display: ed,
|
edge_display: ed,
|
||||||
|
node_color: nc,
|
||||||
so,
|
so,
|
||||||
} => {
|
} => {
|
||||||
save_options!(dot(system, nd, ed)?, so);
|
save_options!(dot(system, nd, ed, &nc)?, so);
|
||||||
}
|
}
|
||||||
GraphSaveOptions::GraphML {
|
GraphSaveOptions::GraphML {
|
||||||
node_display: _,
|
node_display: nd,
|
||||||
edge_display: _,
|
edge_display: ed,
|
||||||
so,
|
so,
|
||||||
} => {
|
} => {
|
||||||
save_options!(graphml(system)?, so);
|
save_options!(graphml(system, nd, ed)?, so);
|
||||||
}
|
}
|
||||||
GraphSaveOptions::Serialize { path } => {
|
GraphSaveOptions::Serialize { path } => {
|
||||||
serialize(system, path)?;
|
serialize(system, path)?;
|
||||||
|
|||||||
@ -20,9 +20,9 @@ pub struct Translator {
|
|||||||
impl Translator {
|
impl Translator {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
Translator {
|
Translator {
|
||||||
strings: HashMap::new(),
|
strings: HashMap::from([("*".into(), 0)]),
|
||||||
reverse: HashMap::new(),
|
reverse: HashMap::from([(0, "*".into())]),
|
||||||
last_id: 0,
|
last_id: 1,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,4 +4,5 @@ Context: [({a,b}.{a}.{a,c}.x + {a,b}.{a}.{a}.nill)]
|
|||||||
Reactions: ([{a,b}, {c}, {b}])
|
Reactions: ([{a,b}, {c}, {b}])
|
||||||
|
|
||||||
|
|
||||||
Digraph > Dot Entities | Context "; " MaskDifference {a, b} > Print
|
Digraph > Dot Entities ", " Entities | Context "; " Difference > Print,
|
||||||
|
LimitFrequency("testing/first.experiment") > Print
|
||||||
Reference in New Issue
Block a user