d2ir: IR Root wip

This commit is contained in:
Anmol Sethi 2023-01-18 03:51:16 -08:00
parent 6e04ebb304
commit 180334a8e1
No known key found for this signature in database
GPG key ID: 25BC68888A99A8BA
13 changed files with 2902 additions and 3618 deletions

View file

@ -14,21 +14,17 @@ func (c *compiler) errorf(n d2ast.Node, f string, v ...interface{}) {
} }
func Compile(ast *d2ast.Map) (*Map, error) { func Compile(ast *d2ast.Map) (*Map, error) {
l := &Layer{} m := &Map{}
l.Map = &Map{
parent: l,
}
c := &compiler{} c := &compiler{}
c.compile(l) c.compile(m, ast)
if !c.err.Empty() { if !c.err.Empty() {
return nil, c.err return nil, c.err
} }
return l, nil return m, nil
} }
func (c *compiler) compile(l *Layer) { func (c *compiler) compile(dst *Map, ast *d2ast.Map) {
c.compileMap(l.Map, l.AST) c.compileMap(dst, ast)
} }
func (c *compiler) compileMap(dst *Map, ast *d2ast.Map) { func (c *compiler) compileMap(dst *Map, ast *d2ast.Map) {

View file

@ -38,23 +38,23 @@ func runa(t *testing.T, tca []testCase) {
} }
} }
func compile(t testing.TB, text string) (*d2ir.Layer, error) { func compile(t testing.TB, text string) (*d2ir.Map, error) {
t.Helper() t.Helper()
d2Path := fmt.Sprintf("%v.d2", t.Name()) d2Path := fmt.Sprintf("%v.d2", t.Name())
ast, err := d2parser.Parse(d2Path, strings.NewReader(text), nil) ast, err := d2parser.Parse(d2Path, strings.NewReader(text), nil)
assert.Success(t, err) assert.Success(t, err)
l, err := d2ir.Compile(ast) m, err := d2ir.Compile(ast)
if err != nil { if err != nil {
return nil, err return nil, err
} }
err = diff.TestdataJSON(filepath.Join("..", "testdata", "d2ir", t.Name()), l) err = diff.TestdataJSON(filepath.Join("..", "testdata", "d2ir", t.Name()), m)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return l, nil return m, nil
} }
func assertField(t testing.TB, n d2ir.Node, nfields, nedges int, primary interface{}, ida ...string) *d2ir.Field { func assertField(t testing.TB, n d2ir.Node, nfields, nedges int, primary interface{}, ida ...string) *d2ir.Field {
@ -153,42 +153,42 @@ func testCompileFields(t *testing.T) {
{ {
name: "root", name: "root",
run: func(t testing.TB) { run: func(t testing.TB) {
l, err := compile(t, `x`) m, err := compile(t, `x`)
assert.Success(t, err) assert.Success(t, err)
assertField(t, l, 1, 0, nil) assertField(t, m, 1, 0, nil)
assertField(t, l, 0, 0, nil, "x") assertField(t, m, 0, 0, nil, "x")
}, },
}, },
{ {
name: "label", name: "label",
run: func(t testing.TB) { run: func(t testing.TB) {
l, err := compile(t, `x: yes`) m, err := compile(t, `x: yes`)
assert.Success(t, err) assert.Success(t, err)
assertField(t, l, 1, 0, nil) assertField(t, m, 1, 0, nil)
assertField(t, l, 0, 0, "yes", "x") assertField(t, m, 0, 0, "yes", "x")
}, },
}, },
{ {
name: "nested", name: "nested",
run: func(t testing.TB) { run: func(t testing.TB) {
l, err := compile(t, `x.y: yes`) m, err := compile(t, `x.y: yes`)
assert.Success(t, err) assert.Success(t, err)
assertField(t, l, 2, 0, nil) assertField(t, m, 2, 0, nil)
assertField(t, l, 1, 0, nil, "x") assertField(t, m, 1, 0, nil, "x")
assertField(t, l, 0, 0, "yes", "x", "y") assertField(t, m, 0, 0, "yes", "x", "y")
}, },
}, },
{ {
name: "array", name: "array",
run: func(t testing.TB) { run: func(t testing.TB) {
l, err := compile(t, `x: [1;2;3;4]`) m, err := compile(t, `x: [1;2;3;4]`)
assert.Success(t, err) assert.Success(t, err)
assertField(t, l, 1, 0, nil) assertField(t, m, 1, 0, nil)
f := assertField(t, l, 0, 0, nil, "x") f := assertField(t, m, 0, 0, nil, "x")
assert.String(t, `[1; 2; 3; 4]`, f.Composite.String()) assert.String(t, `[1; 2; 3; 4]`, f.Composite.String())
}, },
}, },
@ -202,24 +202,24 @@ func testCompileFieldPrimary(t *testing.T) {
{ {
name: "root", name: "root",
run: func(t testing.TB) { run: func(t testing.TB) {
l, err := compile(t, `x: yes { pqrs }`) m, err := compile(t, `x: yes { pqrs }`)
assert.Success(t, err) assert.Success(t, err)
assertField(t, l, 2, 0, nil) assertField(t, m, 2, 0, nil)
assertField(t, l, 1, 0, "yes", "x") assertField(t, m, 1, 0, "yes", "x")
assertField(t, l, 0, 0, nil, "x", "pqrs") assertField(t, m, 0, 0, nil, "x", "pqrs")
}, },
}, },
{ {
name: "nested", name: "nested",
run: func(t testing.TB) { run: func(t testing.TB) {
l, err := compile(t, `x.y: yes { pqrs }`) m, err := compile(t, `x.y: yes { pqrs }`)
assert.Success(t, err) assert.Success(t, err)
assertField(t, l, 3, 0, nil) assertField(t, m, 3, 0, nil)
assertField(t, l, 2, 0, nil, "x") assertField(t, m, 2, 0, nil, "x")
assertField(t, l, 1, 0, "yes", "x", "y") assertField(t, m, 1, 0, "yes", "x", "y")
assertField(t, l, 0, 0, nil, "x", "y", "pqrs") assertField(t, m, 0, 0, nil, "x", "y", "pqrs")
}, },
}, },
} }
@ -232,42 +232,42 @@ func testCompileEdges(t *testing.T) {
{ {
name: "root", name: "root",
run: func(t testing.TB) { run: func(t testing.TB) {
l, err := compile(t, `x -> y`) m, err := compile(t, `x -> y`)
assert.Success(t, err) assert.Success(t, err)
assertField(t, l, 2, 1, nil) assertField(t, m, 2, 1, nil)
assertEdge(t, l, 0, nil, `(x -> y)[0]`) assertEdge(t, m, 0, nil, `(x -> y)[0]`)
assertField(t, l, 0, 0, nil, "x") assertField(t, m, 0, 0, nil, "x")
assertField(t, l, 0, 0, nil, "y") assertField(t, m, 0, 0, nil, "y")
}, },
}, },
{ {
name: "nested", name: "nested",
run: func(t testing.TB) { run: func(t testing.TB) {
l, err := compile(t, `x.y -> z.p`) m, err := compile(t, `x.y -> z.p`)
assert.Success(t, err) assert.Success(t, err)
assertField(t, l, 4, 1, nil) assertField(t, m, 4, 1, nil)
assertField(t, l, 1, 0, nil, "x") assertField(t, m, 1, 0, nil, "x")
assertField(t, l, 0, 0, nil, "x", "y") assertField(t, m, 0, 0, nil, "x", "y")
assertField(t, l, 1, 0, nil, "z") assertField(t, m, 1, 0, nil, "z")
assertField(t, l, 0, 0, nil, "z", "p") assertField(t, m, 0, 0, nil, "z", "p")
assertEdge(t, l, 0, nil, "(x.y -> z.p)[0]") assertEdge(t, m, 0, nil, "(x.y -> z.p)[0]")
}, },
}, },
{ {
name: "underscore", name: "underscore",
run: func(t testing.TB) { run: func(t testing.TB) {
l, err := compile(t, `p: { _.x -> z }`) m, err := compile(t, `p: { _.x -> z }`)
assert.Success(t, err) assert.Success(t, err)
assertField(t, l, 3, 1, nil) assertField(t, m, 3, 1, nil)
assertField(t, l, 0, 0, nil, "x") assertField(t, m, 0, 0, nil, "x")
assertField(t, l, 1, 0, nil, "p") assertField(t, m, 1, 0, nil, "p")
assertEdge(t, l, 0, nil, "(x -> p.z)[0]") assertEdge(t, m, 0, nil, "(x -> p.z)[0]")
}, },
}, },
} }
@ -280,19 +280,19 @@ func testCompileLayers(t *testing.T) {
{ {
name: "root", name: "root",
run: func(t testing.TB) { run: func(t testing.TB) {
l, err := compile(t, `x -> y m, err := compile(t, `x -> y
layers: { layers: {
bingo: { p.q.z } bingo: { p.q.z }
}`) }`)
assert.Success(t, err) assert.Success(t, err)
assertField(t, l, 5, 1, nil) assertField(t, m, 7, 1, nil)
assertEdge(t, l, 0, nil, `(x -> y)[0]`) assertEdge(t, m, 0, nil, `(x -> y)[0]`)
assertField(t, l, 0, 0, nil, "x") assertField(t, m, 0, 0, nil, "x")
assertField(t, l, 0, 0, nil, "y") assertField(t, m, 0, 0, nil, "y")
assertField(t, l, 0, 0, nil, "layers", "bingo") assertField(t, m, 3, 0, nil, "layers", "bingo")
}, },
}, },
} }

View file

@ -630,10 +630,6 @@ func (m *Map) CreateEdge(eid *EdgeID, refctx *RefContext) (*Edge, error) {
return e, nil return e, nil
} }
func (l *Layer) ast() d2ast.Node {
return l.Map.ast()
}
func (s *Scalar) ast() d2ast.Node { func (s *Scalar) ast() d2ast.Node {
return s.Value return s.Value
} }
@ -778,14 +774,17 @@ func ParentField(n Node) *Field {
return nil return nil
} }
func ParentLayer(n Node) *Layer { func ParentLayer(n Node) *Map {
for n.Parent() != nil { for {
n = n.Parent() m := ParentMap(n)
if n_f, ok := n.(*Layer); ok { if m == nil {
return n_f
}
}
return nil return nil
}
if m.Layer() {
return m
}
n = m
}
} }
func countUnderscores(p []string) int { func countUnderscores(p []string) int {

View file

@ -1,78 +1,4 @@
{ {
"ast": {
"range": "TestCompile/edges/nested.d2,0:0:0-0:10:10",
"nodes": [
{
"map_key": {
"range": "TestCompile/edges/nested.d2,0:0:0-0:10:10",
"edges": [
{
"range": "TestCompile/edges/nested.d2,0:0:0-0:10:10",
"src": {
"range": "TestCompile/edges/nested.d2,0:0:0-0:4:4",
"path": [
{
"unquoted_string": {
"range": "TestCompile/edges/nested.d2,0:0:0-0:1:1",
"value": [
{
"string": "x",
"raw_string": "x"
}
]
}
},
{
"unquoted_string": {
"range": "TestCompile/edges/nested.d2,0:2:2-0:3:3",
"value": [
{
"string": "y",
"raw_string": "y"
}
]
}
}
]
},
"src_arrow": "",
"dst": {
"range": "TestCompile/edges/nested.d2,0:6:6-0:10:10",
"path": [
{
"unquoted_string": {
"range": "TestCompile/edges/nested.d2,0:7:7-0:8:8",
"value": [
{
"string": "z",
"raw_string": "z"
}
]
}
},
{
"unquoted_string": {
"range": "TestCompile/edges/nested.d2,0:9:9-0:10:10",
"value": [
{
"string": "p",
"raw_string": "p"
}
]
}
}
]
},
"dst_arrow": ">"
}
],
"primary": {},
"value": {}
}
}
]
},
"base": {
"fields": [ "fields": [
{ {
"name": "x", "name": "x",
@ -913,5 +839,4 @@
] ]
} }
] ]
}
} }

