From 0c059bb6d87698f2dcf4580c2312b412870ec388 Mon Sep 17 00:00:00 2001 From: dozens Date: Fri, 7 Oct 2022 22:10:58 -0600 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix=20regex?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit the regex for building the DOT text was too greedy! in cases where there were more than two branches in a given text, it would only match the first branch and the second branch. because of how greedy it was. so hopefully this should fix that. at least, graph.png looks correct to me now. --- justfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/justfile b/justfile index df2938b..083fa50 100644 --- a/justfile +++ b/justfile @@ -7,6 +7,7 @@ _map: recsel game.rec | recfmt '"{{{{name}}": "{{{{id}}", ' # build dot file +# TODO: change id to name? or id /and/ name? _dot: #!/usr/bin/env zsh echo "digraph {" > dot @@ -14,7 +15,7 @@ _dot: | recfmt '{{{{id}} -> {{{{text}}|' \ | sed -e 's/|/\n\n/g' \ | sed -e '/./{H;$!d;}' -e 'x; s/\n//g; G;' \ - | sed -e 's/}}.*{{{{/}} {{{{/g' -e 's/> [^{]* {{{{/> {{{{/' \ + | sed -e 's/}}[^{]*{{{{/}} {{{{/g' -e 's/> [^{]* {{{{/> {{{{/' \ | sed -e '/{{{{/!d' -e 's/\.$//' \ | sed -e 's/> \(.*\)$/> { \1 };/' \ >> dot