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..de5785ffa 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 && !obj.IsSequenceDiagram() { + 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/e2etests/stable_test.go b/e2etests/stable_test.go index 230528899..a7e7d93e3 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" } `, }, @@ -1389,17 +1389,19 @@ choo: { name: "sequence_diagram_nested_groups", script: `shape: sequence_diagram +a; 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 crazy town: { - _._._._.a."a note" - _._._._.a -> _._._._.b + a."a note" + a -> b whoa: { - _._._._._.a -> _._._._._.b + a -> b } } } @@ -1408,16 +1410,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 +1433,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; d2sequencelayout; d2dagrelayout CLI -> d2ast: "'How this is rendered: {...}'" d2ast -> CLI: tokenized AST @@ -1441,7 +1443,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..659f3e957 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 @@ -1,6 +1,126 @@ { "name": "", "shapes": [ + { + "id": "a", + "type": "", + "pos": { + "x": 24, + "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": "b", + "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": "b", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#0A0F25", + "italic": false, + "bold": false, + "underline": false, + "labelWidth": 13, + "labelHeight": 26, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "c", + "type": "", + "pos": { + "x": 629, + "y": 74 + }, + "width": 190, + "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": "just an actor", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#0A0F25", + "italic": false, + "bold": false, + "underline": false, + "labelWidth": 90, + "labelHeight": 26, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, { "id": "this is a message group", "type": "", @@ -157,46 +277,6 @@ "zIndex": 3, "level": 4 }, - { - "id": "a", - "type": "", - "pos": { - "x": 24, - "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.a note", "type": "rectangle", @@ -471,46 +551,6 @@ "zIndex": 3, "level": 2 }, - { - "id": "b", - "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": "b", - "fontSize": 16, - "fontFamily": "DEFAULT", - "language": "", - "color": "#0A0F25", - "italic": false, - "bold": false, - "underline": false, - "labelWidth": 13, - "labelHeight": 26, - "labelPosition": "INSIDE_MIDDLE_CENTER", - "zIndex": 0, - "level": 1 - }, { "id": "b.note", "type": "rectangle", @@ -590,46 +630,6 @@ "labelPosition": "INSIDE_MIDDLE_CENTER", "zIndex": 5, "level": 2 - }, - { - "id": "c", - "type": "", - "pos": { - "x": 629, - "y": 74 - }, - "width": 190, - "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": "just an actor", - "fontSize": 16, - "fontFamily": "DEFAULT", - "language": "", - "color": "#0A0F25", - "italic": false, - "bold": false, - "underline": false, - "labelWidth": 90, - "labelHeight": 26, - "labelPosition": "INSIDE_MIDDLE_CENTER", - "zIndex": 0, - "level": 1 } ], "connections": [ diff --git a/e2etests/testdata/stable/sequence_diagram_nested_groups/elk/board.exp.json b/e2etests/testdata/stable/sequence_diagram_nested_groups/elk/board.exp.json index fa562a98c..659f3e957 100644 --- a/e2etests/testdata/stable/sequence_diagram_nested_groups/elk/board.exp.json +++ b/e2etests/testdata/stable/sequence_diagram_nested_groups/elk/board.exp.json @@ -1,6 +1,126 @@ { "name": "", "shapes": [ + { + "id": "a", + "type": "", + "pos": { + "x": 24, + "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": "b", + "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": "b", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#0A0F25", + "italic": false, + "bold": false, + "underline": false, + "labelWidth": 13, + "labelHeight": 26, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "c", + "type": "", + "pos": { + "x": 629, + "y": 74 + }, + "width": 190, + "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": "just an actor", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#0A0F25", + "italic": false, + "bold": false, + "underline": false, + "labelWidth": 90, + "labelHeight": 26, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, { "id": "this is a message group", "type": "", @@ -157,46 +277,6 @@ "zIndex": 3, "level": 4 }, - { - "id": "a", - "type": "", - "pos": { - "x": 24, - "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.a note", "type": "rectangle", @@ -471,46 +551,6 @@ "zIndex": 3, "level": 2 }, - { - "id": "b", - "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": "b", - "fontSize": 16, - "fontFamily": "DEFAULT", - "language": "", - "color": "#0A0F25", - "italic": false, - "bold": false, - "underline": false, - "labelWidth": 13, - "labelHeight": 26, - "labelPosition": "INSIDE_MIDDLE_CENTER", - "zIndex": 0, - "level": 1 - }, { "id": "b.note", "type": "rectangle", @@ -590,46 +630,6 @@ "labelPosition": "INSIDE_MIDDLE_CENTER", "zIndex": 5, "level": 2 - }, - { - "id": "c", - "type": "", - "pos": { - "x": 629, - "y": 74 - }, - "width": 190, - "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": "just an actor", - "fontSize": 16, - "fontFamily": "DEFAULT", - "language": "", - "color": "#0A0F25", - "italic": false, - "bold": false, - "underline": false, - "labelWidth": 90, - "labelHeight": 26, - "labelPosition": "INSIDE_MIDDLE_CENTER", - "zIndex": 0, - "level": 1 } ], "connections": [ diff --git a/e2etests/testdata/stable/sequence_diagram_real/dagre/board.exp.json b/e2etests/testdata/stable/sequence_diagram_real/dagre/board.exp.json index 406cfd42b..27ff4c10a 100644 --- a/e2etests/testdata/stable/sequence_diagram_real/dagre/board.exp.json +++ b/e2etests/testdata/stable/sequence_diagram_real/dagre/board.exp.json @@ -321,6 +321,86 @@ "zIndex": 0, "level": 2 }, + { + "id": "How this is rendered.d2sequencelayout", + "type": "", + "pos": { + "x": 1740, + "y": 110 + }, + "width": 229, + "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": "d2sequencelayout", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#0A0F25", + "italic": false, + "bold": false, + "underline": false, + "labelWidth": 129, + "labelHeight": 26, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 2 + }, + { + "id": "How this is rendered.d2dagrelayout", + "type": "", + "pos": { + "x": 2019, + "y": 110 + }, + "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", @@ -439,86 +519,6 @@ "zIndex": 2, "level": 3 }, - { - "id": "How this is rendered.d2sequencelayout", - "type": "", - "pos": { - "x": 1740, - "y": 110 - }, - "width": 229, - "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": "d2sequencelayout", - "fontSize": 16, - "fontFamily": "DEFAULT", - "language": "", - "color": "#0A0F25", - "italic": false, - "bold": false, - "underline": false, - "labelWidth": 129, - "labelHeight": 26, - "labelPosition": "INSIDE_MIDDLE_CENTER", - "zIndex": 0, - "level": 2 - }, - { - "id": "How this is rendered.d2dagrelayout", - "type": "", - "pos": { - "x": 2019, - "y": 110 - }, - "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", 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..c6304f462 100644 --- a/e2etests/testdata/stable/sequence_diagram_real/elk/board.exp.json +++ b/e2etests/testdata/stable/sequence_diagram_real/elk/board.exp.json @@ -321,6 +321,86 @@ "zIndex": 0, "level": 2 }, + { + "id": "How this is rendered.d2sequencelayout", + "type": "", + "pos": { + "x": 1752, + "y": 122 + }, + "width": 229, + "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": "d2sequencelayout", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#0A0F25", + "italic": false, + "bold": false, + "underline": false, + "labelWidth": 129, + "labelHeight": 26, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "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.d2compiler.measurements also take place", "type": "rectangle", @@ -439,86 +519,6 @@ "zIndex": 2, "level": 3 }, - { - "id": "How this is rendered.d2sequencelayout", - "type": "", - "pos": { - "x": 1752, - "y": 122 - }, - "width": 229, - "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": "d2sequencelayout", - "fontSize": 16, - "fontFamily": "DEFAULT", - "language": "", - "color": "#0A0F25", - "italic": false, - "bold": false, - "underline": false, - "labelWidth": 129, - "labelHeight": 26, - "labelPosition": "INSIDE_MIDDLE_CENTER", - "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", 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 +}