View file

@ -1,56 +1,4 @@
{ {
"ast": {
"range": "TestCompile/edges/root.d2,0:0:0-0:6:6",
"nodes": [
{
"map_key": {
"range": "TestCompile/edges/root.d2,0:0:0-0:6:6",
"edges": [
{
"range": "TestCompile/edges/root.d2,0:0:0-0:6:6",
"src": {
"range": "TestCompile/edges/root.d2,0:0:0-0:2:2",
"path": [
{
"unquoted_string": {
"range": "TestCompile/edges/root.d2,0:0:0-0:1:1",
"value": [
{
"string": "x",
"raw_string": "x"
}
]
}
}
]
},
"src_arrow": "",
"dst": {
"range": "TestCompile/edges/root.d2,0:4:4-0:6:6",
"path": [
{
"unquoted_string": {
"range": "TestCompile/edges/root.d2,0:5:5-0:6:6",
"value": [
{
"string": "y",
"raw_string": "y"
}
]
}
}
]
},
"dst_arrow": ">"
}
],
"primary": {},
"value": {}
}
}
]
},
"base": {
"fields": [ "fields": [
{ {
"name": "x", "name": "x",
@ -385,5 +333,4 @@
] ]
} }
] ]
}
} }

View file

@ -1,96 +1,4 @@
{ {
"ast": {
"range": "TestCompile/edges/underscore.d2,0:0:0-0:15:15",
"nodes": [
{
"map_key": {
"range": "TestCompile/edges/underscore.d2,0:0:0-0:15:15",
"key": {
"range": "TestCompile/edges/underscore.d2,0:0:0-0:1:1",
"path": [
{
"unquoted_string": {
"range": "TestCompile/edges/underscore.d2,0:0:0-0:1:1",
"value": [
{
"string": "p",
"raw_string": "p"
}
]
}
}
]
},
"primary": {},
"value": {
"map": {
"range": "TestCompile/edges/underscore.d2,0:3:3-0:14:14",
"nodes": [
{
"map_key": {
"range": "TestCompile/edges/underscore.d2,0:5:5-0:14:14",
"edges": [
{
"range": "TestCompile/edges/underscore.d2,0:5:5-0:14:14",
"src": {
"range": "TestCompile/edges/underscore.d2,0:5:5-0:9:9",
"path": [
{
"unquoted_string": {
"range": "TestCompile/edges/underscore.d2,0:5:5-0:6:6",
"value": [
{
"string": "_",
"raw_string": "_"
}
]
}
},
{
"unquoted_string": {
"range": "TestCompile/edges/underscore.d2,0:7:7-0:8:8",
"value": [
{
"string": "x",
"raw_string": "x"
}
]
}
}
]
},
"src_arrow": "",
"dst": {
"range": "TestCompile/edges/underscore.d2,0:11:11-0:14:14",
"path": [
{
"unquoted_string": {
"range": "TestCompile/edges/underscore.d2,0:12:12-0:13:13",
"value": [
{
"string": "z",
"raw_string": "z"
}
]
}
}
]
},
"dst_arrow": ">"
}
],
"primary": {},
"value": {}
}
}
]
}
}
}
}
]
},
"base": {
"fields": [ "fields": [
{ {
"name": "p", "name": "p",
@ -627,5 +535,4 @@
] ]
} }
] ]
}
} }

View file

@ -1,67 +1,4 @@
{ {
"ast": {
"range": "TestCompile/fields/array.d2,0:0:0-0:12:12",
"nodes": [
{
"map_key": {
"range": "TestCompile/fields/array.d2,0:0:0-0:12:12",
"key": {
"range": "TestCompile/fields/array.d2,0:0:0-0:1:1",
"path": [
{
"unquoted_string": {
"range": "TestCompile/fields/array.d2,0:0:0-0:1:1",
"value": [
{
"string": "x",
"raw_string": "x"
}
]
}
}
]
},
"primary": {},
"value": {
"array": {
"range": "TestCompile/fields/array.d2,0:3:3-0:11:11",
"nodes": [
{
"number": {
"range": "TestCompile/fields/array.d2,0:4:4-0:5:5",
"raw": "1",
"value": "1"
}
},
{
"number": {
"range": "TestCompile/fields/array.d2,0:6:6-0:7:7",
"raw": "2",
"value": "2"
}
},
{
"number": {
"range": "TestCompile/fields/array.d2,0:8:8-0:9:9",
"raw": "3",
"value": "3"
}
},
{
"number": {
"range": "TestCompile/fields/array.d2,0:10:10-0:11:11",
"raw": "4",
"value": "4"
}
}
]
}
}
}
}
]
},
"base": {
"fields": [ "fields": [
{ {
"name": "x", "name": "x",
@ -187,5 +124,4 @@
} }
], ],
"edges": null "edges": null
}
} }

View file

@ -1,43 +1,4 @@
{ {
"ast": {
"range": "TestCompile/fields/label.d2,0:0:0-0:6:6",
"nodes": [
{
"map_key": {
"range": "TestCompile/fields/label.d2,0:0:0-0:6:6",
"key": {
"range": "TestCompile/fields/label.d2,0:0:0-0:1:1",
"path": [
{
"unquoted_string": {
"range": "TestCompile/fields/label.d2,0:0:0-0:1:1",
"value": [
{
"string": "x",
"raw_string": "x"
}
]
}
}
]
},
"primary": {},
"value": {
"unquoted_string": {
"range": "TestCompile/fields/label.d2,0:3:3-0:6:6",
"value": [
{
"string": "yes",
"raw_string": "yes"
}
]
}
}
}
}
]
},
"base": {
"fields": [ "fields": [
{ {
"name": "x", "name": "x",
@ -118,5 +79,4 @@
} }
], ],
"edges": null "edges": null
}
} }

View file

@ -1,54 +1,4 @@
{ {
"ast": {
"range": "TestCompile/fields/nested.d2,0:0:0-0:8:8",
"nodes": [
{
"map_key": {
"range": "TestCompile/fields/nested.d2,0:0:0-0:8:8",
"key": {
"range": "TestCompile/fields/nested.d2,0:0:0-0:3:3",
"path": [
{
"unquoted_string": {
"range": "TestCompile/fields/nested.d2,0:0:0-0:1:1",
"value": [
{
"string": "x",
"raw_string": "x"
}
]
}
},
{
"unquoted_string": {
"range": "TestCompile/fields/nested.d2,0:2:2-0:3:3",
"value": [
{
"string": "y",
"raw_string": "y"
}
]
}
}
]
},
"primary": {},
"value": {
"unquoted_string": {
"range": "TestCompile/fields/nested.d2,0:5:5-0:8:8",
"value": [
{
"string": "yes",
"raw_string": "yes"
}
]
}
}
}
}
]
},
"base": {
"fields": [ "fields": [
{ {
"name": "x", "name": "x",
@ -244,5 +194,4 @@
} }
], ],
"edges": null "edges": null
}
} }

