diff --git a/d2compiler/compile.go b/d2compiler/compile.go index 327b25e152..1a4ea66bd0 100644 --- a/d2compiler/compile.go +++ b/d2compiler/compile.go @@ -56,6 +56,10 @@ func compileIR(ast *d2ast.Map, m *d2ir.Map) (*d2graph.Graph, error) { if len(c.err.Errors) > 0 { return nil, c.err } + c.validateBoardLinks(g) + if len(c.err.Errors) > 0 { + return nil, c.err + } return g, nil } @@ -93,6 +97,7 @@ func (c *compiler) compileBoardsField(g *d2graph.Graph, ir *d2ir.Map, fieldName continue } g2 := d2graph.NewGraph() + g2.Parent = g g2.AST = g.AST c.compileBoard(g2, f.Map()) g2.Name = f.Name @@ -193,7 +198,7 @@ func (c *compiler) compileField(obj *d2graph.Object, f *d2ir.Field) { obj.Map = fr.Context.Key.Value.Map } } - scopeObjIDA := d2ir.IDA(fr.Context.ScopeMap) + scopeObjIDA := d2ir.BoardIDA(fr.Context.ScopeMap) scopeObj := obj.Graph.Root.EnsureChildIDVal(scopeObjIDA) obj.References = append(obj.References, d2graph.Reference{ Key: fr.KeyPath, @@ -431,7 +436,7 @@ func (c *compiler) compileEdge(obj *d2graph.Object, e *d2ir.Edge) { edge.Attributes.Label.MapKey = e.LastPrimaryKey() for _, er := range e.References { - scopeObjIDA := d2ir.IDA(er.Context.ScopeMap) + scopeObjIDA := d2ir.BoardIDA(er.Context.ScopeMap) scopeObj := edge.Src.Graph.Root.EnsureChildIDVal(scopeObjIDA) edge.References = append(edge.References, d2graph.EdgeReference{ Edge: er.Context.Edge, @@ -715,6 +720,72 @@ func (c *compiler) validateNear(g *d2graph.Graph) { } } +func (c *compiler) validateBoardLinks(g *d2graph.Graph) { + for _, obj := range g.Objects { + if obj.Attributes.Link == nil { + continue + } + + linkKey, err := d2parser.ParseKey(obj.Attributes.Link.Value) + if err != nil { + continue + } + + if linkKey.Path[0].Unbox().ScalarString() != "root" { + continue + } + + if !hasBoard(g.RootBoard(), linkKey.IDA()) { + c.errorf(obj.Attributes.Link.MapKey, "linked board not found") + continue + } + } + for _, b := range g.Layers { + c.validateBoardLinks(b) + } + for _, b := range g.Scenarios { + c.validateBoardLinks(b) + } + for _, b := range g.Steps { + c.validateBoardLinks(b) + } +} + +func hasBoard(root *d2graph.Graph, ida []string) bool { + if len(ida) == 0 { + return true + } + if ida[0] == "root" { + return hasBoard(root, ida[1:]) + } + id := ida[0] + if len(ida) == 1 { + return root.Name == id + } + nextID := ida[1] + switch id { + case "layers": + for _, b := range root.Layers { + if b.Name == nextID { + return hasBoard(b, ida[2:]) + } + } + case "scenarios": + for _, b := range root.Scenarios { + if b.Name == nextID { + return hasBoard(b, ida[2:]) + } + } + case "steps": + for _, b := range root.Steps { + if b.Name == nextID { + return hasBoard(b, ida[2:]) + } + } + } + return false +} + func init() { FullToShortLanguageAliases = make(map[string]string, len(ShortToFullLanguageAliases)) for k, v := range ShortToFullLanguageAliases { diff --git a/d2compiler/compile_test.go b/d2compiler/compile_test.go index c6219d291f..4ae917bb61 100644 --- a/d2compiler/compile_test.go +++ b/d2compiler/compile_test.go @@ -2027,6 +2027,121 @@ Chinchillas_Collectibles.chinchilla -> Chinchillas.id`, tassert.Equal(t, 2, *g.Edges[0].SrcTableColumnIndex) }, }, + { + name: "link-board-ok", + text: `x.link: layers.x +layers: { + x: { + y + } +}`, + assertions: func(t *testing.T, g *d2graph.Graph) { + tassert.Equal(t, "root.layers.x", g.Objects[0].Attributes.Link.Value) + }, + }, + { + name: "link-board-mixed", + text: `question: How does the cat go? +question.link: layers.cat + +layers: { + cat: { + the cat -> meeeowwww: goes + } +} + +scenarios: { + green: { + question.style.fill: green + } +}`, + assertions: func(t *testing.T, g *d2graph.Graph) { + tassert.Equal(t, "root.layers.cat", g.Objects[0].Attributes.Link.Value) + tassert.Equal(t, "root.layers.cat", g.Scenarios[0].Objects[0].Attributes.Link.Value) + }, + }, + { + name: "link-board-not-found", + text: `x.link: layers.x +`, + expErr: `d2/testdata/d2compiler/TestCompile/link-board-not-found.d2:1:1: linked board not found`, + }, + { + name: "link-board-not-board", + text: `zzz +x.link: layers.x.y +layers: { + x: { + y + } +}`, + expErr: `d2/testdata/d2compiler/TestCompile/link-board-not-board.d2:2:1: linked board not found`, + }, + { + name: "link-board-nested", + text: `x.link: layers.x.layers.x +layers: { + x: { + layers: { + x: { + hello + } + } + } +}`, + assertions: func(t *testing.T, g *d2graph.Graph) { + tassert.Equal(t, "root.layers.x.layers.x", g.Objects[0].Attributes.Link.Value) + }, + }, + { + name: "link-board-key-nested", + text: `x: { + y.link: layers.x +} +layers: { + x: { + yo + } +}`, + assertions: func(t *testing.T, g *d2graph.Graph) { + tassert.Equal(t, "root.layers.x", g.Objects[1].Attributes.Link.Value) + }, + }, + { + name: "link-board-underscore", + text: `x +layers: { + x: { + yo + layers: { + x: { + hello.link: _._.layers.x + hey.link: _ + } + } + } +}`, + assertions: func(t *testing.T, g *d2graph.Graph) { + tassert.NotNil(t, g.Layers[0].Layers[0].Objects[0].Attributes.Link.Value) + tassert.Equal(t, "root.layers.x", g.Layers[0].Layers[0].Objects[0].Attributes.Link.Value) + tassert.Equal(t, "root.layers.x", g.Layers[0].Layers[0].Objects[1].Attributes.Link.Value) + }, + }, + { + name: "link-board-underscore-not-found", + text: `x +layers: { + x: { + yo + layers: { + x: { + hello.link: _._._ + } + } + } +}`, + expErr: `d2/testdata/d2compiler/TestCompile/link-board-underscore-not-found.d2:7:9: invalid underscore usage`, + }, } for _, tc := range testCases { diff --git a/d2graph/d2graph.go b/d2graph/d2graph.go index 22a6d935b5..83f6faa6d3 100644 --- a/d2graph/d2graph.go +++ b/d2graph/d2graph.go @@ -28,7 +28,8 @@ const DEFAULT_SHAPE_SIZE = 100. const MIN_SHAPE_SIZE = 5 type Graph struct { - Name string `json:"name"` + Parent *Graph `json:"-"` + Name string `json:"name"` // IsFolderOnly indicates a board or scenario itself makes no modifications from its // base. Folder only boards do not have a render and are used purely for organizing // the board tree. @@ -55,6 +56,13 @@ func NewGraph() *Graph { return d } +func (g *Graph) RootBoard() *Graph { + for g.Parent != nil { + g = g.Parent + } + return g +} + // TODO consider having different Scalar types // Right now we'll hold any types in Value and just convert, e.g. floats type Scalar struct { diff --git a/d2ir/compile.go b/d2ir/compile.go index 167fd09721..41e54dadc1 100644 --- a/d2ir/compile.go +++ b/d2ir/compile.go @@ -2,6 +2,7 @@ package d2ir import ( "oss.terrastruct.com/d2/d2ast" + "oss.terrastruct.com/d2/d2format" "oss.terrastruct.com/d2/d2parser" ) @@ -127,6 +128,10 @@ func (c *compiler) compileField(dst *Map, kp *d2ast.KeyPath, refctx *RefContext) } c.compileMap(f.Map(), refctx.Key.Value.Map) } else if refctx.Key.Value.ScalarBox().Unbox() != nil { + // If the link is a board, we need to transform it into an absolute path. + if f.Name == "link" { + c.compileLink(refctx) + } f.Primary_ = &Scalar{ parent: f, Value: refctx.Key.Value.ScalarBox().Unbox(), @@ -134,6 +139,68 @@ func (c *compiler) compileField(dst *Map, kp *d2ast.KeyPath, refctx *RefContext) } } +func (c *compiler) compileLink(refctx *RefContext) { + val := refctx.Key.Value.ScalarBox().Unbox().ScalarString() + link, err := d2parser.ParseKey(val) + if err != nil { + return + } + + scopeIDA := IDA(refctx.ScopeMap) + + if len(scopeIDA) == 0 { + return + } + + linkIDA := link.IDA() + if len(linkIDA) == 0 { + return + } + + if linkIDA[0] == "root" { + c.errorf(refctx.Key.Key, "cannot refer to root in link") + return + } + + // If it doesn't start with one of these reserved words, the link is definitely not a board link. + if linkIDA[0] != "layers" && linkIDA[0] != "scenarios" && linkIDA[0] != "steps" && linkIDA[0] != "_" { + return + } + + // Chop off the non-board portion of the scope, like if this is being defined on a nested object (e.g. `x.y.z`) + for i := len(scopeIDA) - 1; i > 0; i-- { + if scopeIDA[i-1] == "layers" || scopeIDA[i-1] == "scenarios" || scopeIDA[i-1] == "steps" { + scopeIDA = scopeIDA[:i+1] + break + } + if scopeIDA[i-1] == "root" { + scopeIDA = scopeIDA[:i] + break + } + } + + // Resolve underscores + for len(linkIDA) > 0 && linkIDA[0] == "_" { + if len(scopeIDA) < 2 { + // IR compiler only validates bad underscore usage + // The compiler will validate if the target board actually exists + c.errorf(refctx.Key.Key, "invalid underscore usage") + return + } + // pop 2 off path per one underscore + scopeIDA = scopeIDA[:len(scopeIDA)-2] + linkIDA = linkIDA[1:] + } + if len(scopeIDA) == 0 { + scopeIDA = []string{"root"} + } + + // Create the absolute path by appending scope path with value specified + scopeIDA = append(scopeIDA, linkIDA...) + kp := d2ast.MakeKeyPath(scopeIDA) + refctx.Key.Value = d2ast.MakeValueBox(d2ast.RawString(d2format.Format(kp), true)) +} + func (c *compiler) compileEdges(refctx *RefContext) { if refctx.Key.Key != nil { f, err := refctx.ScopeMap.EnsureField(refctx.Key.Key, refctx) diff --git a/d2ir/d2ir.go b/d2ir/d2ir.go index 72deedb38e..8a687bbdf1 100644 --- a/d2ir/d2ir.go +++ b/d2ir/d2ir.go @@ -158,7 +158,7 @@ type Map struct { func (m *Map) initRoot() { m.parent = &Field{ - Name: "", + Name: "root", References: []*FieldReference{{ Context: &RefContext{ ScopeMap: m, @@ -1033,8 +1033,8 @@ func parentPrimaryKey(n Node) *d2ast.Key { return nil } -// IDA returns the absolute path to n from the nearest board root. -func IDA(n Node) (ida []string) { +// BoardIDA returns the absolute path to n from the nearest board root. +func BoardIDA(n Node) (ida []string) { for { f, ok := n.(*Field) if ok { @@ -1053,6 +1053,26 @@ func IDA(n Node) (ida []string) { } } +// IDA returns the absolute path to n. +func IDA(n Node) (ida []string) { + for { + f, ok := n.(*Field) + if ok { + ida = append(ida, f.Name) + if f.Root() { + reverseIDA(ida) + return ida + } + } + f = ParentField(n) + if f == nil { + reverseIDA(ida) + return ida + } + n = f + } +} + func reverseIDA(ida []string) { for i := 0; i < len(ida)/2; i++ { tmp := ida[i] diff --git a/testdata/d2compiler/TestCompile/link-board-key-nested.exp.json b/testdata/d2compiler/TestCompile/link-board-key-nested.exp.json new file mode 100644 index 0000000000..ec7d650bc9 --- /dev/null +++ b/testdata/d2compiler/TestCompile/link-board-key-nested.exp.json @@ -0,0 +1,540 @@ +{ + "graph": { + "name": "", + "isFolderOnly": false, + "ast": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-key-nested.d2,0:0:0-7:1:55", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-key-nested.d2,0:0:0-2:1:25", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-key-nested.d2,0:0:0-0:1:1", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-key-nested.d2,0:0:0-0:1:1", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-key-nested.d2,0:3:3-2:0:24", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-key-nested.d2,1:2:7-1:18:23", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-key-nested.d2,1:2:7-1:8:13", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-key-nested.d2,1:2:7-1:3:8", + "value": [ + { + "string": "y", + "raw_string": "y" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-key-nested.d2,1:4:9-1:8:13", + "value": [ + { + "string": "link", + "raw_string": "link" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "double_quoted_string": { + "range": ",0:0:0-0:0:0", + "value": [ + { + "string": "root.layers.x" + } + ] + } + } + } + } + ] + } + } + } + }, + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-key-nested.d2,3:0:26-7:1:55", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-key-nested.d2,3:0:26-3:6:32", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-key-nested.d2,3:0:26-3:6:32", + "value": [ + { + "string": "layers", + "raw_string": "layers" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-key-nested.d2,3:8:34-7:0:54", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-key-nested.d2,4:2:38-6:3:53", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-key-nested.d2,4:2:38-4:3:39", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-key-nested.d2,4:2:38-4:3:39", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-key-nested.d2,4:5:41-6:2:52", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-key-nested.d2,5:4:47-5:6:49", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-key-nested.d2,5:4:47-5:6:49", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-key-nested.d2,5:4:47-5:6:49", + "value": [ + { + "string": "yo", + "raw_string": "yo" + } + ] + } + } + ] + }, + "primary": {}, + "value": {} + } + } + ] + } + } + } + } + ] + } + } + } + } + ] + }, + "root": { + "id": "", + "id_val": "", + "label_dimensions": { + "width": 0, + "height": 0 + }, + "attributes": { + "label": { + "value": "" + }, + "style": {}, + "near_key": null, + "shape": { + "value": "" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + }, + "edges": null, + "objects": [ + { + "id": "x", + "id_val": "x", + "label_dimensions": { + "width": 0, + "height": 0 + }, + "references": [ + { + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-key-nested.d2,0:0:0-0:1:1", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-key-nested.d2,0:0:0-0:1:1", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + } + ], + "attributes": { + "label": { + "value": "x" + }, + "style": {}, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + }, + { + "id": "y", + "id_val": "y", + "label_dimensions": { + "width": 0, + "height": 0 + }, + "references": [ + { + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-key-nested.d2,1:2:7-1:8:13", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-key-nested.d2,1:2:7-1:3:8", + "value": [ + { + "string": "y", + "raw_string": "y" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-key-nested.d2,1:4:9-1:8:13", + "value": [ + { + "string": "link", + "raw_string": "link" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + } + ], + "attributes": { + "label": { + "value": "y" + }, + "style": {}, + "link": { + "value": "root.layers.x" + }, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + } + ], + "layers": [ + { + "name": "x", + "isFolderOnly": false, + "ast": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-key-nested.d2,0:0:0-7:1:55", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-key-nested.d2,0:0:0-2:1:25", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-key-nested.d2,0:0:0-0:1:1", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-key-nested.d2,0:0:0-0:1:1", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-key-nested.d2,0:3:3-2:0:24", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-key-nested.d2,1:2:7-1:18:23", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-key-nested.d2,1:2:7-1:8:13", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-key-nested.d2,1:2:7-1:3:8", + "value": [ + { + "string": "y", + "raw_string": "y" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-key-nested.d2,1:4:9-1:8:13", + "value": [ + { + "string": "link", + "raw_string": "link" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "double_quoted_string": { + "range": ",0:0:0-0:0:0", + "value": [ + { + "string": "root.layers.x" + } + ] + } + } + } + } + ] + } + } + } + }, + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-key-nested.d2,3:0:26-7:1:55", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-key-nested.d2,3:0:26-3:6:32", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-key-nested.d2,3:0:26-3:6:32", + "value": [ + { + "string": "layers", + "raw_string": "layers" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-key-nested.d2,3:8:34-7:0:54", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-key-nested.d2,4:2:38-6:3:53", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-key-nested.d2,4:2:38-4:3:39", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-key-nested.d2,4:2:38-4:3:39", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-key-nested.d2,4:5:41-6:2:52", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-key-nested.d2,5:4:47-5:6:49", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-key-nested.d2,5:4:47-5:6:49", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-key-nested.d2,5:4:47-5:6:49", + "value": [ + { + "string": "yo", + "raw_string": "yo" + } + ] + } + } + ] + }, + "primary": {}, + "value": {} + } + } + ] + } + } + } + } + ] + } + } + } + } + ] + }, + "root": { + "id": "", + "id_val": "", + "label_dimensions": { + "width": 0, + "height": 0 + }, + "attributes": { + "label": { + "value": "" + }, + "style": {}, + "near_key": null, + "shape": { + "value": "" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + }, + "edges": null, + "objects": [ + { + "id": "yo", + "id_val": "yo", + "label_dimensions": { + "width": 0, + "height": 0 + }, + "references": [ + { + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-key-nested.d2,5:4:47-5:6:49", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-key-nested.d2,5:4:47-5:6:49", + "value": [ + { + "string": "yo", + "raw_string": "yo" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + } + ], + "attributes": { + "label": { + "value": "yo" + }, + "style": {}, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + } + ] + } + ] + }, + "err": null +} diff --git a/testdata/d2compiler/TestCompile/link-board-mixed.exp.json b/testdata/d2compiler/TestCompile/link-board-mixed.exp.json new file mode 100644 index 0000000000..4197bc41e1 --- /dev/null +++ b/testdata/d2compiler/TestCompile/link-board-mixed.exp.json @@ -0,0 +1,1364 @@ +{ + "graph": { + "name": "", + "isFolderOnly": false, + "ast": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,0:0:0-13:1:175", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,0:0:0-0:30:30", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,0:0:0-0:8:8", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,0:0:0-0:8:8", + "value": [ + { + "string": "question", + "raw_string": "question" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,0:10:10-0:30:30", + "value": [ + { + "string": "How does the cat go?", + "raw_string": "How does the cat go?" + } + ] + } + } + } + }, + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,1:0:31-1:25:56", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,1:0:31-1:13:44", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,1:0:31-1:8:39", + "value": [ + { + "string": "question", + "raw_string": "question" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,1:9:40-1:13:44", + "value": [ + { + "string": "link", + "raw_string": "link" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "double_quoted_string": { + "range": ",0:0:0-0:0:0", + "value": [ + { + "string": "root.layers.cat" + } + ] + } + } + } + }, + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,3:0:58-7:1:113", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,3:0:58-3:6:64", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,3:0:58-3:6:64", + "value": [ + { + "string": "layers", + "raw_string": "layers" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,3:8:66-7:0:112", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,4:2:70-6:3:111", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,4:2:70-4:5:73", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,4:2:70-4:5:73", + "value": [ + { + "string": "cat", + "raw_string": "cat" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,4:7:75-6:2:110", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,5:4:81-5:30:107", + "edges": [ + { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,5:4:81-5:24:101", + "src": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,5:4:81-5:12:89", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,5:4:81-5:11:88", + "value": [ + { + "string": "the cat", + "raw_string": "the cat" + } + ] + } + } + ] + }, + "src_arrow": "", + "dst": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,5:14:91-5:24:101", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,5:15:92-5:24:101", + "value": [ + { + "string": "meeeowwww", + "raw_string": "meeeowwww" + } + ] + } + } + ] + }, + "dst_arrow": ">" + } + ], + "primary": {}, + "value": { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,5:26:103-5:30:107", + "value": [ + { + "string": "goes", + "raw_string": "goes" + } + ] + } + } + } + } + ] + } + } + } + } + ] + } + } + } + }, + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,9:0:115-13:1:175", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,9:0:115-9:9:124", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,9:0:115-9:9:124", + "value": [ + { + "string": "scenarios", + "raw_string": "scenarios" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,9:11:126-13:0:174", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,10:2:130-12:3:173", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,10:2:130-10:7:135", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,10:2:130-10:7:135", + "value": [ + { + "string": "green", + "raw_string": "green" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,10:9:137-12:2:172", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,11:4:143-11:30:169", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,11:4:143-11:23:162", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,11:4:143-11:12:151", + "value": [ + { + "string": "question", + "raw_string": "question" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,11:13:152-11:18:157", + "value": [ + { + "string": "style", + "raw_string": "style" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,11:19:158-11:23:162", + "value": [ + { + "string": "fill", + "raw_string": "fill" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,11:25:164-11:30:169", + "value": [ + { + "string": "green", + "raw_string": "green" + } + ] + } + } + } + } + ] + } + } + } + } + ] + } + } + } + } + ] + }, + "root": { + "id": "", + "id_val": "", + "label_dimensions": { + "width": 0, + "height": 0 + }, + "attributes": { + "label": { + "value": "" + }, + "style": {}, + "near_key": null, + "shape": { + "value": "" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + }, + "edges": null, + "objects": [ + { + "id": "question", + "id_val": "question", + "label_dimensions": { + "width": 0, + "height": 0 + }, + "references": [ + { + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,0:0:0-0:8:8", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,0:0:0-0:8:8", + "value": [ + { + "string": "question", + "raw_string": "question" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + }, + { + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,1:0:31-1:13:44", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,1:0:31-1:8:39", + "value": [ + { + "string": "question", + "raw_string": "question" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,1:9:40-1:13:44", + "value": [ + { + "string": "link", + "raw_string": "link" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + } + ], + "attributes": { + "label": { + "value": "How does the cat go?" + }, + "style": {}, + "link": { + "value": "root.layers.cat" + }, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + } + ], + "layers": [ + { + "name": "cat", + "isFolderOnly": false, + "ast": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,0:0:0-13:1:175", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,0:0:0-0:30:30", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,0:0:0-0:8:8", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,0:0:0-0:8:8", + "value": [ + { + "string": "question", + "raw_string": "question" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,0:10:10-0:30:30", + "value": [ + { + "string": "How does the cat go?", + "raw_string": "How does the cat go?" + } + ] + } + } + } + }, + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,1:0:31-1:25:56", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,1:0:31-1:13:44", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,1:0:31-1:8:39", + "value": [ + { + "string": "question", + "raw_string": "question" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,1:9:40-1:13:44", + "value": [ + { + "string": "link", + "raw_string": "link" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "double_quoted_string": { + "range": ",0:0:0-0:0:0", + "value": [ + { + "string": "root.layers.cat" + } + ] + } + } + } + }, + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,3:0:58-7:1:113", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,3:0:58-3:6:64", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,3:0:58-3:6:64", + "value": [ + { + "string": "layers", + "raw_string": "layers" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,3:8:66-7:0:112", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,4:2:70-6:3:111", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,4:2:70-4:5:73", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,4:2:70-4:5:73", + "value": [ + { + "string": "cat", + "raw_string": "cat" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,4:7:75-6:2:110", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,5:4:81-5:30:107", + "edges": [ + { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,5:4:81-5:24:101", + "src": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,5:4:81-5:12:89", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,5:4:81-5:11:88", + "value": [ + { + "string": "the cat", + "raw_string": "the cat" + } + ] + } + } + ] + }, + "src_arrow": "", + "dst": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,5:14:91-5:24:101", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,5:15:92-5:24:101", + "value": [ + { + "string": "meeeowwww", + "raw_string": "meeeowwww" + } + ] + } + } + ] + }, + "dst_arrow": ">" + } + ], + "primary": {}, + "value": { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,5:26:103-5:30:107", + "value": [ + { + "string": "goes", + "raw_string": "goes" + } + ] + } + } + } + } + ] + } + } + } + } + ] + } + } + } + }, + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,9:0:115-13:1:175", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,9:0:115-9:9:124", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,9:0:115-9:9:124", + "value": [ + { + "string": "scenarios", + "raw_string": "scenarios" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,9:11:126-13:0:174", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,10:2:130-12:3:173", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,10:2:130-10:7:135", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,10:2:130-10:7:135", + "value": [ + { + "string": "green", + "raw_string": "green" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,10:9:137-12:2:172", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,11:4:143-11:30:169", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,11:4:143-11:23:162", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,11:4:143-11:12:151", + "value": [ + { + "string": "question", + "raw_string": "question" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,11:13:152-11:18:157", + "value": [ + { + "string": "style", + "raw_string": "style" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,11:19:158-11:23:162", + "value": [ + { + "string": "fill", + "raw_string": "fill" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,11:25:164-11:30:169", + "value": [ + { + "string": "green", + "raw_string": "green" + } + ] + } + } + } + } + ] + } + } + } + } + ] + } + } + } + } + ] + }, + "root": { + "id": "", + "id_val": "", + "label_dimensions": { + "width": 0, + "height": 0 + }, + "attributes": { + "label": { + "value": "" + }, + "style": {}, + "near_key": null, + "shape": { + "value": "" + }, + "direction": { + "value": "" + }, + "constraint": { + "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": "goes" + }, + "style": {}, + "near_key": null, + "shape": { + "value": "" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + } + ], + "objects": [ + { + "id": "the cat", + "id_val": "the cat", + "label_dimensions": { + "width": 0, + "height": 0 + }, + "references": [ + { + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,5:4:81-5:12:89", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,5:4:81-5:11:88", + "value": [ + { + "string": "the cat", + "raw_string": "the cat" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": 0 + } + ], + "attributes": { + "label": { + "value": "the cat" + }, + "style": {}, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + }, + { + "id": "meeeowwww", + "id_val": "meeeowwww", + "label_dimensions": { + "width": 0, + "height": 0 + }, + "references": [ + { + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,5:14:91-5:24:101", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,5:15:92-5:24:101", + "value": [ + { + "string": "meeeowwww", + "raw_string": "meeeowwww" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": 0 + } + ], + "attributes": { + "label": { + "value": "meeeowwww" + }, + "style": {}, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + } + ] + } + ], + "scenarios": [ + { + "name": "green", + "isFolderOnly": false, + "ast": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,0:0:0-13:1:175", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,0:0:0-0:30:30", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,0:0:0-0:8:8", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,0:0:0-0:8:8", + "value": [ + { + "string": "question", + "raw_string": "question" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,0:10:10-0:30:30", + "value": [ + { + "string": "How does the cat go?", + "raw_string": "How does the cat go?" + } + ] + } + } + } + }, + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,1:0:31-1:25:56", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,1:0:31-1:13:44", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,1:0:31-1:8:39", + "value": [ + { + "string": "question", + "raw_string": "question" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,1:9:40-1:13:44", + "value": [ + { + "string": "link", + "raw_string": "link" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "double_quoted_string": { + "range": ",0:0:0-0:0:0", + "value": [ + { + "string": "root.layers.cat" + } + ] + } + } + } + }, + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,3:0:58-7:1:113", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,3:0:58-3:6:64", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,3:0:58-3:6:64", + "value": [ + { + "string": "layers", + "raw_string": "layers" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,3:8:66-7:0:112", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,4:2:70-6:3:111", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,4:2:70-4:5:73", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,4:2:70-4:5:73", + "value": [ + { + "string": "cat", + "raw_string": "cat" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,4:7:75-6:2:110", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,5:4:81-5:30:107", + "edges": [ + { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,5:4:81-5:24:101", + "src": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,5:4:81-5:12:89", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,5:4:81-5:11:88", + "value": [ + { + "string": "the cat", + "raw_string": "the cat" + } + ] + } + } + ] + }, + "src_arrow": "", + "dst": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,5:14:91-5:24:101", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,5:15:92-5:24:101", + "value": [ + { + "string": "meeeowwww", + "raw_string": "meeeowwww" + } + ] + } + } + ] + }, + "dst_arrow": ">" + } + ], + "primary": {}, + "value": { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,5:26:103-5:30:107", + "value": [ + { + "string": "goes", + "raw_string": "goes" + } + ] + } + } + } + } + ] + } + } + } + } + ] + } + } + } + }, + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,9:0:115-13:1:175", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,9:0:115-9:9:124", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,9:0:115-9:9:124", + "value": [ + { + "string": "scenarios", + "raw_string": "scenarios" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,9:11:126-13:0:174", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,10:2:130-12:3:173", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,10:2:130-10:7:135", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,10:2:130-10:7:135", + "value": [ + { + "string": "green", + "raw_string": "green" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,10:9:137-12:2:172", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,11:4:143-11:30:169", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,11:4:143-11:23:162", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,11:4:143-11:12:151", + "value": [ + { + "string": "question", + "raw_string": "question" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,11:13:152-11:18:157", + "value": [ + { + "string": "style", + "raw_string": "style" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,11:19:158-11:23:162", + "value": [ + { + "string": "fill", + "raw_string": "fill" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,11:25:164-11:30:169", + "value": [ + { + "string": "green", + "raw_string": "green" + } + ] + } + } + } + } + ] + } + } + } + } + ] + } + } + } + } + ] + }, + "root": { + "id": "", + "id_val": "", + "label_dimensions": { + "width": 0, + "height": 0 + }, + "attributes": { + "label": { + "value": "" + }, + "style": {}, + "near_key": null, + "shape": { + "value": "" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + }, + "edges": null, + "objects": [ + { + "id": "question", + "id_val": "question", + "label_dimensions": { + "width": 0, + "height": 0 + }, + "references": [ + { + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,0:0:0-0:8:8", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,0:0:0-0:8:8", + "value": [ + { + "string": "question", + "raw_string": "question" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + }, + { + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,1:0:31-1:13:44", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,1:0:31-1:8:39", + "value": [ + { + "string": "question", + "raw_string": "question" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,1:9:40-1:13:44", + "value": [ + { + "string": "link", + "raw_string": "link" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + }, + { + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,11:4:143-11:23:162", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,11:4:143-11:12:151", + "value": [ + { + "string": "question", + "raw_string": "question" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,11:13:152-11:18:157", + "value": [ + { + "string": "style", + "raw_string": "style" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,11:19:158-11:23:162", + "value": [ + { + "string": "fill", + "raw_string": "fill" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + } + ], + "attributes": { + "label": { + "value": "How does the cat go?" + }, + "style": { + "fill": { + "value": "green" + } + }, + "link": { + "value": "root.layers.cat" + }, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + } + ] + } + ] + }, + "err": null +} diff --git a/testdata/d2compiler/TestCompile/link-board-nested.exp.json b/testdata/d2compiler/TestCompile/link-board-nested.exp.json new file mode 100644 index 0000000000..60d481fa69 --- /dev/null +++ b/testdata/d2compiler/TestCompile/link-board-nested.exp.json @@ -0,0 +1,771 @@ +{ + "graph": { + "name": "", + "isFolderOnly": false, + "ast": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,0:0:0-9:1:101", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,0:0:0-0:25:25", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,0:0:0-0:6:6", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,0:0:0-0:1:1", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,0:2:2-0:6:6", + "value": [ + { + "string": "link", + "raw_string": "link" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "double_quoted_string": { + "range": ",0:0:0-0:0:0", + "value": [ + { + "string": "root.layers.x.layers.x" + } + ] + } + } + } + }, + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,1:0:26-9:1:101", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,1:0:26-1:6:32", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,1:0:26-1:6:32", + "value": [ + { + "string": "layers", + "raw_string": "layers" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,1:8:34-9:0:100", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,2:2:38-8:3:99", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,2:2:38-2:3:39", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,2:2:38-2:3:39", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,2:5:41-8:2:98", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,3:4:47-7:5:95", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,3:4:47-3:10:53", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,3:4:47-3:10:53", + "value": [ + { + "string": "layers", + "raw_string": "layers" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,3:12:55-7:4:94", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,4:6:63-6:7:89", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,4:6:63-4:7:64", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,4:6:63-4:7:64", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,4:9:66-6:6:88", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,5:8:76-5:13:81", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,5:8:76-5:13:81", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,5:8:76-5:13:81", + "value": [ + { + "string": "hello", + "raw_string": "hello" + } + ] + } + } + ] + }, + "primary": {}, + "value": {} + } + } + ] + } + } + } + } + ] + } + } + } + } + ] + } + } + } + } + ] + } + } + } + } + ] + }, + "root": { + "id": "", + "id_val": "", + "label_dimensions": { + "width": 0, + "height": 0 + }, + "attributes": { + "label": { + "value": "" + }, + "style": {}, + "near_key": null, + "shape": { + "value": "" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + }, + "edges": null, + "objects": [ + { + "id": "x", + "id_val": "x", + "label_dimensions": { + "width": 0, + "height": 0 + }, + "references": [ + { + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,0:0:0-0:6:6", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,0:0:0-0:1:1", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,0:2:2-0:6:6", + "value": [ + { + "string": "link", + "raw_string": "link" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + } + ], + "attributes": { + "label": { + "value": "x" + }, + "style": {}, + "link": { + "value": "root.layers.x.layers.x" + }, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + } + ], + "layers": [ + { + "name": "x", + "isFolderOnly": true, + "ast": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,0:0:0-9:1:101", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,0:0:0-0:25:25", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,0:0:0-0:6:6", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,0:0:0-0:1:1", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,0:2:2-0:6:6", + "value": [ + { + "string": "link", + "raw_string": "link" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "double_quoted_string": { + "range": ",0:0:0-0:0:0", + "value": [ + { + "string": "root.layers.x.layers.x" + } + ] + } + } + } + }, + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,1:0:26-9:1:101", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,1:0:26-1:6:32", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,1:0:26-1:6:32", + "value": [ + { + "string": "layers", + "raw_string": "layers" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,1:8:34-9:0:100", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,2:2:38-8:3:99", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,2:2:38-2:3:39", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,2:2:38-2:3:39", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,2:5:41-8:2:98", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,3:4:47-7:5:95", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,3:4:47-3:10:53", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,3:4:47-3:10:53", + "value": [ + { + "string": "layers", + "raw_string": "layers" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,3:12:55-7:4:94", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,4:6:63-6:7:89", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,4:6:63-4:7:64", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,4:6:63-4:7:64", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,4:9:66-6:6:88", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,5:8:76-5:13:81", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,5:8:76-5:13:81", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,5:8:76-5:13:81", + "value": [ + { + "string": "hello", + "raw_string": "hello" + } + ] + } + } + ] + }, + "primary": {}, + "value": {} + } + } + ] + } + } + } + } + ] + } + } + } + } + ] + } + } + } + } + ] + } + } + } + } + ] + }, + "root": { + "id": "", + "id_val": "", + "label_dimensions": { + "width": 0, + "height": 0 + }, + "attributes": { + "label": { + "value": "" + }, + "style": {}, + "near_key": null, + "shape": { + "value": "" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + }, + "edges": null, + "objects": null, + "layers": [ + { + "name": "x", + "isFolderOnly": false, + "ast": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,0:0:0-9:1:101", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,0:0:0-0:25:25", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,0:0:0-0:6:6", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,0:0:0-0:1:1", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,0:2:2-0:6:6", + "value": [ + { + "string": "link", + "raw_string": "link" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "double_quoted_string": { + "range": ",0:0:0-0:0:0", + "value": [ + { + "string": "root.layers.x.layers.x" + } + ] + } + } + } + }, + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,1:0:26-9:1:101", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,1:0:26-1:6:32", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,1:0:26-1:6:32", + "value": [ + { + "string": "layers", + "raw_string": "layers" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,1:8:34-9:0:100", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,2:2:38-8:3:99", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,2:2:38-2:3:39", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,2:2:38-2:3:39", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,2:5:41-8:2:98", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,3:4:47-7:5:95", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,3:4:47-3:10:53", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,3:4:47-3:10:53", + "value": [ + { + "string": "layers", + "raw_string": "layers" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,3:12:55-7:4:94", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,4:6:63-6:7:89", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,4:6:63-4:7:64", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,4:6:63-4:7:64", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,4:9:66-6:6:88", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,5:8:76-5:13:81", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,5:8:76-5:13:81", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,5:8:76-5:13:81", + "value": [ + { + "string": "hello", + "raw_string": "hello" + } + ] + } + } + ] + }, + "primary": {}, + "value": {} + } + } + ] + } + } + } + } + ] + } + } + } + } + ] + } + } + } + } + ] + } + } + } + } + ] + }, + "root": { + "id": "", + "id_val": "", + "label_dimensions": { + "width": 0, + "height": 0 + }, + "attributes": { + "label": { + "value": "" + }, + "style": {}, + "near_key": null, + "shape": { + "value": "" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + }, + "edges": null, + "objects": [ + { + "id": "hello", + "id_val": "hello", + "label_dimensions": { + "width": 0, + "height": 0 + }, + "references": [ + { + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,5:8:76-5:13:81", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,5:8:76-5:13:81", + "value": [ + { + "string": "hello", + "raw_string": "hello" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + } + ], + "attributes": { + "label": { + "value": "hello" + }, + "style": {}, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + } + ] + } + ] + } + ] + }, + "err": null +} diff --git a/testdata/d2compiler/TestCompile/link-board-not-board.exp.json b/testdata/d2compiler/TestCompile/link-board-not-board.exp.json new file mode 100644 index 0000000000..d8f1db7646 --- /dev/null +++ b/testdata/d2compiler/TestCompile/link-board-not-board.exp.json @@ -0,0 +1,12 @@ +{ + "graph": null, + "err": { + "ioerr": null, + "errs": [ + { + "range": "d2/testdata/d2compiler/TestCompile/link-board-not-board.d2,1:0:4-1:18:22", + "errmsg": "d2/testdata/d2compiler/TestCompile/link-board-not-board.d2:2:1: linked board not found" + } + ] + } +} diff --git a/testdata/d2compiler/TestCompile/link-board-not-found.exp.json b/testdata/d2compiler/TestCompile/link-board-not-found.exp.json new file mode 100644 index 0000000000..29ff2fddef --- /dev/null +++ b/testdata/d2compiler/TestCompile/link-board-not-found.exp.json @@ -0,0 +1,12 @@ +{ + "graph": null, + "err": { + "ioerr": null, + "errs": [ + { + "range": "d2/testdata/d2compiler/TestCompile/link-board-not-found.d2,0:0:0-0:16:16", + "errmsg": "d2/testdata/d2compiler/TestCompile/link-board-not-found.d2:1:1: linked board not found" + } + ] + } +} diff --git a/testdata/d2compiler/TestCompile/link-board-ok.exp.json b/testdata/d2compiler/TestCompile/link-board-ok.exp.json new file mode 100644 index 0000000000..61cf43cd74 --- /dev/null +++ b/testdata/d2compiler/TestCompile/link-board-ok.exp.json @@ -0,0 +1,435 @@ +{ + "graph": { + "name": "", + "isFolderOnly": false, + "ast": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-ok.d2,0:0:0-5:1:42", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-ok.d2,0:0:0-0:16:16", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-ok.d2,0:0:0-0:6:6", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-ok.d2,0:0:0-0:1:1", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-ok.d2,0:2:2-0:6:6", + "value": [ + { + "string": "link", + "raw_string": "link" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "double_quoted_string": { + "range": ",0:0:0-0:0:0", + "value": [ + { + "string": "root.layers.x" + } + ] + } + } + } + }, + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-ok.d2,1:0:17-5:1:42", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-ok.d2,1:0:17-1:6:23", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-ok.d2,1:0:17-1:6:23", + "value": [ + { + "string": "layers", + "raw_string": "layers" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-ok.d2,1:8:25-5:0:41", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-ok.d2,2:1:28-4:2:40", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-ok.d2,2:1:28-2:2:29", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-ok.d2,2:1:28-2:2:29", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-ok.d2,2:4:31-4:1:39", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-ok.d2,3:3:36-3:4:37", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-ok.d2,3:3:36-3:4:37", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-ok.d2,3:3:36-3:4:37", + "value": [ + { + "string": "y", + "raw_string": "y" + } + ] + } + } + ] + }, + "primary": {}, + "value": {} + } + } + ] + } + } + } + } + ] + } + } + } + } + ] + }, + "root": { + "id": "", + "id_val": "", + "label_dimensions": { + "width": 0, + "height": 0 + }, + "attributes": { + "label": { + "value": "" + }, + "style": {}, + "near_key": null, + "shape": { + "value": "" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + }, + "edges": null, + "objects": [ + { + "id": "x", + "id_val": "x", + "label_dimensions": { + "width": 0, + "height": 0 + }, + "references": [ + { + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-ok.d2,0:0:0-0:6:6", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-ok.d2,0:0:0-0:1:1", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-ok.d2,0:2:2-0:6:6", + "value": [ + { + "string": "link", + "raw_string": "link" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + } + ], + "attributes": { + "label": { + "value": "x" + }, + "style": {}, + "link": { + "value": "root.layers.x" + }, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + } + ], + "layers": [ + { + "name": "x", + "isFolderOnly": false, + "ast": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-ok.d2,0:0:0-5:1:42", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-ok.d2,0:0:0-0:16:16", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-ok.d2,0:0:0-0:6:6", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-ok.d2,0:0:0-0:1:1", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-ok.d2,0:2:2-0:6:6", + "value": [ + { + "string": "link", + "raw_string": "link" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "double_quoted_string": { + "range": ",0:0:0-0:0:0", + "value": [ + { + "string": "root.layers.x" + } + ] + } + } + } + }, + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-ok.d2,1:0:17-5:1:42", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-ok.d2,1:0:17-1:6:23", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-ok.d2,1:0:17-1:6:23", + "value": [ + { + "string": "layers", + "raw_string": "layers" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-ok.d2,1:8:25-5:0:41", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-ok.d2,2:1:28-4:2:40", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-ok.d2,2:1:28-2:2:29", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-ok.d2,2:1:28-2:2:29", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-ok.d2,2:4:31-4:1:39", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-ok.d2,3:3:36-3:4:37", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-ok.d2,3:3:36-3:4:37", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-ok.d2,3:3:36-3:4:37", + "value": [ + { + "string": "y", + "raw_string": "y" + } + ] + } + } + ] + }, + "primary": {}, + "value": {} + } + } + ] + } + } + } + } + ] + } + } + } + } + ] + }, + "root": { + "id": "", + "id_val": "", + "label_dimensions": { + "width": 0, + "height": 0 + }, + "attributes": { + "label": { + "value": "" + }, + "style": {}, + "near_key": null, + "shape": { + "value": "" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + }, + "edges": null, + "objects": [ + { + "id": "y", + "id_val": "y", + "label_dimensions": { + "width": 0, + "height": 0 + }, + "references": [ + { + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-ok.d2,3:3:36-3:4:37", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-ok.d2,3:3:36-3:4:37", + "value": [ + { + "string": "y", + "raw_string": "y" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + } + ], + "attributes": { + "label": { + "value": "y" + }, + "style": {}, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + } + ] + } + ] + }, + "err": null +} diff --git a/testdata/d2compiler/TestCompile/link-board-underscore-not-found.exp.json b/testdata/d2compiler/TestCompile/link-board-underscore-not-found.exp.json new file mode 100644 index 0000000000..c5d2aaac60 --- /dev/null +++ b/testdata/d2compiler/TestCompile/link-board-underscore-not-found.exp.json @@ -0,0 +1,12 @@ +{ + "graph": null, + "err": { + "ioerr": null, + "errs": [ + { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore-not-found.d2,6:8:59-6:18:69", + "errmsg": "d2/testdata/d2compiler/TestCompile/link-board-underscore-not-found.d2:7:9: invalid underscore usage" + } + ] + } +} diff --git a/testdata/d2compiler/TestCompile/link-board-underscore.exp.json b/testdata/d2compiler/TestCompile/link-board-underscore.exp.json new file mode 100644 index 0000000000..2fcd031153 --- /dev/null +++ b/testdata/d2compiler/TestCompile/link-board-underscore.exp.json @@ -0,0 +1,1078 @@ +{ + "graph": { + "name": "", + "isFolderOnly": false, + "ast": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,0:0:0-11:1:121", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,0:0:0-0:1:1", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,0:0:0-0:1:1", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,0:0:0-0:1:1", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "primary": {}, + "value": {} + } + }, + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,1:0:2-11:1:121", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,1:0:2-1:6:8", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,1:0:2-1:6:8", + "value": [ + { + "string": "layers", + "raw_string": "layers" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,1:8:10-11:0:120", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,2:1:13-10:3:119", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,2:1:13-2:2:14", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,2:1:13-2:2:14", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,2:4:16-10:2:118", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,3:3:21-3:5:23", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,3:3:21-3:5:23", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,3:3:21-3:5:23", + "value": [ + { + "string": "yo", + "raw_string": "yo" + } + ] + } + } + ] + }, + "primary": {}, + "value": {} + } + }, + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,4:4:28-9:5:115", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,4:4:28-4:10:34", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,4:4:28-4:10:34", + "value": [ + { + "string": "layers", + "raw_string": "layers" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,4:12:36-9:4:114", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,5:6:44-8:7:109", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,5:6:44-5:7:45", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,5:6:44-5:7:45", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,5:9:47-8:6:108", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,6:8:57-6:32:81", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,6:8:57-6:18:67", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,6:8:57-6:13:62", + "value": [ + { + "string": "hello", + "raw_string": "hello" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,6:14:63-6:18:67", + "value": [ + { + "string": "link", + "raw_string": "link" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "double_quoted_string": { + "range": ",0:0:0-0:0:0", + "value": [ + { + "string": "root.layers.x" + } + ] + } + } + } + }, + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,7:8:90-7:19:101", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,7:8:90-7:16:98", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,7:8:90-7:11:93", + "value": [ + { + "string": "hey", + "raw_string": "hey" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,7:12:94-7:16:98", + "value": [ + { + "string": "link", + "raw_string": "link" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "double_quoted_string": { + "range": ",0:0:0-0:0:0", + "value": [ + { + "string": "root.layers.x" + } + ] + } + } + } + } + ] + } + } + } + } + ] + } + } + } + } + ] + } + } + } + } + ] + } + } + } + } + ] + }, + "root": { + "id": "", + "id_val": "", + "label_dimensions": { + "width": 0, + "height": 0 + }, + "attributes": { + "label": { + "value": "" + }, + "style": {}, + "near_key": null, + "shape": { + "value": "" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + }, + "edges": null, + "objects": [ + { + "id": "x", + "id_val": "x", + "label_dimensions": { + "width": 0, + "height": 0 + }, + "references": [ + { + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,0:0:0-0:1:1", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,0:0:0-0:1:1", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + } + ], + "attributes": { + "label": { + "value": "x" + }, + "style": {}, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + } + ], + "layers": [ + { + "name": "x", + "isFolderOnly": false, + "ast": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,0:0:0-11:1:121", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,0:0:0-0:1:1", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,0:0:0-0:1:1", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,0:0:0-0:1:1", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "primary": {}, + "value": {} + } + }, + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,1:0:2-11:1:121", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,1:0:2-1:6:8", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,1:0:2-1:6:8", + "value": [ + { + "string": "layers", + "raw_string": "layers" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,1:8:10-11:0:120", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,2:1:13-10:3:119", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,2:1:13-2:2:14", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,2:1:13-2:2:14", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,2:4:16-10:2:118", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,3:3:21-3:5:23", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,3:3:21-3:5:23", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,3:3:21-3:5:23", + "value": [ + { + "string": "yo", + "raw_string": "yo" + } + ] + } + } + ] + }, + "primary": {}, + "value": {} + } + }, + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,4:4:28-9:5:115", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,4:4:28-4:10:34", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,4:4:28-4:10:34", + "value": [ + { + "string": "layers", + "raw_string": "layers" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,4:12:36-9:4:114", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,5:6:44-8:7:109", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,5:6:44-5:7:45", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,5:6:44-5:7:45", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,5:9:47-8:6:108", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,6:8:57-6:32:81", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,6:8:57-6:18:67", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,6:8:57-6:13:62", + "value": [ + { + "string": "hello", + "raw_string": "hello" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,6:14:63-6:18:67", + "value": [ + { + "string": "link", + "raw_string": "link" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "double_quoted_string": { + "range": ",0:0:0-0:0:0", + "value": [ + { + "string": "root.layers.x" + } + ] + } + } + } + }, + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,7:8:90-7:19:101", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,7:8:90-7:16:98", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,7:8:90-7:11:93", + "value": [ + { + "string": "hey", + "raw_string": "hey" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,7:12:94-7:16:98", + "value": [ + { + "string": "link", + "raw_string": "link" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "double_quoted_string": { + "range": ",0:0:0-0:0:0", + "value": [ + { + "string": "root.layers.x" + } + ] + } + } + } + } + ] + } + } + } + } + ] + } + } + } + } + ] + } + } + } + } + ] + } + } + } + } + ] + }, + "root": { + "id": "", + "id_val": "", + "label_dimensions": { + "width": 0, + "height": 0 + }, + "attributes": { + "label": { + "value": "" + }, + "style": {}, + "near_key": null, + "shape": { + "value": "" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + }, + "edges": null, + "objects": [ + { + "id": "yo", + "id_val": "yo", + "label_dimensions": { + "width": 0, + "height": 0 + }, + "references": [ + { + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,3:3:21-3:5:23", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,3:3:21-3:5:23", + "value": [ + { + "string": "yo", + "raw_string": "yo" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + } + ], + "attributes": { + "label": { + "value": "yo" + }, + "style": {}, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + } + ], + "layers": [ + { + "name": "x", + "isFolderOnly": false, + "ast": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,0:0:0-11:1:121", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,0:0:0-0:1:1", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,0:0:0-0:1:1", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,0:0:0-0:1:1", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "primary": {}, + "value": {} + } + }, + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,1:0:2-11:1:121", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,1:0:2-1:6:8", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,1:0:2-1:6:8", + "value": [ + { + "string": "layers", + "raw_string": "layers" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,1:8:10-11:0:120", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,2:1:13-10:3:119", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,2:1:13-2:2:14", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,2:1:13-2:2:14", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,2:4:16-10:2:118", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,3:3:21-3:5:23", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,3:3:21-3:5:23", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,3:3:21-3:5:23", + "value": [ + { + "string": "yo", + "raw_string": "yo" + } + ] + } + } + ] + }, + "primary": {}, + "value": {} + } + }, + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,4:4:28-9:5:115", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,4:4:28-4:10:34", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,4:4:28-4:10:34", + "value": [ + { + "string": "layers", + "raw_string": "layers" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,4:12:36-9:4:114", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,5:6:44-8:7:109", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,5:6:44-5:7:45", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,5:6:44-5:7:45", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,5:9:47-8:6:108", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,6:8:57-6:32:81", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,6:8:57-6:18:67", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,6:8:57-6:13:62", + "value": [ + { + "string": "hello", + "raw_string": "hello" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,6:14:63-6:18:67", + "value": [ + { + "string": "link", + "raw_string": "link" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "double_quoted_string": { + "range": ",0:0:0-0:0:0", + "value": [ + { + "string": "root.layers.x" + } + ] + } + } + } + }, + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,7:8:90-7:19:101", + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,7:8:90-7:16:98", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,7:8:90-7:11:93", + "value": [ + { + "string": "hey", + "raw_string": "hey" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,7:12:94-7:16:98", + "value": [ + { + "string": "link", + "raw_string": "link" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "double_quoted_string": { + "range": ",0:0:0-0:0:0", + "value": [ + { + "string": "root.layers.x" + } + ] + } + } + } + } + ] + } + } + } + } + ] + } + } + } + } + ] + } + } + } + } + ] + } + } + } + } + ] + }, + "root": { + "id": "", + "id_val": "", + "label_dimensions": { + "width": 0, + "height": 0 + }, + "attributes": { + "label": { + "value": "" + }, + "style": {}, + "near_key": null, + "shape": { + "value": "" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + }, + "edges": null, + "objects": [ + { + "id": "hello", + "id_val": "hello", + "label_dimensions": { + "width": 0, + "height": 0 + }, + "references": [ + { + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,6:8:57-6:18:67", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,6:8:57-6:13:62", + "value": [ + { + "string": "hello", + "raw_string": "hello" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,6:14:63-6:18:67", + "value": [ + { + "string": "link", + "raw_string": "link" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + } + ], + "attributes": { + "label": { + "value": "hello" + }, + "style": {}, + "link": { + "value": "root.layers.x" + }, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + }, + { + "id": "hey", + "id_val": "hey", + "label_dimensions": { + "width": 0, + "height": 0 + }, + "references": [ + { + "key": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,7:8:90-7:16:98", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,7:8:90-7:11:93", + "value": [ + { + "string": "hey", + "raw_string": "hey" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,7:12:94-7:16:98", + "value": [ + { + "string": "link", + "raw_string": "link" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + } + ], + "attributes": { + "label": { + "value": "hey" + }, + "style": {}, + "link": { + "value": "root.layers.x" + }, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + } + ] + } + ] + } + ] + }, + "err": null +}