Skip to content

Commit

Permalink
Adding alternative that properly depicts generator behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
konradweiss committed Oct 22, 2024
1 parent 4d38317 commit 9c26db3
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions docs/docs/CPG/specs/eog.md
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,6 @@ flowchart LR
parent -.-> child1
```
Alternative2:
Alternative:
```mermaid
flowchart LR
classDef outer fill:#fff,stroke:#ddd,stroke-dasharray:5 5;
Expand All @@ -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`.
Expand All @@ -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
Expand Down

0 comments on commit 9c26db3

Please sign in to comment.