From ac848b070dc773b43810cec8995a34346f8c33c8 Mon Sep 17 00:00:00 2001 From: Akemi Izuko Date: Tue, 14 Nov 2023 14:57:54 -0700 Subject: [PATCH] Graphviz: add return/statement functions --- .gitignore | 1 + graphviz/functions/gen_return.dot | 22 +++++++++++++++++++ graphviz/functions/gen_statement.dot | 33 ++++++++++++++++++++++++++++ 3 files changed, 56 insertions(+) create mode 100644 graphviz/functions/gen_return.dot create mode 100644 graphviz/functions/gen_statement.dot diff --git a/.gitignore b/.gitignore index dc2618e..04ebdfd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /target *.svg +Cargo.lock diff --git a/graphviz/functions/gen_return.dot b/graphviz/functions/gen_return.dot new file mode 100644 index 0000000..11c58ea --- /dev/null +++ b/graphviz/functions/gen_return.dot @@ -0,0 +1,22 @@ +digraph fn_gen_return { + labelloc="t"; + graph [fontname = "cc wild words"]; + node [fontname = "cc wild words"]; + edge [fontname = "cc wild words"]; + + label="fn_gen_return(return: GazType)"; + fontname=lovebeat; + rankdir=LR; + newrank=true; + + a [label="choice" rank=max]; + b [label="gen_if_statement_with_return()" shape=diamond style=filled fillcolor=lightcoral]; + c [label="gen_loop_with_return()" shape=diamond style=filled fillcolor=lightcoral]; + d [label="return"]; + e [label="gen_type()" shape=diamond style=filled fillcolor=lightcoral]; + f [label="return" style=filled fillcolor=lightskyblue1]; + + a -> b -> f; + a -> c -> f; + a -> d -> e -> f; +} diff --git a/graphviz/functions/gen_statement.dot b/graphviz/functions/gen_statement.dot new file mode 100644 index 0000000..5b6adfa --- /dev/null +++ b/graphviz/functions/gen_statement.dot @@ -0,0 +1,33 @@ +digraph fn_gen_statement { + labelloc="t"; + graph [fontname = "cc wild words"]; + node [fontname = "cc wild words"]; + edge [fontname = "cc wild words"]; + + label="fn_gen_statement(Vec, return: GazType)"; + fontname=lovebeat; + rankdir=LR; + newrank=true; + + a [label="can declare" rank=max]; + b [label="cannot declare" rank=min]; + c [label="gen_decl()" shape=diamond style=filled fillcolor=lightcoral]; + d [label="gen_if_statement()" shape=diamond style=filled fillcolor=lightcoral]; + e [label="gen_std_output()" shape=diamond style=filled fillcolor=lightcoral]; + f [label="gen_loop()" shape=diamond style=filled fillcolor=lightcoral]; + g [label="gen_assignment()" shape=diamond style=filled fillcolor=lightcoral]; + h [label="return" style=filled fillcolor=lightskyblue1]; + + a -> c -> a; + a -> d; + a -> e; + a -> f; + a -> g; + a -> h; + + b -> d -> b; + b -> e -> b; + b -> f -> b; + b -> g -> b; + b -> h; +}