save
This commit is contained in:
parent
a02896c6da
commit
756068bef5
9 changed files with 1272 additions and 72 deletions
|
|
@ -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.compileBoardLink(g, m)
|
||||
if len(c.err.Errors) > 0 {
|
||||
return nil, c.err
|
||||
}
|
||||
return g, nil
|
||||
}
|
||||
|
||||
|
|
@ -76,7 +80,6 @@ func (c *compiler) compileBoard(g *d2graph.Graph, ir *d2ir.Map) *d2graph.Graph {
|
|||
g.IsFolderOnly = true
|
||||
}
|
||||
}
|
||||
c.validateBoardLink(g, ir)
|
||||
return g
|
||||
}
|
||||
|
||||
|
|
@ -323,6 +326,8 @@ func (c *compiler) compileReserved(attrs *d2graph.Attributes, f *d2ir.Field) {
|
|||
attrs.Link = &d2graph.Scalar{}
|
||||
attrs.Link.Value = scalar.ScalarString()
|
||||
attrs.Link.MapKey = f.LastPrimaryKey()
|
||||
// TODO I think these all need the rank actually
|
||||
attrs.Link.MapKey.Range = scalar.GetRange()
|
||||
case "direction":
|
||||
dirs := []string{"up", "down", "right", "left"}
|
||||
if !go2.Contains(dirs, scalar.ScalarString()) {
|
||||
|
|
@ -716,7 +721,7 @@ func (c *compiler) validateNear(g *d2graph.Graph) {
|
|||
}
|
||||
}
|
||||
|
||||
func (c *compiler) validateBoardLink(g *d2graph.Graph, ir *d2ir.Map) {
|
||||
func (c *compiler) compileBoardLink(g *d2graph.Graph, ir *d2ir.Map) {
|
||||
for _, obj := range g.Objects {
|
||||
if obj.Attributes.Link == nil {
|
||||
continue
|
||||
|
|
@ -728,25 +733,59 @@ func (c *compiler) validateBoardLink(g *d2graph.Graph, ir *d2ir.Map) {
|
|||
continue
|
||||
}
|
||||
|
||||
// If the keyword is not another board, don't validate
|
||||
// Might just be linking to a local folder
|
||||
switch linkKey.Path[0].Unbox().ScalarString() {
|
||||
// TODO underscore
|
||||
case "layers", "scenarios", "steps":
|
||||
default:
|
||||
continue
|
||||
}
|
||||
|
||||
b := ir.GetField(linkKey.IDA()...)
|
||||
if b == nil {
|
||||
obj.LinkedBoard = c.findBoard(g, ir, linkKey.IDA())
|
||||
|
||||
if obj.LinkedBoard == nil {
|
||||
c.errorf(obj.Attributes.Link.MapKey, "link key %#v to board not found", obj.Attributes.Link.Value)
|
||||
continue
|
||||
}
|
||||
kind := d2ir.NodeBoardKind(b)
|
||||
if kind == "" {
|
||||
c.errorf(obj.Attributes.Link.MapKey, "internal link key %#v is not a top-level board", obj.Attributes.Link.Value)
|
||||
}
|
||||
}
|
||||
|
||||
func (c *compiler) findBoard(g *d2graph.Graph, ir *d2ir.Map, ida []string) *d2graph.Graph {
|
||||
var currType string
|
||||
for _, p := range ida {
|
||||
switch p {
|
||||
case "layers", "scenarios", "steps":
|
||||
currType = p
|
||||
continue
|
||||
}
|
||||
var boards []*d2graph.Graph
|
||||
switch currType {
|
||||
case "layers":
|
||||
boards = g.Layers
|
||||
case "scenarios":
|
||||
boards = g.Scenarios
|
||||
case "steps":
|
||||
boards = g.Steps
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
currType = ""
|
||||
|
||||
var board *d2graph.Graph
|
||||
for i, b := range boards {
|
||||
if b.Name == p {
|
||||
board = boards[i]
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if board == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
g = board
|
||||
}
|
||||
|
||||
return g
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
|
|
|||
|
|
@ -2031,8 +2031,13 @@ Chinchillas_Collectibles.chinchilla -> Chinchillas.id`,
|
|||
name: "link-board-ok",
|
||||
text: `x.link: layers.x
|
||||
layers: {
|
||||
x
|
||||
x: {
|
||||
y
|
||||
}
|
||||
}`,
|
||||
assertions: func(t *testing.T, g *d2graph.Graph) {
|
||||
tassert.Equal(t, g.Layers[0].Name, g.Objects[0].LinkedBoard.Name)
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "link-board-mixed",
|
||||
|
|
@ -2050,6 +2055,9 @@ scenarios: {
|
|||
question.style.fill: green
|
||||
}
|
||||
}`,
|
||||
assertions: func(t *testing.T, g *d2graph.Graph) {
|
||||
tassert.Equal(t, g.Layers[0].Name, g.Objects[0].LinkedBoard.Name)
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "link-board-not-found",
|
||||
|
|
@ -2066,7 +2074,7 @@ layers: {
|
|||
y
|
||||
}
|
||||
}`,
|
||||
expErr: `d2/testdata/d2compiler/TestCompile/link-board-not-board.d2:2:9: internal link key "layers.x.y" is not a top-level board`,
|
||||
expErr: `d2/testdata/d2compiler/TestCompile/link-board-not-board.d2:2:9: link key "layers.x.y" to board not found`,
|
||||
},
|
||||
{
|
||||
name: "link-board-nested",
|
||||
|
|
@ -2074,10 +2082,15 @@ layers: {
|
|||
layers: {
|
||||
x: {
|
||||
layers: {
|
||||
x
|
||||
x: {
|
||||
hello
|
||||
}
|
||||
}
|
||||
}
|
||||
}`,
|
||||
assertions: func(t *testing.T, g *d2graph.Graph) {
|
||||
tassert.Equal(t, g.Layers[0].Layers[0], g.Objects[0].LinkedBoard)
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -84,6 +84,8 @@ type Object struct {
|
|||
LabelHeight *int `json:"labelHeight,omitempty"`
|
||||
IconPosition *string `json:"iconPosition,omitempty"`
|
||||
|
||||
LinkedBoard *Graph `json:"-"`
|
||||
|
||||
Class *d2target.Class `json:"class,omitempty"`
|
||||
SQLTable *d2target.SQLTable `json:"sql_table,omitempty"`
|
||||
|
||||
|
|
|
|||
625
testdata/d2compiler/TestCompile/link-board-mixed.exp.json
generated
vendored
625
testdata/d2compiler/TestCompile/link-board-mixed.exp.json
generated
vendored
|
|
@ -1,8 +1,9 @@
|
|||
{
|
||||
"graph": {
|
||||
"name": "",
|
||||
"isFolderOnly": false,
|
||||
"ast": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,0:0:0-11:1:137",
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,0:0:0-13:1:173",
|
||||
"nodes": [
|
||||
{
|
||||
"map_key": {
|
||||
|
|
@ -197,7 +198,7 @@
|
|||
},
|
||||
{
|
||||
"map_key": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,9:0:115-11:1:137",
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,9:0:115-13:1:173",
|
||||
"key": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,9:0:115-9:9:124",
|
||||
"path": [
|
||||
|
|
@ -217,11 +218,11 @@
|
|||
"primary": {},
|
||||
"value": {
|
||||
"map": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,9:11:126-11:0:136",
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,9:11:126-13:0:172",
|
||||
"nodes": [
|
||||
{
|
||||
"map_key": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,10:2:130-10:7:135",
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,10:2:130-12:3:171",
|
||||
"key": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,10:2:130-10:7:135",
|
||||
"path": [
|
||||
|
|
@ -239,7 +240,68 @@
|
|||
]
|
||||
},
|
||||
"primary": {},
|
||||
"value": {}
|
||||
"value": {
|
||||
"map": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,10:9:137-12:2:170",
|
||||
"nodes": [
|
||||
{
|
||||
"map_key": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,11:2:141-11:28:167",
|
||||
"key": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,11:2:141-11:21:160",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,11:2:141-11:10:149",
|
||||
"value": [
|
||||
{
|
||||
"string": "question",
|
||||
"raw_string": "question"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,11:11:150-11:16:155",
|
||||
"value": [
|
||||
{
|
||||
"string": "style",
|
||||
"raw_string": "style"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,11:17:156-11:21:160",
|
||||
"value": [
|
||||
{
|
||||
"string": "fill",
|
||||
"raw_string": "fill"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"primary": {},
|
||||
"value": {
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,11:23:162-11:28:167",
|
||||
"value": [
|
||||
{
|
||||
"string": "green",
|
||||
"raw_string": "green"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
@ -261,9 +323,6 @@
|
|||
"value": ""
|
||||
},
|
||||
"style": {},
|
||||
"link": {
|
||||
"value": ""
|
||||
},
|
||||
"near_key": null,
|
||||
"shape": {
|
||||
"value": ""
|
||||
|
|
@ -364,8 +423,9 @@
|
|||
"layers": [
|
||||
{
|
||||
"name": "cat",
|
||||
"isFolderOnly": false,
|
||||
"ast": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,0:0:0-11:1:137",
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,0:0:0-13:1:173",
|
||||
"nodes": [
|
||||
{
|
||||
"map_key": {
|
||||
|
|
@ -560,7 +620,7 @@
|
|||
},
|
||||
{
|
||||
"map_key": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,9:0:115-11:1:137",
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,9:0:115-13:1:173",
|
||||
"key": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,9:0:115-9:9:124",
|
||||
"path": [
|
||||
|
|
@ -580,11 +640,11 @@
|
|||
"primary": {},
|
||||
"value": {
|
||||
"map": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,9:11:126-11:0:136",
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,9:11:126-13:0:172",
|
||||
"nodes": [
|
||||
{
|
||||
"map_key": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,10:2:130-10:7:135",
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,10:2:130-12:3:171",
|
||||
"key": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,10:2:130-10:7:135",
|
||||
"path": [
|
||||
|
|
@ -602,7 +662,68 @@
|
|||
]
|
||||
},
|
||||
"primary": {},
|
||||
"value": {}
|
||||
"value": {
|
||||
"map": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,10:9:137-12:2:170",
|
||||
"nodes": [
|
||||
{
|
||||
"map_key": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,11:2:141-11:28:167",
|
||||
"key": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,11:2:141-11:21:160",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,11:2:141-11:10:149",
|
||||
"value": [
|
||||
{
|
||||
"string": "question",
|
||||
"raw_string": "question"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,11:11:150-11:16:155",
|
||||
"value": [
|
||||
{
|
||||
"string": "style",
|
||||
"raw_string": "style"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,11:17:156-11:21:160",
|
||||
"value": [
|
||||
{
|
||||
"string": "fill",
|
||||
"raw_string": "fill"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"primary": {},
|
||||
"value": {
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,11:23:162-11:28:167",
|
||||
"value": [
|
||||
{
|
||||
"string": "green",
|
||||
"raw_string": "green"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
@ -624,9 +745,6 @@
|
|||
"value": ""
|
||||
},
|
||||
"style": {},
|
||||
"link": {
|
||||
"value": ""
|
||||
},
|
||||
"near_key": null,
|
||||
"shape": {
|
||||
"value": ""
|
||||
|
|
@ -662,9 +780,6 @@
|
|||
"value": "goes"
|
||||
},
|
||||
"style": {},
|
||||
"link": {
|
||||
"value": ""
|
||||
},
|
||||
"near_key": null,
|
||||
"shape": {
|
||||
"value": ""
|
||||
|
|
@ -714,9 +829,6 @@
|
|||
"value": "the cat"
|
||||
},
|
||||
"style": {},
|
||||
"link": {
|
||||
"value": ""
|
||||
},
|
||||
"near_key": null,
|
||||
"shape": {
|
||||
"value": "rectangle"
|
||||
|
|
@ -764,9 +876,476 @@
|
|||
"value": "meeeowwww"
|
||||
},
|
||||
"style": {},
|
||||
"link": {
|
||||
"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:173",
|
||||
"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:15:46-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": {
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,1:15:46-1:25:56",
|
||||
"value": [
|
||||
{
|
||||
"string": "layers.cat",
|
||||
"raw_string": "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:173",
|
||||
"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:172",
|
||||
"nodes": [
|
||||
{
|
||||
"map_key": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,10:2:130-12:3:171",
|
||||
"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:170",
|
||||
"nodes": [
|
||||
{
|
||||
"map_key": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,11:2:141-11:28:167",
|
||||
"key": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,11:2:141-11:21:160",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,11:2:141-11:10:149",
|
||||
"value": [
|
||||
{
|
||||
"string": "question",
|
||||
"raw_string": "question"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,11:11:150-11:16:155",
|
||||
"value": [
|
||||
{
|
||||
"string": "style",
|
||||
"raw_string": "style"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,11:17:156-11:21:160",
|
||||
"value": [
|
||||
{
|
||||
"string": "fill",
|
||||
"raw_string": "fill"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"primary": {},
|
||||
"value": {
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,11:23:162-11:28:167",
|
||||
"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:2:141-11:21:160",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,11:2:141-11:10:149",
|
||||
"value": [
|
||||
{
|
||||
"string": "question",
|
||||
"raw_string": "question"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,11:11:150-11:16:155",
|
||||
"value": [
|
||||
{
|
||||
"string": "style",
|
||||
"raw_string": "style"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,11:17:156-11:21:160",
|
||||
"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": "layers.cat"
|
||||
},
|
||||
"near_key": null,
|
||||
"shape": {
|
||||
"value": "rectangle"
|
||||
|
|
|
|||
379
testdata/d2compiler/TestCompile/link-board-nested.exp.json
generated
vendored
379
testdata/d2compiler/TestCompile/link-board-nested.exp.json
generated
vendored
|
|
@ -3,11 +3,11 @@
|
|||
"name": "",
|
||||
"isFolderOnly": false,
|
||||
"ast": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,0:0:0-7:1:75",
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,0:0:0-9:1:94",
|
||||
"nodes": [
|
||||
{
|
||||
"map_key": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,0:0:0-0:25:25",
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,0:8:8-0:25:25",
|
||||
"key": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,0:0:0-0:6:6",
|
||||
"path": [
|
||||
|
|
@ -51,7 +51,7 @@
|
|||
},
|
||||
{
|
||||
"map_key": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,1:0:26-7:1:75",
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,1:0:26-9:1:94",
|
||||
"key": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,1:0:26-1:6:32",
|
||||
"path": [
|
||||
|
|
@ -71,11 +71,11 @@
|
|||
"primary": {},
|
||||
"value": {
|
||||
"map": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,1:8:34-7:0:74",
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,1:8:34-9:0:93",
|
||||
"nodes": [
|
||||
{
|
||||
"map_key": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,2:1:37-6:3:73",
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,2:1:37-8:3:92",
|
||||
"key": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,2:1:37-2:2:38",
|
||||
"path": [
|
||||
|
|
@ -95,11 +95,11 @@
|
|||
"primary": {},
|
||||
"value": {
|
||||
"map": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,2:4:40-6:2:72",
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,2:4:40-8:2:91",
|
||||
"nodes": [
|
||||
{
|
||||
"map_key": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,3:4:46-5:5:69",
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,3:4:46-7:5:88",
|
||||
"key": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,3:4:46-3:10:52",
|
||||
"path": [
|
||||
|
|
@ -119,17 +119,17 @@
|
|||
"primary": {},
|
||||
"value": {
|
||||
"map": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,3:12:54-5:4:68",
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,3:12:54-7:4:87",
|
||||
"nodes": [
|
||||
{
|
||||
"map_key": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,4:6:62-4:7:63",
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,4:3:59-6:4:82",
|
||||
"key": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,4:6:62-4:7:63",
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,4:3:59-4:4:60",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,4:6:62-4:7:63",
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,4:3:59-4:4:60",
|
||||
"value": [
|
||||
{
|
||||
"string": "x",
|
||||
|
|
@ -141,7 +141,36 @@
|
|||
]
|
||||
},
|
||||
"primary": {},
|
||||
"value": {}
|
||||
"value": {
|
||||
"map": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,4:6:62-6:3:81",
|
||||
"nodes": [
|
||||
{
|
||||
"map_key": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,5:8:72-5:13:77",
|
||||
"key": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,5:8:72-5:13:77",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,5:8:72-5:13:77",
|
||||
"value": [
|
||||
{
|
||||
"string": "hello",
|
||||
"raw_string": "hello"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"primary": {},
|
||||
"value": {}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
@ -253,13 +282,13 @@
|
|||
"layers": [
|
||||
{
|
||||
"name": "x",
|
||||
"isFolderOnly": false,
|
||||
"isFolderOnly": true,
|
||||
"ast": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,0:0:0-7:1:75",
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,0:0:0-9:1:94",
|
||||
"nodes": [
|
||||
{
|
||||
"map_key": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,0:0:0-0:25:25",
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,0:8:8-0:25:25",
|
||||
"key": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,0:0:0-0:6:6",
|
||||
"path": [
|
||||
|
|
@ -303,7 +332,7 @@
|
|||
},
|
||||
{
|
||||
"map_key": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,1:0:26-7:1:75",
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,1:0:26-9:1:94",
|
||||
"key": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,1:0:26-1:6:32",
|
||||
"path": [
|
||||
|
|
@ -323,11 +352,11 @@
|
|||
"primary": {},
|
||||
"value": {
|
||||
"map": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,1:8:34-7:0:74",
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,1:8:34-9:0:93",
|
||||
"nodes": [
|
||||
{
|
||||
"map_key": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,2:1:37-6:3:73",
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,2:1:37-8:3:92",
|
||||
"key": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,2:1:37-2:2:38",
|
||||
"path": [
|
||||
|
|
@ -347,11 +376,11 @@
|
|||
"primary": {},
|
||||
"value": {
|
||||
"map": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,2:4:40-6:2:72",
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,2:4:40-8:2:91",
|
||||
"nodes": [
|
||||
{
|
||||
"map_key": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,3:4:46-5:5:69",
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,3:4:46-7:5:88",
|
||||
"key": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,3:4:46-3:10:52",
|
||||
"path": [
|
||||
|
|
@ -371,17 +400,17 @@
|
|||
"primary": {},
|
||||
"value": {
|
||||
"map": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,3:12:54-5:4:68",
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,3:12:54-7:4:87",
|
||||
"nodes": [
|
||||
{
|
||||
"map_key": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,4:6:62-4:7:63",
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,4:3:59-6:4:82",
|
||||
"key": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,4:6:62-4:7:63",
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,4:3:59-4:4:60",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,4:6:62-4:7:63",
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,4:3:59-4:4:60",
|
||||
"value": [
|
||||
{
|
||||
"string": "x",
|
||||
|
|
@ -393,7 +422,36 @@
|
|||
]
|
||||
},
|
||||
"primary": {},
|
||||
"value": {}
|
||||
"value": {
|
||||
"map": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,4:6:62-6:3:81",
|
||||
"nodes": [
|
||||
{
|
||||
"map_key": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,5:8:72-5:13:77",
|
||||
"key": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,5:8:72-5:13:77",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,5:8:72-5:13:77",
|
||||
"value": [
|
||||
{
|
||||
"string": "hello",
|
||||
"raw_string": "hello"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"primary": {},
|
||||
"value": {}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
@ -439,7 +497,276 @@
|
|||
"zIndex": 0
|
||||
},
|
||||
"edges": null,
|
||||
"objects": null
|
||||
"objects": null,
|
||||
"layers": [
|
||||
{
|
||||
"name": "x",
|
||||
"isFolderOnly": false,
|
||||
"ast": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,0:0:0-9:1:94",
|
||||
"nodes": [
|
||||
{
|
||||
"map_key": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,0:8:8-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": {
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,0:8:8-0:25:25",
|
||||
"value": [
|
||||
{
|
||||
"string": "layers.x.layers.x",
|
||||
"raw_string": "layers.x.layers.x"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"map_key": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,1:0:26-9:1:94",
|
||||
"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:93",
|
||||
"nodes": [
|
||||
{
|
||||
"map_key": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,2:1:37-8:3:92",
|
||||
"key": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,2:1:37-2:2:38",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,2:1:37-2:2:38",
|
||||
"value": [
|
||||
{
|
||||
"string": "x",
|
||||
"raw_string": "x"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"primary": {},
|
||||
"value": {
|
||||
"map": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,2:4:40-8:2:91",
|
||||
"nodes": [
|
||||
{
|
||||
"map_key": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,3:4:46-7:5:88",
|
||||
"key": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,3:4:46-3:10:52",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,3:4:46-3:10:52",
|
||||
"value": [
|
||||
{
|
||||
"string": "layers",
|
||||
"raw_string": "layers"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"primary": {},
|
||||
"value": {
|
||||
"map": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,3:12:54-7:4:87",
|
||||
"nodes": [
|
||||
{
|
||||
"map_key": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,4:3:59-6:4:82",
|
||||
"key": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,4:3:59-4:4:60",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,4:3:59-4:4:60",
|
||||
"value": [
|
||||
{
|
||||
"string": "x",
|
||||
"raw_string": "x"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"primary": {},
|
||||
"value": {
|
||||
"map": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,4:6:62-6:3:81",
|
||||
"nodes": [
|
||||
{
|
||||
"map_key": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,5:8:72-5:13:77",
|
||||
"key": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,5:8:72-5:13:77",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,5:8:72-5:13:77",
|
||||
"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:72-5:13:77",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,5:8:72-5:13:77",
|
||||
"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
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
|
|||
2
testdata/d2compiler/TestCompile/link-board-not-board.exp.json
generated
vendored
2
testdata/d2compiler/TestCompile/link-board-not-board.exp.json
generated
vendored
|
|
@ -5,7 +5,7 @@
|
|||
"errs": [
|
||||
{
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-not-board.d2,1:8:12-1:18:22",
|
||||
"errmsg": "d2/testdata/d2compiler/TestCompile/link-board-not-board.d2:2:9: internal link key \"layers.x.y\" is not a top-level board"
|
||||
"errmsg": "d2/testdata/d2compiler/TestCompile/link-board-not-board.d2:2:9: link key \"layers.x.y\" to board not found"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
256
testdata/d2compiler/TestCompile/link-board-ok.exp.json
generated
vendored
256
testdata/d2compiler/TestCompile/link-board-ok.exp.json
generated
vendored
|
|
@ -3,11 +3,11 @@
|
|||
"name": "",
|
||||
"isFolderOnly": false,
|
||||
"ast": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-ok.d2,0:0:0-3:1:32",
|
||||
"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",
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-ok.d2,0:8:8-0:16:16",
|
||||
"key": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-ok.d2,0:0:0-0:6:6",
|
||||
"path": [
|
||||
|
|
@ -51,7 +51,7 @@
|
|||
},
|
||||
{
|
||||
"map_key": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-ok.d2,1:0:17-3:1:32",
|
||||
"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": [
|
||||
|
|
@ -71,17 +71,17 @@
|
|||
"primary": {},
|
||||
"value": {
|
||||
"map": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-ok.d2,1:8:25-3:0:31",
|
||||
"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:2:29-2:3:30",
|
||||
"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:2:29-2:3:30",
|
||||
"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:2:29-2:3:30",
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-ok.d2,2:1:28-2:2:29",
|
||||
"value": [
|
||||
{
|
||||
"string": "x",
|
||||
|
|
@ -93,7 +93,36 @@
|
|||
]
|
||||
},
|
||||
"primary": {},
|
||||
"value": {}
|
||||
"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": {}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
@ -191,6 +220,217 @@
|
|||
},
|
||||
"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:8:8-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": {
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-ok.d2,0:8:8-0:16:16",
|
||||
"value": [
|
||||
{
|
||||
"string": "layers.x",
|
||||
"raw_string": "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
|
||||
|
|
|
|||
2
testdata/d2compiler/TestCompile/path_link.exp.json
generated
vendored
2
testdata/d2compiler/TestCompile/path_link.exp.json
generated
vendored
|
|
@ -31,7 +31,7 @@
|
|||
"nodes": [
|
||||
{
|
||||
"map_key": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/path_link.d2,1:2:7-1:39:44",
|
||||
"range": "d2/testdata/d2compiler/TestCompile/path_link.d2,1:8:13-1:39:44",
|
||||
"key": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/path_link.d2,1:2:7-1:6:11",
|
||||
"path": [
|
||||
|
|
|
|||
2
testdata/d2compiler/TestCompile/url_link.exp.json
generated
vendored
2
testdata/d2compiler/TestCompile/url_link.exp.json
generated
vendored
|
|
@ -31,7 +31,7 @@
|
|||
"nodes": [
|
||||
{
|
||||
"map_key": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/url_link.d2,1:2:7-1:26:31",
|
||||
"range": "d2/testdata/d2compiler/TestCompile/url_link.d2,1:8:13-1:26:31",
|
||||
"key": {
|
||||
"range": "d2/testdata/d2compiler/TestCompile/url_link.d2,1:2:7-1:6:11",
|
||||
"path": [
|
||||
|
|
|
|||
Loading…
Reference in a new issue