View file

@ -1,83 +1,4 @@
{ {
"ast": {
"range": "TestCompile/fields/primary/nested.d2,0:0:0-0:17:17",
"nodes": [
{
"map_key": {
"range": "TestCompile/fields/primary/nested.d2,0:0:0-0:17:17",
"key": {
"range": "TestCompile/fields/primary/nested.d2,0:0:0-0:3:3",
"path": [
{
"unquoted_string": {
"range": "TestCompile/fields/primary/nested.d2,0:0:0-0:1:1",
"value": [
{
"string": "x",
"raw_string": "x"
}
]
}
},
{
"unquoted_string": {
"range": "TestCompile/fields/primary/nested.d2,0:2:2-0:3:3",
"value": [
{
"string": "y",
"raw_string": "y"
}
]
}
}
]
},
"primary": {
"unquoted_string": {
"range": "TestCompile/fields/primary/nested.d2,0:5:5-0:8:8",
"value": [
{
"string": "yes",
"raw_string": "yes"
}
]
}
},
"value": {
"map": {
"range": "TestCompile/fields/primary/nested.d2,0:9:9-0:16:16",
"nodes": [
{
"map_key": {
"range": "TestCompile/fields/primary/nested.d2,0:11:11-0:16:16",
"key": {
"range": "TestCompile/fields/primary/nested.d2,0:11:11-0:16:16",
"path": [
{
"unquoted_string": {
"range": "TestCompile/fields/primary/nested.d2,0:11:11-0:15:15",
"value": [
{
"string": "pqrs",
"raw_string": "pqrs"
}
]
}
}
]
},
"primary": {},
"value": {}
}
}
]
}
}
}
}
]
},
"base": {
"fields": [ "fields": [
{ {
"name": "x", "name": "x",
@ -392,5 +313,4 @@
} }
], ],
"edges": null "edges": null
}
} }

View file

@ -1,72 +1,4 @@
{ {
"ast": {
"range": "TestCompile/fields/primary/root.d2,0:0:0-0:15:15",
"nodes": [
{
"map_key": {
"range": "TestCompile/fields/primary/root.d2,0:0:0-0:15:15",
"key": {
"range": "TestCompile/fields/primary/root.d2,0:0:0-0:1:1",
"path": [
{
"unquoted_string": {
"range": "TestCompile/fields/primary/root.d2,0:0:0-0:1:1",
"value": [
{
"string": "x",
"raw_string": "x"
}
]
}
}
]
},
"primary": {
"unquoted_string": {
"range": "TestCompile/fields/primary/root.d2,0:3:3-0:6:6",
"value": [
{
"string": "yes",
"raw_string": "yes"
}
]
}
},
"value": {
"map": {
"range": "TestCompile/fields/primary/root.d2,0:7:7-0:14:14",
"nodes": [
{
"map_key": {
"range": "TestCompile/fields/primary/root.d2,0:9:9-0:14:14",
"key": {
"range": "TestCompile/fields/primary/root.d2,0:9:9-0:14:14",
"path": [
{
"unquoted_string": {
"range": "TestCompile/fields/primary/root.d2,0:9:9-0:13:13",
"value": [
{
"string": "pqrs",
"raw_string": "pqrs"
}
]
}
}
]
},
"primary": {},
"value": {}
}
}
]
}
}
}
}
]
},
"base": {
"fields": [ "fields": [
{ {
"name": "x", "name": "x",
@ -237,5 +169,4 @@
} }
], ],
"edges": null "edges": null
}
} }

