fix most of it
This commit is contained in:
parent
577f419d01
commit
ce5da5214f
8 changed files with 1776 additions and 0 deletions
|
|
@ -1714,6 +1714,59 @@ steps: {
|
||||||
assert.Equal(t, 1, len(g.Layers[0].Steps))
|
assert.Equal(t, 1, len(g.Layers[0].Steps))
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "import-connections",
|
||||||
|
|
||||||
|
text: `b.c -> b.d
|
||||||
|
|
||||||
|
b: @imp
|
||||||
|
`,
|
||||||
|
files: map[string]string{
|
||||||
|
"imp.d2": `
|
||||||
|
c
|
||||||
|
d
|
||||||
|
d -> c
|
||||||
|
`,
|
||||||
|
},
|
||||||
|
assertions: func(t *testing.T, g *d2graph.Graph) {
|
||||||
|
assert.Equal(t, 2, len(g.Edges))
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "import-style-1",
|
||||||
|
|
||||||
|
text: `c.style.fill: red
|
||||||
|
|
||||||
|
b: @imp
|
||||||
|
`,
|
||||||
|
files: map[string]string{
|
||||||
|
"imp.d2": `c`,
|
||||||
|
},
|
||||||
|
assertions: func(t *testing.T, g *d2graph.Graph) {
|
||||||
|
assert.Equal(t, 2, len(g.Objects))
|
||||||
|
assert.Equal(t, "c", g.Objects[1].Label.Value)
|
||||||
|
assert.Equal(t, "red", g.Objects[1].Style.Fill.Value)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "import-style-2",
|
||||||
|
|
||||||
|
text: `b.k.c.style.fill: red
|
||||||
|
|
||||||
|
b: @imp
|
||||||
|
`,
|
||||||
|
files: map[string]string{
|
||||||
|
"imp.d2": `
|
||||||
|
k: {
|
||||||
|
c
|
||||||
|
}
|
||||||
|
`,
|
||||||
|
},
|
||||||
|
assertions: func(t *testing.T, g *d2graph.Graph) {
|
||||||
|
assert.Equal(t, "c", g.Objects[2].Label.Value)
|
||||||
|
assert.Equal(t, "red", g.Objects[2].Style.Fill.Value)
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "import-scenario",
|
name: "import-scenario",
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1098,6 +1098,11 @@ func (c *compiler) _compileField(f *Field, refctx *RefContext) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
n.(Importable).SetImportAST(refctx.Key.Value.Import)
|
n.(Importable).SetImportAST(refctx.Key.Value.Import)
|
||||||
|
var existingEdges []*Edge
|
||||||
|
if f.Map() != nil {
|
||||||
|
existingEdges = f.Map().Edges
|
||||||
|
}
|
||||||
|
originalF := f.Copy(refctx.ScopeMap).(*Field)
|
||||||
switch n := n.(type) {
|
switch n := n.(type) {
|
||||||
case *Field:
|
case *Field:
|
||||||
if n.Primary_ != nil {
|
if n.Primary_ != nil {
|
||||||
|
|
@ -1134,6 +1139,22 @@ func (c *compiler) _compileField(f *Field, refctx *RefContext) {
|
||||||
c.overlayClasses(f.Map())
|
c.overlayClasses(f.Map())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
OverlayField(f, originalF)
|
||||||
|
if existingEdges != nil && f.Map() != nil {
|
||||||
|
for _, edge := range existingEdges {
|
||||||
|
exists := false
|
||||||
|
for _, currentEdge := range f.Map().Edges {
|
||||||
|
if currentEdge.ID.Match(edge.ID) {
|
||||||
|
exists = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !exists {
|
||||||
|
f.Map().Edges = append(f.Map().Edges, edge)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} else if refctx.Key.Value.ScalarBox().Unbox() != nil {
|
} else if refctx.Key.Value.ScalarBox().Unbox() != nil {
|
||||||
if c.ignoreLazyGlob(f) {
|
if c.ignoreLazyGlob(f) {
|
||||||
return
|
return
|
||||||
|
|
|
||||||
446
testdata/d2compiler/TestCompile/import-connections.exp.json
generated
vendored
Normal file
446
testdata/d2compiler/TestCompile/import-connections.exp.json
generated
vendored
Normal file
|
|
@ -0,0 +1,446 @@
|
||||||
|
{
|
||||||
|
"graph": {
|
||||||
|
"name": "",
|
||||||
|
"isFolderOnly": false,
|
||||||
|
"ast": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-connections.d2,0:0:0-3:0:20",
|
||||||
|
"nodes": [
|
||||||
|
{
|
||||||
|
"map_key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-connections.d2,0:0:0-0:10:10",
|
||||||
|
"edges": [
|
||||||
|
{
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-connections.d2,0:0:0-0:10:10",
|
||||||
|
"src": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-connections.d2,0:0:0-0:3:3",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-connections.d2,0:0:0-0:1:1",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "b",
|
||||||
|
"raw_string": "b"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-connections.d2,0:2:2-0:3:3",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "c",
|
||||||
|
"raw_string": "c"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"src_arrow": "",
|
||||||
|
"dst": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-connections.d2,0:7:7-0:10:10",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-connections.d2,0:7:7-0:8:8",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "b",
|
||||||
|
"raw_string": "b"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-connections.d2,0:9:9-0:10:10",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "d",
|
||||||
|
"raw_string": "d"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"dst_arrow": ">"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primary": {},
|
||||||
|
"value": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"map_key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-connections.d2,2:0:12-2:7:19",
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-connections.d2,2:0:12-2:1:13",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-connections.d2,2:0:12-2:1:13",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "b",
|
||||||
|
"raw_string": "b"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"primary": {},
|
||||||
|
"value": {
|
||||||
|
"import": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-connections.d2,2:3:15-2:7:19",
|
||||||
|
"spread": false,
|
||||||
|
"pre": "",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-connections.d2,2:4:16-2:7:19",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "imp",
|
||||||
|
"raw_string": "imp"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"id": "",
|
||||||
|
"id_val": "",
|
||||||
|
"attributes": {
|
||||||
|
"label": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"labelDimensions": {
|
||||||
|
"width": 0,
|
||||||
|
"height": 0
|
||||||
|
},
|
||||||
|
"style": {},
|
||||||
|
"near_key": null,
|
||||||
|
"shape": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"direction": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"constraint": null
|
||||||
|
},
|
||||||
|
"zIndex": 0
|
||||||
|
},
|
||||||
|
"edges": [
|
||||||
|
{
|
||||||
|
"index": 0,
|
||||||
|
"isCurve": false,
|
||||||
|
"src_arrow": false,
|
||||||
|
"dst_arrow": true,
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"map_key_edge_index": 0
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"attributes": {
|
||||||
|
"label": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"labelDimensions": {
|
||||||
|
"width": 0,
|
||||||
|
"height": 0
|
||||||
|
},
|
||||||
|
"style": {},
|
||||||
|
"near_key": null,
|
||||||
|
"shape": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"direction": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"constraint": null
|
||||||
|
},
|
||||||
|
"zIndex": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"index": 0,
|
||||||
|
"isCurve": false,
|
||||||
|
"src_arrow": false,
|
||||||
|
"dst_arrow": true,
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"map_key_edge_index": 0
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"attributes": {
|
||||||
|
"label": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"labelDimensions": {
|
||||||
|
"width": 0,
|
||||||
|
"height": 0
|
||||||
|
},
|
||||||
|
"style": {},
|
||||||
|
"near_key": null,
|
||||||
|
"shape": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"direction": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"constraint": null
|
||||||
|
},
|
||||||
|
"zIndex": 0
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"objects": [
|
||||||
|
{
|
||||||
|
"id": "b",
|
||||||
|
"id_val": "b",
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-connections.d2,0:0:0-0:3:3",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-connections.d2,0:0:0-0:1:1",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "b",
|
||||||
|
"raw_string": "b"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-connections.d2,0:2:2-0:3:3",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "c",
|
||||||
|
"raw_string": "c"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"key_path_index": 0,
|
||||||
|
"map_key_edge_index": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-connections.d2,0:7:7-0:10:10",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-connections.d2,0:7:7-0:8:8",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "b",
|
||||||
|
"raw_string": "b"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-connections.d2,0:9:9-0:10:10",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "d",
|
||||||
|
"raw_string": "d"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"key_path_index": 0,
|
||||||
|
"map_key_edge_index": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-connections.d2,2:0:12-2:1:13",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-connections.d2,2:0:12-2:1:13",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "b",
|
||||||
|
"raw_string": "b"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"key_path_index": 0,
|
||||||
|
"map_key_edge_index": -1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"attributes": {
|
||||||
|
"label": {
|
||||||
|
"value": "b"
|
||||||
|
},
|
||||||
|
"labelDimensions": {
|
||||||
|
"width": 0,
|
||||||
|
"height": 0
|
||||||
|
},
|
||||||
|
"style": {},
|
||||||
|
"near_key": null,
|
||||||
|
"shape": {
|
||||||
|
"value": "rectangle"
|
||||||
|
},
|
||||||
|
"direction": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"constraint": null
|
||||||
|
},
|
||||||
|
"zIndex": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "c",
|
||||||
|
"id_val": "c",
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/imp.d2,1:0:1-1:1:2",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/imp.d2,1:0:1-1:1:2",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "c",
|
||||||
|
"raw_string": "c"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"key_path_index": 0,
|
||||||
|
"map_key_edge_index": -1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/imp.d2,3:5:10-3:6:11",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/imp.d2,3:5:10-3:6:11",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "c",
|
||||||
|
"raw_string": "c"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"key_path_index": 0,
|
||||||
|
"map_key_edge_index": 0
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"attributes": {
|
||||||
|
"label": {
|
||||||
|
"value": "c"
|
||||||
|
},
|
||||||
|
"labelDimensions": {
|
||||||
|
"width": 0,
|
||||||
|
"height": 0
|
||||||
|
},
|
||||||
|
"style": {},
|
||||||
|
"near_key": null,
|
||||||
|
"shape": {
|
||||||
|
"value": "rectangle"
|
||||||
|
},
|
||||||
|
"direction": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"constraint": null
|
||||||
|
},
|
||||||
|
"zIndex": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "d",
|
||||||
|
"id_val": "d",
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/imp.d2,2:0:3-2:1:4",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/imp.d2,2:0:3-2:1:4",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "d",
|
||||||
|
"raw_string": "d"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"key_path_index": 0,
|
||||||
|
"map_key_edge_index": -1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/imp.d2,3:0:5-3:1:6",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/imp.d2,3:0:5-3:1:6",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "d",
|
||||||
|
"raw_string": "d"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"key_path_index": 0,
|
||||||
|
"map_key_edge_index": 0
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"attributes": {
|
||||||
|
"label": {
|
||||||
|
"value": "d"
|
||||||
|
},
|
||||||
|
"labelDimensions": {
|
||||||
|
"width": 0,
|
||||||
|
"height": 0
|
||||||
|
},
|
||||||
|
"style": {},
|
||||||
|
"near_key": null,
|
||||||
|
"shape": {
|
||||||
|
"value": "rectangle"
|
||||||
|
},
|
||||||
|
"direction": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"constraint": null
|
||||||
|
},
|
||||||
|
"zIndex": 0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"err": null
|
||||||
|
}
|
||||||
20
testdata/d2compiler/TestCompile/import-icon-near.exp.json
generated
vendored
20
testdata/d2compiler/TestCompile/import-icon-near.exp.json
generated
vendored
|
|
@ -78,6 +78,26 @@
|
||||||
"id": "y",
|
"id": "y",
|
||||||
"id_val": "y",
|
"id_val": "y",
|
||||||
"references": [
|
"references": [
|
||||||
|
{
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-icon-near.d2,0:0:0-0:1:1",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-icon-near.d2,0:0:0-0:1:1",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "y",
|
||||||
|
"raw_string": "y"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"key_path_index": 0,
|
||||||
|
"map_key_edge_index": -1
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"key": {
|
"key": {
|
||||||
"range": "d2/testdata/d2compiler/TestCompile/import-icon-near.d2,0:0:0-0:1:1",
|
"range": "d2/testdata/d2compiler/TestCompile/import-icon-near.d2,0:0:0-0:1:1",
|
||||||
|
|
|
||||||
316
testdata/d2compiler/TestCompile/import-style-1.exp.json
generated
vendored
Normal file
316
testdata/d2compiler/TestCompile/import-style-1.exp.json
generated
vendored
Normal file
|
|
@ -0,0 +1,316 @@
|
||||||
|
{
|
||||||
|
"graph": {
|
||||||
|
"name": "",
|
||||||
|
"isFolderOnly": false,
|
||||||
|
"ast": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style-1.d2,0:0:0-3:0:27",
|
||||||
|
"nodes": [
|
||||||
|
{
|
||||||
|
"map_key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style-1.d2,0:0:0-0:17:17",
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style-1.d2,0:0:0-0:12:12",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style-1.d2,0:0:0-0:1:1",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "c",
|
||||||
|
"raw_string": "c"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style-1.d2,0:2:2-0:7:7",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "style",
|
||||||
|
"raw_string": "style"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style-1.d2,0:8:8-0:12:12",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "fill",
|
||||||
|
"raw_string": "fill"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"primary": {},
|
||||||
|
"value": {
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style-1.d2,0:14:14-0:17:17",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "red",
|
||||||
|
"raw_string": "red"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"map_key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style-1.d2,2:0:19-2:7:26",
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style-1.d2,2:0:19-2:1:20",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style-1.d2,2:0:19-2:1:20",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "b",
|
||||||
|
"raw_string": "b"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"primary": {},
|
||||||
|
"value": {
|
||||||
|
"import": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style-1.d2,2:3:22-2:7:26",
|
||||||
|
"spread": false,
|
||||||
|
"pre": "",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style-1.d2,2:4:23-2:7:26",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "imp",
|
||||||
|
"raw_string": "imp"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"id": "",
|
||||||
|
"id_val": "",
|
||||||
|
"attributes": {
|
||||||
|
"label": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"labelDimensions": {
|
||||||
|
"width": 0,
|
||||||
|
"height": 0
|
||||||
|
},
|
||||||
|
"style": {},
|
||||||
|
"near_key": null,
|
||||||
|
"shape": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"direction": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"constraint": null
|
||||||
|
},
|
||||||
|
"zIndex": 0
|
||||||
|
},
|
||||||
|
"edges": null,
|
||||||
|
"objects": [
|
||||||
|
{
|
||||||
|
"id": "c",
|
||||||
|
"id_val": "c",
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style-1.d2,0:0:0-0:12:12",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style-1.d2,0:0:0-0:1:1",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "c",
|
||||||
|
"raw_string": "c"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style-1.d2,0:2:2-0:7:7",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "style",
|
||||||
|
"raw_string": "style"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style-1.d2,0:8:8-0:12:12",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "fill",
|
||||||
|
"raw_string": "fill"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"key_path_index": 0,
|
||||||
|
"map_key_edge_index": -1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"attributes": {
|
||||||
|
"label": {
|
||||||
|
"value": "c"
|
||||||
|
},
|
||||||
|
"labelDimensions": {
|
||||||
|
"width": 0,
|
||||||
|
"height": 0
|
||||||
|
},
|
||||||
|
"style": {
|
||||||
|
"fill": {
|
||||||
|
"value": "red"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"near_key": null,
|
||||||
|
"shape": {
|
||||||
|
"value": "rectangle"
|
||||||
|
},
|
||||||
|
"direction": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"constraint": null
|
||||||
|
},
|
||||||
|
"zIndex": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "c",
|
||||||
|
"id_val": "c",
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/imp.d2,0:0:0-0:1:1",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/imp.d2,0:0:0-0:1:1",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "c",
|
||||||
|
"raw_string": "c"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"key_path_index": 0,
|
||||||
|
"map_key_edge_index": -1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"attributes": {
|
||||||
|
"label": {
|
||||||
|
"value": "c"
|
||||||
|
},
|
||||||
|
"labelDimensions": {
|
||||||
|
"width": 0,
|
||||||
|
"height": 0
|
||||||
|
},
|
||||||
|
"style": {},
|
||||||
|
"near_key": null,
|
||||||
|
"shape": {
|
||||||
|
"value": "rectangle"
|
||||||
|
},
|
||||||
|
"direction": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"constraint": null
|
||||||
|
},
|
||||||
|
"zIndex": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "b",
|
||||||
|
"id_val": "b",
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style-1.d2,2:0:19-2:1:20",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style-1.d2,2:0:19-2:1:20",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "b",
|
||||||
|
"raw_string": "b"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"key_path_index": 0,
|
||||||
|
"map_key_edge_index": -1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style-1.d2,2:0:19-2:1:20",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style-1.d2,2:0:19-2:1:20",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "b",
|
||||||
|
"raw_string": "b"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"key_path_index": 0,
|
||||||
|
"map_key_edge_index": -1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"attributes": {
|
||||||
|
"label": {
|
||||||
|
"value": "b"
|
||||||
|
},
|
||||||
|
"labelDimensions": {
|
||||||
|
"width": 0,
|
||||||
|
"height": 0
|
||||||
|
},
|
||||||
|
"style": {},
|
||||||
|
"near_key": null,
|
||||||
|
"shape": {
|
||||||
|
"value": "rectangle"
|
||||||
|
},
|
||||||
|
"direction": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"constraint": null
|
||||||
|
},
|
||||||
|
"zIndex": 0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"err": null
|
||||||
|
}
|
||||||
572
testdata/d2compiler/TestCompile/import-style-2.exp.json
generated
vendored
Normal file
572
testdata/d2compiler/TestCompile/import-style-2.exp.json
generated
vendored
Normal file
|
|
@ -0,0 +1,572 @@
|
||||||
|
{
|
||||||
|
"graph": {
|
||||||
|
"name": "",
|
||||||
|
"isFolderOnly": false,
|
||||||
|
"ast": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style-2.d2,0:0:0-3:0:31",
|
||||||
|
"nodes": [
|
||||||
|
{
|
||||||
|
"map_key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style-2.d2,0:0:0-0:21:21",
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style-2.d2,0:0:0-0:16:16",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style-2.d2,0:0:0-0:1:1",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "b",
|
||||||
|
"raw_string": "b"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style-2.d2,0:2:2-0:3:3",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "k",
|
||||||
|
"raw_string": "k"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style-2.d2,0:4:4-0:5:5",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "c",
|
||||||
|
"raw_string": "c"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style-2.d2,0:6:6-0:11:11",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "style",
|
||||||
|
"raw_string": "style"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style-2.d2,0:12:12-0:16:16",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "fill",
|
||||||
|
"raw_string": "fill"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"primary": {},
|
||||||
|
"value": {
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style-2.d2,0:18:18-0:21:21",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "red",
|
||||||
|
"raw_string": "red"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"map_key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style-2.d2,2:0:23-2:7:30",
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style-2.d2,2:0:23-2:1:24",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style-2.d2,2:0:23-2:1:24",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "b",
|
||||||
|
"raw_string": "b"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"primary": {},
|
||||||
|
"value": {
|
||||||
|
"import": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style-2.d2,2:3:26-2:7:30",
|
||||||
|
"spread": false,
|
||||||
|
"pre": "",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style-2.d2,2:4:27-2:7:30",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "imp",
|
||||||
|
"raw_string": "imp"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"id": "",
|
||||||
|
"id_val": "",
|
||||||
|
"attributes": {
|
||||||
|
"label": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"labelDimensions": {
|
||||||
|
"width": 0,
|
||||||
|
"height": 0
|
||||||
|
},
|
||||||
|
"style": {},
|
||||||
|
"near_key": null,
|
||||||
|
"shape": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"direction": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"constraint": null
|
||||||
|
},
|
||||||
|
"zIndex": 0
|
||||||
|
},
|
||||||
|
"edges": null,
|
||||||
|
"objects": [
|
||||||
|
{
|
||||||
|
"id": "b",
|
||||||
|
"id_val": "b",
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style-2.d2,0:0:0-0:16:16",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style-2.d2,0:0:0-0:1:1",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "b",
|
||||||
|
"raw_string": "b"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style-2.d2,0:2:2-0:3:3",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "k",
|
||||||
|
"raw_string": "k"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style-2.d2,0:4:4-0:5:5",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "c",
|
||||||
|
"raw_string": "c"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style-2.d2,0:6:6-0:11:11",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "style",
|
||||||
|
"raw_string": "style"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style-2.d2,0:12:12-0:16:16",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "fill",
|
||||||
|
"raw_string": "fill"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"key_path_index": 0,
|
||||||
|
"map_key_edge_index": -1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style-2.d2,2:0:23-2:1:24",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style-2.d2,2:0:23-2:1:24",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "b",
|
||||||
|
"raw_string": "b"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"key_path_index": 0,
|
||||||
|
"map_key_edge_index": -1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style-2.d2,0:0:0-0:16:16",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style-2.d2,0:0:0-0:1:1",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "b",
|
||||||
|
"raw_string": "b"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style-2.d2,0:2:2-0:3:3",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "k",
|
||||||
|
"raw_string": "k"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style-2.d2,0:4:4-0:5:5",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "c",
|
||||||
|
"raw_string": "c"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style-2.d2,0:6:6-0:11:11",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "style",
|
||||||
|
"raw_string": "style"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style-2.d2,0:12:12-0:16:16",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "fill",
|
||||||
|
"raw_string": "fill"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"key_path_index": 0,
|
||||||
|
"map_key_edge_index": -1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style-2.d2,2:0:23-2:1:24",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style-2.d2,2:0:23-2:1:24",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "b",
|
||||||
|
"raw_string": "b"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"key_path_index": 0,
|
||||||
|
"map_key_edge_index": -1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"attributes": {
|
||||||
|
"label": {
|
||||||
|
"value": "b"
|
||||||
|
},
|
||||||
|
"labelDimensions": {
|
||||||
|
"width": 0,
|
||||||
|
"height": 0
|
||||||
|
},
|
||||||
|
"style": {},
|
||||||
|
"near_key": null,
|
||||||
|
"shape": {
|
||||||
|
"value": "rectangle"
|
||||||
|
},
|
||||||
|
"direction": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"constraint": null
|
||||||
|
},
|
||||||
|
"zIndex": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "k",
|
||||||
|
"id_val": "k",
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/imp.d2,1:0:1-1:1:2",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/imp.d2,1:0:1-1:1:2",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "k",
|
||||||
|
"raw_string": "k"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"key_path_index": 0,
|
||||||
|
"map_key_edge_index": -1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style-2.d2,0:0:0-0:16:16",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style-2.d2,0:0:0-0:1:1",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "b",
|
||||||
|
"raw_string": "b"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style-2.d2,0:2:2-0:3:3",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "k",
|
||||||
|
"raw_string": "k"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style-2.d2,0:4:4-0:5:5",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "c",
|
||||||
|
"raw_string": "c"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style-2.d2,0:6:6-0:11:11",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "style",
|
||||||
|
"raw_string": "style"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style-2.d2,0:12:12-0:16:16",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "fill",
|
||||||
|
"raw_string": "fill"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"key_path_index": 1,
|
||||||
|
"map_key_edge_index": -1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"attributes": {
|
||||||
|
"label": {
|
||||||
|
"value": "red"
|
||||||
|
},
|
||||||
|
"labelDimensions": {
|
||||||
|
"width": 0,
|
||||||
|
"height": 0
|
||||||
|
},
|
||||||
|
"style": {},
|
||||||
|
"near_key": null,
|
||||||
|
"shape": {
|
||||||
|
"value": "rectangle"
|
||||||
|
},
|
||||||
|
"direction": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"constraint": null
|
||||||
|
},
|
||||||
|
"zIndex": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "c",
|
||||||
|
"id_val": "c",
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/imp.d2,2:2:8-2:3:9",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/imp.d2,2:2:8-2:3:9",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "c",
|
||||||
|
"raw_string": "c"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"key_path_index": 0,
|
||||||
|
"map_key_edge_index": -1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style-2.d2,0:0:0-0:16:16",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style-2.d2,0:0:0-0:1:1",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "b",
|
||||||
|
"raw_string": "b"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style-2.d2,0:2:2-0:3:3",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "k",
|
||||||
|
"raw_string": "k"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style-2.d2,0:4:4-0:5:5",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "c",
|
||||||
|
"raw_string": "c"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style-2.d2,0:6:6-0:11:11",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "style",
|
||||||
|
"raw_string": "style"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style-2.d2,0:12:12-0:16:16",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "fill",
|
||||||
|
"raw_string": "fill"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"key_path_index": 2,
|
||||||
|
"map_key_edge_index": -1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"attributes": {
|
||||||
|
"label": {
|
||||||
|
"value": "c"
|
||||||
|
},
|
||||||
|
"labelDimensions": {
|
||||||
|
"width": 0,
|
||||||
|
"height": 0
|
||||||
|
},
|
||||||
|
"style": {
|
||||||
|
"fill": {
|
||||||
|
"value": "red"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"near_key": null,
|
||||||
|
"shape": {
|
||||||
|
"value": "rectangle"
|
||||||
|
},
|
||||||
|
"direction": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"constraint": null
|
||||||
|
},
|
||||||
|
"zIndex": 0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"err": null
|
||||||
|
}
|
||||||
342
testdata/d2compiler/TestCompile/import-style.exp.json
generated
vendored
Normal file
342
testdata/d2compiler/TestCompile/import-style.exp.json
generated
vendored
Normal file
|
|
@ -0,0 +1,342 @@
|
||||||
|
{
|
||||||
|
"graph": {
|
||||||
|
"name": "",
|
||||||
|
"isFolderOnly": false,
|
||||||
|
"ast": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style.d2,0:0:0-3:0:27",
|
||||||
|
"nodes": [
|
||||||
|
{
|
||||||
|
"map_key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style.d2,0:0:0-0:17:17",
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style.d2,0:0:0-0:12:12",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style.d2,0:0:0-0:1:1",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "c",
|
||||||
|
"raw_string": "c"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style.d2,0:2:2-0:7:7",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "style",
|
||||||
|
"raw_string": "style"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style.d2,0:8:8-0:12:12",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "fill",
|
||||||
|
"raw_string": "fill"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"primary": {},
|
||||||
|
"value": {
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style.d2,0:14:14-0:17:17",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "red",
|
||||||
|
"raw_string": "red"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"map_key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style.d2,2:0:19-2:7:26",
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style.d2,2:0:19-2:1:20",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style.d2,2:0:19-2:1:20",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "b",
|
||||||
|
"raw_string": "b"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"primary": {},
|
||||||
|
"value": {
|
||||||
|
"import": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style.d2,2:3:22-2:7:26",
|
||||||
|
"spread": false,
|
||||||
|
"pre": "",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style.d2,2:4:23-2:7:26",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "imp",
|
||||||
|
"raw_string": "imp"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"id": "",
|
||||||
|
"id_val": "",
|
||||||
|
"attributes": {
|
||||||
|
"label": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"labelDimensions": {
|
||||||
|
"width": 0,
|
||||||
|
"height": 0
|
||||||
|
},
|
||||||
|
"style": {},
|
||||||
|
"near_key": null,
|
||||||
|
"shape": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"direction": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"constraint": null
|
||||||
|
},
|
||||||
|
"zIndex": 0
|
||||||
|
},
|
||||||
|
"edges": null,
|
||||||
|
"objects": [
|
||||||
|
{
|
||||||
|
"id": "c",
|
||||||
|
"id_val": "c",
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style.d2,0:0:0-0:12:12",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style.d2,0:0:0-0:1:1",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "c",
|
||||||
|
"raw_string": "c"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style.d2,0:2:2-0:7:7",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "style",
|
||||||
|
"raw_string": "style"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style.d2,0:8:8-0:12:12",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "fill",
|
||||||
|
"raw_string": "fill"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"key_path_index": 0,
|
||||||
|
"map_key_edge_index": -1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"attributes": {
|
||||||
|
"label": {
|
||||||
|
"value": "c"
|
||||||
|
},
|
||||||
|
"labelDimensions": {
|
||||||
|
"width": 0,
|
||||||
|
"height": 0
|
||||||
|
},
|
||||||
|
"style": {
|
||||||
|
"fill": {
|
||||||
|
"value": "red"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"near_key": null,
|
||||||
|
"shape": {
|
||||||
|
"value": "rectangle"
|
||||||
|
},
|
||||||
|
"direction": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"constraint": null
|
||||||
|
},
|
||||||
|
"zIndex": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "c",
|
||||||
|
"id_val": "c",
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/imp.d2,1:0:1-1:1:2",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/imp.d2,1:0:1-1:1:2",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "c",
|
||||||
|
"raw_string": "c"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"key_path_index": 0,
|
||||||
|
"map_key_edge_index": -1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style.d2,0:0:0-0:12:12",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style.d2,0:0:0-0:1:1",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "c",
|
||||||
|
"raw_string": "c"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style.d2,0:2:2-0:7:7",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "style",
|
||||||
|
"raw_string": "style"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style.d2,0:8:8-0:12:12",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "fill",
|
||||||
|
"raw_string": "fill"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"key_path_index": 0,
|
||||||
|
"map_key_edge_index": -1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"attributes": {
|
||||||
|
"label": {
|
||||||
|
"value": "c"
|
||||||
|
},
|
||||||
|
"labelDimensions": {
|
||||||
|
"width": 0,
|
||||||
|
"height": 0
|
||||||
|
},
|
||||||
|
"style": {
|
||||||
|
"fill": {
|
||||||
|
"value": "red"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"near_key": null,
|
||||||
|
"shape": {
|
||||||
|
"value": "rectangle"
|
||||||
|
},
|
||||||
|
"direction": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"constraint": null
|
||||||
|
},
|
||||||
|
"zIndex": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "b",
|
||||||
|
"id_val": "b",
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style.d2,2:0:19-2:1:20",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-style.d2,2:0:19-2:1:20",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "b",
|
||||||
|
"raw_string": "b"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"key_path_index": 0,
|
||||||
|
"map_key_edge_index": -1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"attributes": {
|
||||||
|
"label": {
|
||||||
|
"value": "b"
|
||||||
|
},
|
||||||
|
"labelDimensions": {
|
||||||
|
"width": 0,
|
||||||
|
"height": 0
|
||||||
|
},
|
||||||
|
"style": {},
|
||||||
|
"near_key": null,
|
||||||
|
"shape": {
|
||||||
|
"value": "rectangle"
|
||||||
|
},
|
||||||
|
"direction": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"constraint": null
|
||||||
|
},
|
||||||
|
"zIndex": 0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"err": null
|
||||||
|
}
|
||||||
6
testdata/d2ir/TestCompile/imports/pattern-value.exp.json
generated
vendored
6
testdata/d2ir/TestCompile/imports/pattern-value.exp.json
generated
vendored
|
|
@ -10,6 +10,9 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"primary": {
|
||||||
|
"value": null
|
||||||
|
},
|
||||||
"composite": {
|
"composite": {
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
|
|
@ -255,6 +258,9 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"primary": {
|
||||||
|
"value": null
|
||||||
|
},
|
||||||
"composite": {
|
"composite": {
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue