From 9c26db369c86d6ff335c47749545aedbdf6ea7a0 Mon Sep 17 00:00:00 2001 From: Konrad Weiss Date: Tue, 22 Oct 2024 14:50:05 +0200 Subject: [PATCH] Adding alternative that properly depicts generator behavior --- docs/docs/CPG/specs/eog.md | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/docs/docs/CPG/specs/eog.md b/docs/docs/CPG/specs/eog.md index abe935441f..5fa287d355 100644 --- a/docs/docs/CPG/specs/eog.md +++ b/docs/docs/CPG/specs/eog.md @@ -684,7 +684,6 @@ flowchart LR parent -.-> child1 ``` Alternative2: -Alternative: ```mermaid flowchart LR classDef outer fill:#fff,stroke:#ddd,stroke-dasharray:5 5; @@ -701,6 +700,21 @@ flowchart LR parent -.-> child2 parent -.-> child1 ``` +Alternative3: +```mermaid +flowchart LR + classDef outer fill:#fff,stroke:#ddd,stroke-dasharray:5 5; + prev:::outer --EOG--> child1["comprehensionExpressions[0]"] + child1 --EOG:true--> child2["comprehensionExpressions[n]"] + child2 --EOG:true--> child3["statement"] + child2 --EOG:false--> child1["comprehensionExpressions[0]"] + child1 --EOG:false--> parent(["CollectionComprehension"]) + child3 --EOG--> child2 + parent --EOG--> next:::outer + parent -.-> child3 + parent -.-> child2 + parent -.-> child1 +``` ## ComprehensionExpression This node iterates through a collection of elements of `iterable`, keeps the element in `variable` and evaluates an optional `predicate`. @@ -718,9 +732,9 @@ flowchart LR prev:::outer --EOG--> child1["iterable"] child1 --EOG--> child2["variable"] child2 --EOG--> child3["predicate"] - child3 --EOG:false--> child1 child3 --EOG:true--> parent(["ComprehensionExpression"]) - parent --EOG--> next:::outer + parent --EOG:true--> enter:::outer + parent --EOG:false--> exit:::outer parent -.-> child3 parent -.-> child2 parent -.-> child1