View file

@ -1,33 +1,4 @@
{ {
"ast": {
"range": "TestCompile/fields/root.d2,0:0:0-0:1:1",
"nodes": [
{
"map_key": {
"range": "TestCompile/fields/root.d2,0:0:0-0:1:1",
"key": {
"range": "TestCompile/fields/root.d2,0:0:0-0:1:1",
"path": [
{
"unquoted_string": {
"range": "TestCompile/fields/root.d2,0:0:0-0:1:1",
"value": [
{
"string": "x",
"raw_string": "x"
}
]
}
}
]
},
"primary": {},
"value": {}
}
}
]
},
"base": {
"fields": [ "fields": [
{ {
"name": "x", "name": "x",
@ -87,5 +58,4 @@
} }
], ],
"edges": null "edges": null
}
} }

View file

@ -1,159 +1,4 @@
{ {
"ast": {
"range": "TestCompile/layer/root.d2,0:0:0-3:1:36",
"nodes": [
{
"map_key": {
"range": "TestCompile/layer/root.d2,0:0:0-0:6:6",
"edges": [
{
"range": "TestCompile/layer/root.d2,0:0:0-0:6:6",
"src": {
"range": "TestCompile/layer/root.d2,0:0:0-0:2:2",
"path": [
{
"unquoted_string": {
"range": "TestCompile/layer/root.d2,0:0:0-0:1:1",
"value": [
{
"string": "x",
"raw_string": "x"
}
]
}
}
]
},
"src_arrow": "",
"dst": {
"range": "TestCompile/layer/root.d2,0:4:4-0:6:6",
"path": [
{
"unquoted_string": {
"range": "TestCompile/layer/root.d2,0:5:5-0:6:6",
"value": [
{
"string": "y",
"raw_string": "y"
}
]
}
}
]
},
"dst_arrow": ">"
}
],
"primary": {},
"value": {}
}
},
{
"map_key": {
"range": "TestCompile/layer/root.d2,1:0:7-3:1:36",
"key": {
"range": "TestCompile/layer/root.d2,1:0:7-1:6:13",
"path": [
{
"unquoted_string": {
"range": "TestCompile/layer/root.d2,1:0:7-1:6:13",
"value": [
{
"string": "layers",
"raw_string": "layers"
}
]
}
}
]
},
"primary": {},
"value": {
"map": {
"range": "TestCompile/layer/root.d2,1:8:15-3:0:35",
"nodes": [
{
"map_key": {
"range": "TestCompile/layer/root.d2,2:1:18-2:17:34",
"key": {
"range": "TestCompile/layer/root.d2,2:1:18-2:6:23",
"path": [
{
"unquoted_string": {
"range": "TestCompile/layer/root.d2,2:1:18-2:6:23",
"value": [
{
"string": "bingo",
"raw_string": "bingo"
}
]
}
}
]
},
"primary": {},
"value": {
"map": {
"range": "TestCompile/layer/root.d2,2:8:25-2:16:33",
"nodes": [
{
"map_key": {
"range": "TestCompile/layer/root.d2,2:10:27-2:16:33",
"key": {
"range": "TestCompile/layer/root.d2,2:10:27-2:16:33",
"path": [
{
"unquoted_string": {
"range": "TestCompile/layer/root.d2,2:10:27-2:11:28",
"value": [
{
"string": "p",
"raw_string": "p"
}
]
}
},
{
"unquoted_string": {
"range": "TestCompile/layer/root.d2,2:12:29-2:13:30",
"value": [
{
"string": "q",
"raw_string": "q"
}
]
}
},
{
"unquoted_string": {
"range": "TestCompile/layer/root.d2,2:14:31-2:15:32",
"value": [
{
"string": "z",
"raw_string": "z"
}
]
}
}
]
},
"primary": {},
"value": {}
}
}
]
}
}
}
}
]
}
}
}
}
]
},
"base": {
"fields": [ "fields": [
{ {
"name": "x", "name": "x",
@ -1051,5 +896,4 @@
] ]
} }
] ]
}
} }