From 546ea0266cffceaf14cd612e04811c7a115f61eb Mon Sep 17 00:00:00 2001 From: Alexander Wang Date: Mon, 5 Dec 2022 19:50:08 -0800 Subject: [PATCH] save --- d2compiler/compile_test.go | 34 +- d2graph/d2graph.go | 16 + d2graph/seqdiagram.go | 4 + e2etests/stable_test.go | 46 +- .../dagre/board.exp.json | 292 +++-- .../dagre/sketch.exp.svg | 4 +- .../elk/board.exp.json | 292 +++-- .../elk/sketch.exp.svg | 4 +- .../dagre/board.exp.json | 174 +-- .../dagre/sketch.exp.svg | 12 +- .../sequence_diagram_real/elk/board.exp.json | 174 +-- .../sequence_diagram_real/elk/sketch.exp.svg | 12 +- e2etests/todo_test.go | 10 +- .../TestCompile/leaky_sequence.exp.json | 2 +- .../sequence_grouped_note.exp.json | 395 ++++++ .../TestCompile/sequence_scoping.exp.json | 1059 +++++++++++++++++ 16 files changed, 2056 insertions(+), 474 deletions(-) create mode 100644 testdata/d2compiler/TestCompile/sequence_grouped_note.exp.json create mode 100644 testdata/d2compiler/TestCompile/sequence_scoping.exp.json diff --git a/d2compiler/compile_test.go b/d2compiler/compile_test.go index 90d54bc6d..593c139d9 100644 --- a/d2compiler/compile_test.go +++ b/d2compiler/compile_test.go @@ -1553,13 +1553,45 @@ dst.id <-> src.dst_id text: `x: { shape: sequence_diagram - a + a } b -> x.a `, expErr: `d2/testdata/d2compiler/TestCompile/leaky_sequence.d2:5:1: connections within sequence diagrams can connect only to other objects within the same sequence diagram `, }, + { + name: "sequence_scoping", + + text: `x: { + shape: sequence_diagram + a;b + group: { + a -> b + a.t1 -> b.t1 + b.t1.t2 -> b.t1 + } +} +`, + assertions: func(t *testing.T, g *d2graph.Graph) { + tassert.Equal(t, 7, len(g.Objects)) + tassert.Equal(t, 3, len(g.Objects[0].ChildrenArray)) + }, + }, + { + name: "sequence_grouped_note", + + text: `shape: sequence_diagram +a;d +choo: { + d."this note" +} +`, + assertions: func(t *testing.T, g *d2graph.Graph) { + tassert.Equal(t, 4, len(g.Objects)) + tassert.Equal(t, 3, len(g.Root.ChildrenArray)) + }, + }, { name: "root_direction", diff --git a/d2graph/d2graph.go b/d2graph/d2graph.go index b7af9f2a3..afee53a12 100644 --- a/d2graph/d2graph.go +++ b/d2graph/d2graph.go @@ -525,6 +525,22 @@ func (obj *Object) HasEdge(mk *d2ast.Key) (*Edge, bool) { } func ResolveUnderscoreKey(ida []string, obj *Object) (resolvedObj *Object, resolvedIDA []string, _ error) { + if len(ida) > 0 { + objSD := obj.OuterSequenceDiagram() + if objSD != nil { + referencesActor := false + for _, c := range objSD.ChildrenArray { + if c.ID == ida[0] { + referencesActor = true + break + } + } + if referencesActor { + obj = objSD + } + } + } + resolvedObj = obj resolvedIDA = ida diff --git a/d2graph/seqdiagram.go b/d2graph/seqdiagram.go index a92cc8924..5fcc6be97 100644 --- a/d2graph/seqdiagram.go +++ b/d2graph/seqdiagram.go @@ -24,6 +24,10 @@ func (obj *Object) IsSequenceDiagramGroup() bool { } for _, e := range obj.Graph.Edges { if e.Src == obj || e.Dst == obj { + if obj.AbsID() == "choo" { + println("\033[1;31m--- DEBUG:", "=======================", "\033[m") + println("\033[1;31m--- DEBUG:", e.AbsID(), "\033[m") + } return false } } diff --git a/e2etests/stable_test.go b/e2etests/stable_test.go index 230528899..dde123649 100644 --- a/e2etests/stable_test.go +++ b/e2etests/stable_test.go @@ -1363,25 +1363,25 @@ d."The earth is like a tiny grain of sand, only much, much heavier" a;b;c;d a -> b ggg: { - _.a -> _.b: lala + a -> b: lala } group 1: { - _.b -> _.c - _.c -> _.b: ey + b -> c + c -> b: ey nested guy: { - _._.c -> _._.b: okay + c -> b: okay } - _.b.t1 -> _.c.t1 - _.b.t1.t2 -> _.c.t1 - _.c.t1 -> _.b.t1 + b.t1 -> c.t1 + b.t1.t2 -> c.t1 + c.t1 -> b.t1 } group b: { - _.b -> _.c - _.c."what would arnold say" - _.c -> _.b: okay + b -> c + c."what would arnold say" + c -> b: okay } choo: { - _.d."this note" + d."this note" } `, }, @@ -1390,16 +1390,16 @@ choo: { script: `shape: sequence_diagram this is a message group: { - _.a -> _.b + a -> b and this is a nested message group: { - _._.a -> _._.b + a -> b what about more nesting: { - _._._.a -> _._._.b + a -> b crazy town: { - _._._._.a."a note" - _._._._.a -> _._._._.b + a."a note" + a -> b whoa: { - _._._._._.a -> _._._._._.b + a -> b } } } @@ -1408,16 +1408,16 @@ this is a message group: { alt: { case 1: { - _._.b -> _._.c + b -> c } case 2: { - _._.b -> _._.c + b -> c } case 3: { - _._.b -> _._.c + b -> c } case 4: { - _._.b -> _._.c + b -> c } } @@ -1431,7 +1431,7 @@ c: "just an actor" script: `How this is rendered: { shape: sequence_diagram - CLI; d2ast; d2compiler; d2layout; d2exporter; d2themes; d2renderer + CLI; d2ast; d2compiler; d2layout; d2exporter; d2themes; d2renderer; d2dagrelayout CLI -> d2ast: "'How this is rendered: {...}'" d2ast -> CLI: tokenized AST @@ -1441,7 +1441,7 @@ c: "just an actor" CLI -> d2layout.layout: run layout engines d2layout.layout -> d2sequencelayout: run engine on shape: sequence_diagram, temporarily remove only if root is not sequence: { - _.d2layout.layout -> _.d2dagrelayout: run core engine on rest + d2layout.layout -> d2dagrelayout: run core engine on rest } d2layout.layout <- d2sequencelayout: add back in sequence diagrams d2layout -> CLI: diagram with correct positions and dimensions diff --git a/e2etests/testdata/stable/sequence_diagram_nested_groups/dagre/board.exp.json b/e2etests/testdata/stable/sequence_diagram_nested_groups/dagre/board.exp.json index fa562a98c..a6530a598 100644 --- a/e2etests/testdata/stable/sequence_diagram_nested_groups/dagre/board.exp.json +++ b/e2etests/testdata/stable/sequence_diagram_nested_groups/dagre/board.exp.json @@ -5,11 +5,11 @@ "id": "this is a message group", "type": "", "pos": { - "x": -97, + "x": -47, "y": 290 }, - "width": 655, - "height": 952, + "width": 0, + "height": 0, "opacity": 1, "strokeDash": 0, "strokeWidth": 0, @@ -44,11 +44,11 @@ "id": "this is a message group.and this is a nested message group", "type": "", "pos": { - "x": -73, + "x": -23, "y": 420 }, - "width": 607, - "height": 798, + "width": 0, + "height": 0, "opacity": 1, "strokeDash": 0, "strokeWidth": 0, @@ -83,11 +83,11 @@ "id": "this is a message group.and this is a nested message group.what about more nesting", "type": "", "pos": { - "x": -49, + "x": 1, "y": 550 }, - "width": 559, - "height": 644, + "width": 0, + "height": 0, "opacity": 1, "strokeDash": 0, "strokeWidth": 0, @@ -122,16 +122,16 @@ "id": "this is a message group.and this is a nested message group.what about more nesting.crazy town", "type": "", "pos": { - "x": -25, + "x": 25, "y": 680 }, - "width": 511, - "height": 490, + "width": 0, + "height": 0, "opacity": 1, "strokeDash": 0, - "strokeWidth": 0, + "strokeWidth": 2, "borderRadius": 0, - "fill": "#DEE1EB", + "fill": "#EEF1F8", "stroke": "#0D32B2", "shadow": false, "3d": false, @@ -140,7 +140,7 @@ "link": "", "icon": null, "iconPosition": "", - "blend": true, + "blend": false, "fields": null, "methods": null, "columns": null, @@ -158,19 +158,19 @@ "level": 4 }, { - "id": "a", + "id": "this is a message group.and this is a nested message group.what about more nesting.crazy town.a", "type": "", "pos": { - "x": 24, - "y": 74 + "x": 9223372036854775807, + "y": 9223372036854775807 }, - "width": 150, - "height": 126, + "width": 0, + "height": 0, "opacity": 1, "strokeDash": 0, "strokeWidth": 2, "borderRadius": 0, - "fill": "#EDF0FD", + "fill": "#FFFFFF", "stroke": "#0D32B2", "shadow": false, "3d": false, @@ -193,19 +193,18 @@ "underline": false, "labelWidth": 12, "labelHeight": 26, - "labelPosition": "INSIDE_MIDDLE_CENTER", - "zIndex": 0, - "level": 1 + "zIndex": 3, + "level": 5 }, { - "id": "a.a note", - "type": "rectangle", + "id": "this is a message group.and this is a nested message group.what about more nesting.crazy town.a.a note", + "type": "", "pos": { - "x": 25, - "y": 720 + "x": 9223372036854775807, + "y": 9223372036854775807 }, - "width": 148, - "height": 126, + "width": -9223372036854775808, + "height": -9223372036854775808, "opacity": 1, "strokeDash": 0, "strokeWidth": 2, @@ -233,16 +232,15 @@ "underline": false, "labelWidth": 48, "labelHeight": 26, - "labelPosition": "INSIDE_MIDDLE_CENTER", - "zIndex": 5, - "level": 2 + "zIndex": 3, + "level": 6 }, { "id": "this is a message group.and this is a nested message group.what about more nesting.crazy town.whoa", "type": "", "pos": { "x": 49, - "y": 1066 + "y": 810 }, "width": 413, "height": 80, @@ -280,10 +278,10 @@ "id": "alt", "type": "", "pos": { - "x": 338, - "y": 1172 + "x": 25, + "y": 916 }, - "width": 460, + "width": 711, "height": 518, "opacity": 1, "strokeDash": 0, @@ -319,10 +317,10 @@ "id": "alt.case 1", "type": "", "pos": { - "x": 362, - "y": 1196 + "x": 49, + "y": 940 }, - "width": 412, + "width": 663, "height": 80, "opacity": 1, "strokeDash": 0, @@ -358,10 +356,10 @@ "id": "alt.case 2", "type": "", "pos": { - "x": 362, - "y": 1326 + "x": 49, + "y": 1070 }, - "width": 412, + "width": 663, "height": 80, "opacity": 1, "strokeDash": 0, @@ -397,10 +395,10 @@ "id": "alt.case 3", "type": "", "pos": { - "x": 362, - "y": 1456 + "x": 49, + "y": 1200 }, - "width": 412, + "width": 663, "height": 80, "opacity": 1, "strokeDash": 0, @@ -436,10 +434,10 @@ "id": "alt.case 4", "type": "", "pos": { - "x": 362, - "y": 1586 + "x": 49, + "y": 1330 }, - "width": 412, + "width": 663, "height": 80, "opacity": 1, "strokeDash": 0, @@ -475,7 +473,7 @@ "id": "b", "type": "", "pos": { - "x": 337, + "x": 24, "y": 74 }, "width": 150, @@ -515,8 +513,8 @@ "id": "b.note", "type": "rectangle", "pos": { - "x": 149, - "y": 2076 + "x": -163, + "y": 1500 }, "width": 525, "height": 126, @@ -551,11 +549,51 @@ "zIndex": 5, "level": 2 }, + { + "id": "a", + "type": "", + "pos": { + "x": 337, + "y": 74 + }, + "width": 150, + "height": 126, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "#EDF0FD", + "stroke": "#0D32B2", + "shadow": false, + "3d": false, + "multiple": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "a", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#0A0F25", + "italic": false, + "bold": false, + "underline": false, + "labelWidth": 12, + "labelHeight": 26, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, { "id": "a.note", "type": "rectangle", "pos": { - "x": 30, + "x": 343, "y": 1756 }, "width": 137, @@ -595,7 +633,7 @@ "id": "c", "type": "", "pos": { - "x": 629, + "x": 567, "y": 74 }, "width": 190, @@ -659,11 +697,11 @@ "labelPercentage": 0, "route": [ { - "x": 99, + "x": 412, "y": 330 }, { - "x": 412, + "x": 99, "y": 330 } ], @@ -698,11 +736,11 @@ "labelPercentage": 0, "route": [ { - "x": 99, + "x": 412, "y": 460 }, { - "x": 412, + "x": 99, "y": 460 } ], @@ -737,11 +775,11 @@ "labelPercentage": 0, "route": [ { - "x": 99, + "x": 412, "y": 590 }, { - "x": 412, + "x": 99, "y": 590 } ], @@ -776,12 +814,12 @@ "labelPercentage": 0, "route": [ { - "x": 99, - "y": 976 + "x": 412, + "y": 720 }, { - "x": 412, - "y": 976 + "x": 99, + "y": 720 } ], "animated": false, @@ -815,12 +853,12 @@ "labelPercentage": 0, "route": [ { - "x": 99, - "y": 1106 + "x": 412, + "y": 850 }, { - "x": 412, - "y": 1106 + "x": 99, + "y": 850 } ], "animated": false, @@ -854,12 +892,12 @@ "labelPercentage": 0, "route": [ { - "x": 412, - "y": 1236 + "x": 99, + "y": 980 }, { - "x": 724, - "y": 1236 + "x": 662, + "y": 980 } ], "animated": false, @@ -893,12 +931,12 @@ "labelPercentage": 0, "route": [ { - "x": 412, - "y": 1366 + "x": 99, + "y": 1110 }, { - "x": 724, - "y": 1366 + "x": 662, + "y": 1110 } ], "animated": false, @@ -932,12 +970,12 @@ "labelPercentage": 0, "route": [ { - "x": 412, - "y": 1496 + "x": 99, + "y": 1240 }, { - "x": 724, - "y": 1496 + "x": 662, + "y": 1240 } ], "animated": false, @@ -971,12 +1009,12 @@ "labelPercentage": 0, "route": [ { - "x": 412, - "y": 1626 + "x": 99, + "y": 1370 }, { - "x": 724, - "y": 1626 + "x": 662, + "y": 1370 } ], "animated": false, @@ -984,45 +1022,6 @@ "icon": null, "zIndex": 4 }, - { - "id": "(a -- )[0]", - "src": "a", - "srcArrow": "none", - "srcLabel": "", - "dst": "a-lifeline-end-2251863791", - "dstArrow": "none", - "dstLabel": "", - "opacity": 1, - "strokeDash": 6, - "strokeWidth": 2, - "stroke": "#0D32B2", - "label": "", - "fontSize": 16, - "fontFamily": "DEFAULT", - "language": "", - "color": "#676C7E", - "italic": true, - "bold": false, - "underline": false, - "labelWidth": 0, - "labelHeight": 0, - "labelPosition": "", - "labelPercentage": 0, - "route": [ - { - "x": 99, - "y": 200 - }, - { - "x": 99, - "y": 2332 - } - ], - "animated": false, - "tooltip": "", - "icon": null, - "zIndex": 1 - }, { "id": "(b -- )[0]", "src": "b", @@ -1047,6 +1046,45 @@ "labelHeight": 0, "labelPosition": "", "labelPercentage": 0, + "route": [ + { + "x": 99, + "y": 200 + }, + { + "x": 99, + "y": 2076 + } + ], + "animated": false, + "tooltip": "", + "icon": null, + "zIndex": 1 + }, + { + "id": "(a -- )[0]", + "src": "a", + "srcArrow": "none", + "srcLabel": "", + "dst": "a-lifeline-end-2251863791", + "dstArrow": "none", + "dstLabel": "", + "opacity": 1, + "strokeDash": 6, + "strokeWidth": 2, + "stroke": "#0D32B2", + "label": "", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#676C7E", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 0, + "labelHeight": 0, + "labelPosition": "", + "labelPercentage": 0, "route": [ { "x": 412, @@ -1054,7 +1092,7 @@ }, { "x": 412, - "y": 2332 + "y": 2076 } ], "animated": false, @@ -1088,12 +1126,12 @@ "labelPercentage": 0, "route": [ { - "x": 724, + "x": 662, "y": 200 }, { - "x": 724, - "y": 2332 + "x": 662, + "y": 2076 } ], "animated": false, diff --git a/e2etests/testdata/stable/sequence_diagram_nested_groups/dagre/sketch.exp.svg b/e2etests/testdata/stable/sequence_diagram_nested_groups/dagre/sketch.exp.svg index e97ce77dc..1a1f846f3 100644 --- a/e2etests/testdata/stable/sequence_diagram_nested_groups/dagre/sketch.exp.svg +++ b/e2etests/testdata/stable/sequence_diagram_nested_groups/dagre/sketch.exp.svg @@ -2,7 +2,7 @@ How this is renderedCLId2astd2compilerd2layoutd2exporterd2themesd2rendererd2dagrelayoutd2sequencelayoutonly if root is not sequence 'How this is rendered: {...}'tokenized ASTcompile ASTobjects and edgesrun layout enginesrun engine on shape: sequence_diagram, temporarily removerun core engine on rest add back in sequence diagramsdiagram with correct positions and dimensionsexport diagram with chosen theme and rendererget theme stylesrender to SVGresulting SVGmeasurements also take place + - - - + + + diff --git a/e2etests/testdata/stable/sequence_diagram_real/elk/board.exp.json b/e2etests/testdata/stable/sequence_diagram_real/elk/board.exp.json index b303818b1..a58eaf548 100644 --- a/e2etests/testdata/stable/sequence_diagram_real/elk/board.exp.json +++ b/e2etests/testdata/stable/sequence_diagram_real/elk/board.exp.json @@ -8,7 +8,7 @@ "x": 12, "y": 12 }, - "width": 2247, + "width": 2254, "height": 2336, "opacity": 1, "strokeDash": 0, @@ -321,6 +321,46 @@ "zIndex": 0, "level": 2 }, + { + "id": "How this is rendered.d2dagrelayout", + "type": "", + "pos": { + "x": 1759, + "y": 122 + }, + "width": 204, + "height": 126, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "#EDF0FD", + "stroke": "#0D32B2", + "shadow": false, + "3d": false, + "multiple": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "d2dagrelayout", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#0A0F25", + "italic": false, + "bold": false, + "underline": false, + "labelWidth": 104, + "labelHeight": 26, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 2 + }, { "id": "How this is rendered.d2compiler.measurements also take place", "type": "rectangle", @@ -368,7 +408,7 @@ "x": 817, "y": 1374 }, - "width": 1365, + "width": 1093, "height": 80, "opacity": 1, "strokeDash": 0, @@ -443,7 +483,7 @@ "id": "How this is rendered.d2sequencelayout", "type": "", "pos": { - "x": 1752, + "x": 2013, "y": 122 }, "width": 229, @@ -479,46 +519,6 @@ "zIndex": 0, "level": 2 }, - { - "id": "How this is rendered.d2dagrelayout", - "type": "", - "pos": { - "x": 2031, - "y": 122 - }, - "width": 204, - "height": 126, - "opacity": 1, - "strokeDash": 0, - "strokeWidth": 2, - "borderRadius": 0, - "fill": "#EDF0FD", - "stroke": "#0D32B2", - "shadow": false, - "3d": false, - "multiple": false, - "tooltip": "", - "link": "", - "icon": null, - "iconPosition": "", - "blend": false, - "fields": null, - "methods": null, - "columns": null, - "label": "d2dagrelayout", - "fontSize": 16, - "fontFamily": "DEFAULT", - "language": "", - "color": "#0A0F25", - "italic": false, - "bold": false, - "underline": false, - "labelWidth": 104, - "labelHeight": 26, - "labelPosition": "INSIDE_MIDDLE_CENTER", - "zIndex": 0, - "level": 2 - }, { "id": "How this is rendered.d2exporter.export", "type": "rectangle", @@ -785,7 +785,7 @@ "y": 1284 }, { - "x": 1866.5, + "x": 2127.5, "y": 1284 } ], @@ -824,7 +824,7 @@ "y": 1414 }, { - "x": 2133, + "x": 1861, "y": 1414 } ], @@ -863,7 +863,7 @@ "y": 1544 }, { - "x": 1866.5, + "x": 2127.5, "y": 1544 } ], @@ -1340,45 +1340,6 @@ "icon": null, "zIndex": 1 }, - { - "id": "(How this is rendered.d2sequencelayout -- )[0]", - "src": "How this is rendered.d2sequencelayout", - "srcArrow": "none", - "srcLabel": "", - "dst": "d2sequencelayout-lifeline-end-3085844671", - "dstArrow": "none", - "dstLabel": "", - "opacity": 1, - "strokeDash": 6, - "strokeWidth": 2, - "stroke": "#0D32B2", - "label": "", - "fontSize": 16, - "fontFamily": "DEFAULT", - "language": "", - "color": "#676C7E", - "italic": true, - "bold": false, - "underline": false, - "labelWidth": 0, - "labelHeight": 0, - "labelPosition": "", - "labelPercentage": 0, - "route": [ - { - "x": 1866.5, - "y": 248 - }, - { - "x": 1866.5, - "y": 2324 - } - ], - "animated": false, - "tooltip": "", - "icon": null, - "zIndex": 1 - }, { "id": "(How this is rendered.d2dagrelayout -- )[0]", "src": "How this is rendered.d2dagrelayout", @@ -1405,11 +1366,50 @@ "labelPercentage": 0, "route": [ { - "x": 2133, + "x": 1861, "y": 248 }, { - "x": 2133, + "x": 1861, + "y": 2324 + } + ], + "animated": false, + "tooltip": "", + "icon": null, + "zIndex": 1 + }, + { + "id": "(How this is rendered.d2sequencelayout -- )[0]", + "src": "How this is rendered.d2sequencelayout", + "srcArrow": "none", + "srcLabel": "", + "dst": "d2sequencelayout-lifeline-end-3085844671", + "dstArrow": "none", + "dstLabel": "", + "opacity": 1, + "strokeDash": 6, + "strokeWidth": 2, + "stroke": "#0D32B2", + "label": "", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#676C7E", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 0, + "labelHeight": 0, + "labelPosition": "", + "labelPercentage": 0, + "route": [ + { + "x": 2127.5, + "y": 248 + }, + { + "x": 2127.5, "y": 2324 } ], diff --git a/e2etests/testdata/stable/sequence_diagram_real/elk/sketch.exp.svg b/e2etests/testdata/stable/sequence_diagram_real/elk/sketch.exp.svg index 9e6ceb66d..46d41d475 100644 --- a/e2etests/testdata/stable/sequence_diagram_real/elk/sketch.exp.svg +++ b/e2etests/testdata/stable/sequence_diagram_real/elk/sketch.exp.svg @@ -2,7 +2,7 @@ How this is renderedCLId2astd2compilerd2layoutd2exporterd2themesd2rendererd2dagrelayoutd2sequencelayoutonly if root is not sequence 'How this is rendered: {...}'tokenized ASTcompile ASTobjects and edgesrun layout enginesrun engine on shape: sequence_diagram, temporarily removerun core engine on rest add back in sequence diagramsdiagram with correct positions and dimensionsexport diagram with chosen theme and rendererget theme stylesrender to SVGresulting SVGmeasurements also take place + - - - + + + diff --git a/e2etests/todo_test.go b/e2etests/todo_test.go index cc15f14ec..defa87cd6 100644 --- a/e2etests/todo_test.go +++ b/e2etests/todo_test.go @@ -75,15 +75,15 @@ ninety nine: { b;a;c b -> c this is a message group: { - _.a -> _.b + a -> b and this is a nested message group: { - _._.a -> _._.b + a -> b what about more nesting: { - _._._.a -> _._._.b + a -> b yo: { - _._._._.a -> _._._._.b + a -> b yo: { - _._._._._.a -> _._._._._.b + a -> b } } } diff --git a/testdata/d2compiler/TestCompile/leaky_sequence.exp.json b/testdata/d2compiler/TestCompile/leaky_sequence.exp.json index 8e993226b..e0a147f90 100644 --- a/testdata/d2compiler/TestCompile/leaky_sequence.exp.json +++ b/testdata/d2compiler/TestCompile/leaky_sequence.exp.json @@ -4,7 +4,7 @@ "ioerr": null, "errs": [ { - "range": "d2/testdata/d2compiler/TestCompile/leaky_sequence.d2,4:0:36-4:8:44", + "range": "d2/testdata/d2compiler/TestCompile/leaky_sequence.d2,4:0:37-4:8:45", "errmsg": "d2/testdata/d2compiler/TestCompile/leaky_sequence.d2:5:1: connections within sequence diagrams can connect only to other objects within the same sequence diagram" } ] diff --git a/testdata/d2compiler/TestCompile/sequence_grouped_note.exp.json b/testdata/d2compiler/TestCompile/sequence_grouped_note.exp.json new file mode 100644 index 000000000..df9cc8f88 --- /dev/null +++ b/testdata/d2compiler/TestCompile/sequence_grouped_note.exp.json @@ -0,0 +1,395 @@ +{ + "graph": { + "ast": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_grouped_note.d2,0:0:0-5:0:54", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_grouped_note.d2,0:0:0-0:23:23", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_grouped_note.d2,0:0:0-0:5:5", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_grouped_note.d2,0:0:0-0:5:5", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_grouped_note.d2,0:7:7-0:23:23", + "value": [ + { + "string": "sequence_diagram", + "raw_string": "sequence_diagram" + } + ] + } + } + } + }, + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_grouped_note.d2,1:0:24-1:1:25", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_grouped_note.d2,1:0:24-1:1:25", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_grouped_note.d2,1:0:24-1:1:25", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + } + ] + }, + "primary": {}, + "value": {} + } + }, + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_grouped_note.d2,1:2:26-1:3:27", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_grouped_note.d2,1:2:26-1:3:27", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_grouped_note.d2,1:2:26-1:3:27", + "value": [ + { + "string": "d", + "raw_string": "d" + } + ] + } + } + ] + }, + "primary": {}, + "value": {} + } + }, + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_grouped_note.d2,2:0:28-4:1:53", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_grouped_note.d2,2:0:28-2:4:32", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_grouped_note.d2,2:0:28-2:4:32", + "value": [ + { + "string": "choo", + "raw_string": "choo" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_grouped_note.d2,2:6:34-4:0:52", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_grouped_note.d2,3:2:38-3:15:51", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_grouped_note.d2,3:2:38-3:15:51", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_grouped_note.d2,3:2:38-3:3:39", + "value": [ + { + "string": "d", + "raw_string": "d" + } + ] + } + }, + { + "double_quoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_grouped_note.d2,3:4:40-3:15:51", + "value": [ + { + "string": "this note", + "raw_string": "this note" + } + ] + } + } + ] + }, + "primary": {}, + "value": {} + } + } + ] + } + } + } + } + ] + }, + "root": { + "id": "", + "id_val": "", + "label_dimensions": { + "width": 0, + "height": 0 + }, + "attributes": { + "label": { + "value": "" + }, + "style": {}, + "near_key": null, + "shape": { + "value": "sequence_diagram" + }, + "direction": { + "value": "" + } + }, + "zIndex": 0 + }, + "edges": null, + "objects": [ + { + "id": "a", + "id_val": "a", + "label_dimensions": { + "width": 0, + "height": 0 + }, + "references": [ + { + "key": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_grouped_note.d2,1:0:24-1:1:25", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_grouped_note.d2,1:0:24-1:1:25", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": 0 + } + ], + "attributes": { + "label": { + "value": "a" + }, + "style": {}, + "near_key": null, + "shape": { + "value": "" + }, + "direction": { + "value": "" + } + }, + "zIndex": 0 + }, + { + "id": "d", + "id_val": "d", + "label_dimensions": { + "width": 0, + "height": 0 + }, + "references": [ + { + "key": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_grouped_note.d2,1:2:26-1:3:27", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_grouped_note.d2,1:2:26-1:3:27", + "value": [ + { + "string": "d", + "raw_string": "d" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": 0 + }, + { + "key": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_grouped_note.d2,3:2:38-3:15:51", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_grouped_note.d2,3:2:38-3:3:39", + "value": [ + { + "string": "d", + "raw_string": "d" + } + ] + } + }, + { + "double_quoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_grouped_note.d2,3:4:40-3:15:51", + "value": [ + { + "string": "this note", + "raw_string": "this note" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": 0 + } + ], + "attributes": { + "label": { + "value": "d" + }, + "style": {}, + "near_key": null, + "shape": { + "value": "" + }, + "direction": { + "value": "" + } + }, + "zIndex": 0 + }, + { + "id": "choo", + "id_val": "choo", + "label_dimensions": { + "width": 0, + "height": 0 + }, + "references": [ + { + "key": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_grouped_note.d2,2:0:28-2:4:32", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_grouped_note.d2,2:0:28-2:4:32", + "value": [ + { + "string": "choo", + "raw_string": "choo" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": 0 + } + ], + "attributes": { + "label": { + "value": "choo" + }, + "style": {}, + "near_key": null, + "shape": { + "value": "" + }, + "direction": { + "value": "" + } + }, + "zIndex": 0 + }, + { + "id": "this note", + "id_val": "this note", + "label_dimensions": { + "width": 0, + "height": 0 + }, + "references": [ + { + "key": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_grouped_note.d2,3:2:38-3:15:51", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_grouped_note.d2,3:2:38-3:3:39", + "value": [ + { + "string": "d", + "raw_string": "d" + } + ] + } + }, + { + "double_quoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_grouped_note.d2,3:4:40-3:15:51", + "value": [ + { + "string": "this note", + "raw_string": "this note" + } + ] + } + } + ] + }, + "key_path_index": 1, + "map_key_edge_index": 0 + } + ], + "attributes": { + "label": { + "value": "this note" + }, + "style": {}, + "near_key": null, + "shape": { + "value": "" + }, + "direction": { + "value": "" + } + }, + "zIndex": 0 + } + ] + }, + "err": null +} diff --git a/testdata/d2compiler/TestCompile/sequence_scoping.exp.json b/testdata/d2compiler/TestCompile/sequence_scoping.exp.json new file mode 100644 index 000000000..815fbddb0 --- /dev/null +++ b/testdata/d2compiler/TestCompile/sequence_scoping.exp.json @@ -0,0 +1,1059 @@ +{ + "graph": { + "ast": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,0:0:0-9:0:101", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,0:0:0-8:1:100", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,0:0:0-0:1:1", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,0:0:0-0:1:1", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,0:3:3-8:0:99", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,1:2:7-1:25:30", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,1:2:7-1:7:12", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,1:2:7-1:7:12", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,1:9:14-1:25:30", + "value": [ + { + "string": "sequence_diagram", + "raw_string": "sequence_diagram" + } + ] + } + } + } + }, + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,2:1:32-2:2:33", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,2:1:32-2:2:33", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,2:1:32-2:2:33", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + } + ] + }, + "primary": {}, + "value": {} + } + }, + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,2:3:34-2:4:35", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,2:3:34-2:4:35", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,2:3:34-2:4:35", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + } + ] + }, + "primary": {}, + "value": {} + } + }, + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,3:2:38-7:3:98", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,3:2:38-3:7:43", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,3:2:38-3:7:43", + "value": [ + { + "string": "group", + "raw_string": "group" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,3:9:45-7:2:97", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,4:4:51-4:10:57", + "edges": [ + { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,4:4:51-4:10:57", + "src": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,4:4:51-4:6:53", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,4:4:51-4:5:52", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + } + ] + }, + "src_arrow": "", + "dst": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,4:8:55-4:10:57", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,4:9:56-4:10:57", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + } + ] + }, + "dst_arrow": ">" + } + ], + "primary": {}, + "value": {} + } + }, + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,5:4:62-5:16:74", + "edges": [ + { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,5:4:62-5:16:74", + "src": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,5:4:62-5:9:67", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,5:4:62-5:5:63", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,5:6:64-5:8:66", + "value": [ + { + "string": "t1", + "raw_string": "t1" + } + ] + } + } + ] + }, + "src_arrow": "", + "dst": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,5:11:69-5:16:74", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,5:12:70-5:13:71", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,5:14:72-5:16:74", + "value": [ + { + "string": "t1", + "raw_string": "t1" + } + ] + } + } + ] + }, + "dst_arrow": ">" + } + ], + "primary": {}, + "value": {} + } + }, + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,6:4:79-6:19:94", + "edges": [ + { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,6:4:79-6:19:94", + "src": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,6:4:79-6:12:87", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,6:4:79-6:5:80", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,6:6:81-6:8:83", + "value": [ + { + "string": "t1", + "raw_string": "t1" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,6:9:84-6:11:86", + "value": [ + { + "string": "t2", + "raw_string": "t2" + } + ] + } + } + ] + }, + "src_arrow": "", + "dst": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,6:14:89-6:19:94", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,6:15:90-6:16:91", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,6:17:92-6:19:94", + "value": [ + { + "string": "t1", + "raw_string": "t1" + } + ] + } + } + ] + }, + "dst_arrow": ">" + } + ], + "primary": {}, + "value": {} + } + } + ] + } + } + } + } + ] + } + } + } + } + ] + }, + "root": { + "id": "", + "id_val": "", + "label_dimensions": { + "width": 0, + "height": 0 + }, + "attributes": { + "label": { + "value": "" + }, + "style": {}, + "near_key": null, + "shape": { + "value": "" + }, + "direction": { + "value": "" + } + }, + "zIndex": 0 + }, + "edges": [ + { + "index": 0, + "minWidth": 0, + "minHeight": 0, + "label_dimensions": { + "width": 0, + "height": 0 + }, + "isCurve": false, + "src_arrow": false, + "dst_arrow": true, + "references": [ + { + "map_key_edge_index": 0 + } + ], + "attributes": { + "label": { + "value": "" + }, + "style": {}, + "near_key": null, + "shape": { + "value": "" + }, + "direction": { + "value": "" + } + }, + "zIndex": 0 + }, + { + "index": 0, + "minWidth": 0, + "minHeight": 0, + "label_dimensions": { + "width": 0, + "height": 0 + }, + "isCurve": false, + "src_arrow": false, + "dst_arrow": true, + "references": [ + { + "map_key_edge_index": 0 + } + ], + "attributes": { + "label": { + "value": "" + }, + "style": {}, + "near_key": null, + "shape": { + "value": "" + }, + "direction": { + "value": "" + } + }, + "zIndex": 0 + }, + { + "index": 0, + "minWidth": 0, + "minHeight": 0, + "label_dimensions": { + "width": 0, + "height": 0 + }, + "isCurve": false, + "src_arrow": false, + "dst_arrow": true, + "references": [ + { + "map_key_edge_index": 0 + } + ], + "attributes": { + "label": { + "value": "" + }, + "style": {}, + "near_key": null, + "shape": { + "value": "" + }, + "direction": { + "value": "" + } + }, + "zIndex": 0 + } + ], + "objects": [ + { + "id": "x", + "id_val": "x", + "label_dimensions": { + "width": 0, + "height": 0 + }, + "references": [ + { + "key": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,0:0:0-0:1:1", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,0:0:0-0:1:1", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": 0 + } + ], + "attributes": { + "label": { + "value": "x" + }, + "style": {}, + "near_key": null, + "shape": { + "value": "sequence_diagram" + }, + "direction": { + "value": "" + } + }, + "zIndex": 0 + }, + { + "id": "a", + "id_val": "a", + "label_dimensions": { + "width": 0, + "height": 0 + }, + "references": [ + { + "key": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,2:1:32-2:2:33", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,2:1:32-2:2:33", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": 0 + }, + { + "key": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,4:4:51-4:6:53", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,4:4:51-4:5:52", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": 0 + }, + { + "key": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,5:4:62-5:9:67", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,5:4:62-5:5:63", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,5:6:64-5:8:66", + "value": [ + { + "string": "t1", + "raw_string": "t1" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": 0 + } + ], + "attributes": { + "label": { + "value": "a" + }, + "style": {}, + "near_key": null, + "shape": { + "value": "" + }, + "direction": { + "value": "" + } + }, + "zIndex": 0 + }, + { + "id": "b", + "id_val": "b", + "label_dimensions": { + "width": 0, + "height": 0 + }, + "references": [ + { + "key": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,2:3:34-2:4:35", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,2:3:34-2:4:35", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": 0 + }, + { + "key": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,4:8:55-4:10:57", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,4:9:56-4:10:57", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": 0 + }, + { + "key": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,5:11:69-5:16:74", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,5:12:70-5:13:71", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,5:14:72-5:16:74", + "value": [ + { + "string": "t1", + "raw_string": "t1" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": 0 + }, + { + "key": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,6:4:79-6:12:87", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,6:4:79-6:5:80", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,6:6:81-6:8:83", + "value": [ + { + "string": "t1", + "raw_string": "t1" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,6:9:84-6:11:86", + "value": [ + { + "string": "t2", + "raw_string": "t2" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": 0 + }, + { + "key": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,6:14:89-6:19:94", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,6:15:90-6:16:91", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,6:17:92-6:19:94", + "value": [ + { + "string": "t1", + "raw_string": "t1" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": 0 + } + ], + "attributes": { + "label": { + "value": "b" + }, + "style": {}, + "near_key": null, + "shape": { + "value": "" + }, + "direction": { + "value": "" + } + }, + "zIndex": 0 + }, + { + "id": "group", + "id_val": "group", + "label_dimensions": { + "width": 0, + "height": 0 + }, + "references": [ + { + "key": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,3:2:38-3:7:43", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,3:2:38-3:7:43", + "value": [ + { + "string": "group", + "raw_string": "group" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": 0 + } + ], + "attributes": { + "label": { + "value": "group" + }, + "style": {}, + "near_key": null, + "shape": { + "value": "" + }, + "direction": { + "value": "" + } + }, + "zIndex": 0 + }, + { + "id": "t1", + "id_val": "t1", + "label_dimensions": { + "width": 0, + "height": 0 + }, + "references": [ + { + "key": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,5:4:62-5:9:67", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,5:4:62-5:5:63", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,5:6:64-5:8:66", + "value": [ + { + "string": "t1", + "raw_string": "t1" + } + ] + } + } + ] + }, + "key_path_index": 1, + "map_key_edge_index": 0 + } + ], + "attributes": { + "label": { + "value": "t1" + }, + "style": {}, + "near_key": null, + "shape": { + "value": "" + }, + "direction": { + "value": "" + } + }, + "zIndex": 0 + }, + { + "id": "t1", + "id_val": "t1", + "label_dimensions": { + "width": 0, + "height": 0 + }, + "references": [ + { + "key": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,5:11:69-5:16:74", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,5:12:70-5:13:71", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,5:14:72-5:16:74", + "value": [ + { + "string": "t1", + "raw_string": "t1" + } + ] + } + } + ] + }, + "key_path_index": 1, + "map_key_edge_index": 0 + }, + { + "key": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,6:4:79-6:12:87", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,6:4:79-6:5:80", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,6:6:81-6:8:83", + "value": [ + { + "string": "t1", + "raw_string": "t1" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,6:9:84-6:11:86", + "value": [ + { + "string": "t2", + "raw_string": "t2" + } + ] + } + } + ] + }, + "key_path_index": 1, + "map_key_edge_index": 0 + }, + { + "key": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,6:14:89-6:19:94", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,6:15:90-6:16:91", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,6:17:92-6:19:94", + "value": [ + { + "string": "t1", + "raw_string": "t1" + } + ] + } + } + ] + }, + "key_path_index": 1, + "map_key_edge_index": 0 + } + ], + "attributes": { + "label": { + "value": "t1" + }, + "style": {}, + "near_key": null, + "shape": { + "value": "" + }, + "direction": { + "value": "" + } + }, + "zIndex": 0 + }, + { + "id": "t2", + "id_val": "t2", + "label_dimensions": { + "width": 0, + "height": 0 + }, + "references": [ + { + "key": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,6:4:79-6:12:87", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,6:4:79-6:5:80", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,6:6:81-6:8:83", + "value": [ + { + "string": "t1", + "raw_string": "t1" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,6:9:84-6:11:86", + "value": [ + { + "string": "t2", + "raw_string": "t2" + } + ] + } + } + ] + }, + "key_path_index": 2, + "map_key_edge_index": 0 + } + ], + "attributes": { + "label": { + "value": "t2" + }, + "style": {}, + "near_key": null, + "shape": { + "value": "" + }, + "direction": { + "value": "" + } + }, + "zIndex": 0 + } + ] + }, + "err": null +}