use right AST

This commit is contained in:
Alexander Wang 2023-06-16 16:23:57 -07:00
parent b8436358fb
commit 64daf4643f
No known key found for this signature in database
GPG key ID: D89FA31966BDBECE
12 changed files with 1841 additions and 1739 deletions

View file

@ -110,7 +110,7 @@ func (c *compiler) compileBoardsField(g *d2graph.Graph, ir *d2ir.Map, fieldName
} }
g2 := d2graph.NewGraph() g2 := d2graph.NewGraph()
g2.Parent = g g2.Parent = g
g2.AST = g.AST g2.AST = ir.AST().(*d2ast.Map)
c.compileBoard(g2, f.Map()) c.compileBoard(g2, f.Map())
g2.Name = f.Name g2.Name = f.Name
switch fieldName { switch fieldName {

View file

@ -25,7 +25,7 @@ type Node interface {
Map() *Map Map() *Map
Equal(n2 Node) bool Equal(n2 Node) bool
ast() d2ast.Node AST() d2ast.Node
fmt.Stringer fmt.Stringer
LastRef() Reference LastRef() Reference
@ -100,11 +100,11 @@ func (n *Map) value() {}
func (n *Array) composite() {} func (n *Array) composite() {}
func (n *Map) composite() {} func (n *Map) composite() {}
func (n *Scalar) String() string { return d2format.Format(n.ast()) } func (n *Scalar) String() string { return d2format.Format(n.AST()) }
func (n *Field) String() string { return d2format.Format(n.ast()) } func (n *Field) String() string { return d2format.Format(n.AST()) }
func (n *Edge) String() string { return d2format.Format(n.ast()) } func (n *Edge) String() string { return d2format.Format(n.AST()) }
func (n *Array) String() string { return d2format.Format(n.ast()) } func (n *Array) String() string { return d2format.Format(n.AST()) }
func (n *Map) String() string { return d2format.Format(n.ast()) } func (n *Map) String() string { return d2format.Format(n.AST()) }
func (n *Scalar) LastRef() Reference { return parentRef(n) } func (n *Scalar) LastRef() Reference { return parentRef(n) }
func (n *Map) LastRef() Reference { return parentRef(n) } func (n *Map) LastRef() Reference { return parentRef(n) }
@ -855,11 +855,11 @@ func (m *Map) CreateEdge(eid *EdgeID, refctx *RefContext) (*Edge, error) {
return e, nil return e, nil
} }
func (s *Scalar) ast() d2ast.Node { func (s *Scalar) AST() d2ast.Node {
return s.Value return s.Value
} }
func (f *Field) ast() d2ast.Node { func (f *Field) AST() d2ast.Node {
k := &d2ast.Key{ k := &d2ast.Key{
Key: &d2ast.KeyPath{ Key: &d2ast.KeyPath{
Path: []*d2ast.StringBox{ Path: []*d2ast.StringBox{
@ -869,16 +869,16 @@ func (f *Field) ast() d2ast.Node {
} }
if f.Primary_ != nil { if f.Primary_ != nil {
k.Primary = d2ast.MakeValueBox(f.Primary_.ast().(d2ast.Value)).ScalarBox() k.Primary = d2ast.MakeValueBox(f.Primary_.AST().(d2ast.Value)).ScalarBox()
} }
if f.Composite != nil { if f.Composite != nil {
k.Value = d2ast.MakeValueBox(f.Composite.ast().(d2ast.Value)) k.Value = d2ast.MakeValueBox(f.Composite.AST().(d2ast.Value))
} }
return k return k
} }
func (e *Edge) ast() d2ast.Node { func (e *Edge) AST() d2ast.Node {
astEdge := &d2ast.Edge{} astEdge := &d2ast.Edge{}
astEdge.Src = d2ast.MakeKeyPath(e.ID.SrcPath) astEdge.Src = d2ast.MakeKeyPath(e.ID.SrcPath)
@ -895,27 +895,27 @@ func (e *Edge) ast() d2ast.Node {
} }
if e.Primary_ != nil { if e.Primary_ != nil {
k.Primary = d2ast.MakeValueBox(e.Primary_.ast().(d2ast.Value)).ScalarBox() k.Primary = d2ast.MakeValueBox(e.Primary_.AST().(d2ast.Value)).ScalarBox()
} }
if e.Map_ != nil { if e.Map_ != nil {
k.Value = d2ast.MakeValueBox(e.Map_.ast().(*d2ast.Map)) k.Value = d2ast.MakeValueBox(e.Map_.AST().(*d2ast.Map))
} }
return k return k
} }
func (a *Array) ast() d2ast.Node { func (a *Array) AST() d2ast.Node {
if a == nil { if a == nil {
return nil return nil
} }
astArray := &d2ast.Array{} astArray := &d2ast.Array{}
for _, av := range a.Values { for _, av := range a.Values {
astArray.Nodes = append(astArray.Nodes, d2ast.MakeArrayNodeBox(av.ast().(d2ast.ArrayNode))) astArray.Nodes = append(astArray.Nodes, d2ast.MakeArrayNodeBox(av.AST().(d2ast.ArrayNode)))
} }
return astArray return astArray
} }
func (m *Map) ast() d2ast.Node { func (m *Map) AST() d2ast.Node {
if m == nil { if m == nil {
return nil return nil
} }
@ -926,10 +926,10 @@ func (m *Map) ast() d2ast.Node {
astMap.Range = d2ast.MakeRange(",1:0:0-2:0:0") astMap.Range = d2ast.MakeRange(",1:0:0-2:0:0")
} }
for _, f := range m.Fields { for _, f := range m.Fields {
astMap.Nodes = append(astMap.Nodes, d2ast.MakeMapNodeBox(f.ast().(d2ast.MapNode))) astMap.Nodes = append(astMap.Nodes, d2ast.MakeMapNodeBox(f.AST().(d2ast.MapNode)))
} }
for _, e := range m.Edges { for _, e := range m.Edges {
astMap.Nodes = append(astMap.Nodes, d2ast.MakeMapNodeBox(e.ast().(d2ast.MapNode))) astMap.Nodes = append(astMap.Nodes, d2ast.MakeMapNodeBox(e.AST().(d2ast.MapNode)))
} }
return astMap return astMap
} }

View file

@ -295,21 +295,20 @@
"name": "x", "name": "x",
"isFolderOnly": false, "isFolderOnly": false,
"ast": { "ast": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-key-nested.d2,0:0:0-7:1:55", "range": ",0:0:0-1:0:0",
"nodes": [ "nodes": [
{ {
"map_key": { "map_key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-key-nested.d2,0:0:0-2:1:25", "range": ",0:0:0-0:0:0",
"key": { "key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-key-nested.d2,0:0:0-0:1:1", "range": ",0:0:0-0:0:0",
"path": [ "path": [
{ {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-key-nested.d2,0:0:0-0:1:1", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "x", "string": "x"
"raw_string": "x"
} }
] ]
} }
@ -319,32 +318,20 @@
"primary": {}, "primary": {},
"value": { "value": {
"map": { "map": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-key-nested.d2,0:3:3-2:1:25", "range": ",1:0:0-2:0:0",
"nodes": [ "nodes": [
{ {
"map_key": { "map_key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-key-nested.d2,1:2:7-1:18:23", "range": ",0:0:0-0:0:0",
"key": { "key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-key-nested.d2,1:2:7-1:8:13", "range": ",0:0:0-0:0:0",
"path": [ "path": [
{ {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-key-nested.d2,1:2:7-1:3:8", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "y", "string": "y"
"raw_string": "y"
}
]
}
},
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-key-nested.d2,1:4:9-1:8:13",
"value": [
{
"string": "link",
"raw_string": "link"
} }
] ]
} }
@ -353,6 +340,28 @@
}, },
"primary": {}, "primary": {},
"value": { "value": {
"map": {
"range": ",1:0:0-2:0:0",
"nodes": [
{
"map_key": {
"range": ",0:0:0-0:0:0",
"key": {
"range": ",0:0:0-0:0:0",
"path": [
{
"unquoted_string": {
"range": ",0:0:0-0:0:0",
"value": [
{
"string": "link"
}
]
}
}
]
},
"primary": {
"unquoted_string": { "unquoted_string": {
"range": ",0:0:0-0:0:0", "range": ",0:0:0-0:0:0",
"value": [ "value": [
@ -361,6 +370,12 @@
} }
] ]
} }
},
"value": {}
}
}
]
}
} }
} }
} }
@ -371,17 +386,16 @@
}, },
{ {
"map_key": { "map_key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-key-nested.d2,3:0:26-7:1:55", "range": ",0:0:0-0:0:0",
"key": { "key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-key-nested.d2,3:0:26-3:6:32", "range": ",0:0:0-0:0:0",
"path": [ "path": [
{ {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-key-nested.d2,3:0:26-3:6:32", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "layers", "string": "layers"
"raw_string": "layers"
} }
] ]
} }
@ -391,21 +405,20 @@
"primary": {}, "primary": {},
"value": { "value": {
"map": { "map": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-key-nested.d2,3:8:34-7:1:55", "range": ",1:0:0-2:0:0",
"nodes": [ "nodes": [
{ {
"map_key": { "map_key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-key-nested.d2,4:2:38-6:3:53", "range": ",0:0:0-0:0:0",
"key": { "key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-key-nested.d2,4:2:38-4:3:39", "range": ",0:0:0-0:0:0",
"path": [ "path": [
{ {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-key-nested.d2,4:2:38-4:3:39", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "x", "string": "x"
"raw_string": "x"
} }
] ]
} }
@ -415,21 +428,20 @@
"primary": {}, "primary": {},
"value": { "value": {
"map": { "map": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-key-nested.d2,4:5:41-6:3:53", "range": ",1:0:0-2:0:0",
"nodes": [ "nodes": [
{ {
"map_key": { "map_key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-key-nested.d2,5:4:47-5:6:49", "range": ",0:0:0-0:0:0",
"key": { "key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-key-nested.d2,5:4:47-5:6:49", "range": ",0:0:0-0:0:0",
"path": [ "path": [
{ {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-key-nested.d2,5:4:47-5:6:49", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "yo", "string": "yo"
"raw_string": "yo"
} }
] ]
} }

View file

@ -420,29 +420,27 @@
"name": "cat", "name": "cat",
"isFolderOnly": false, "isFolderOnly": false,
"ast": { "ast": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,0:0:0-13:1:175", "range": ",0:0:0-1:0:0",
"nodes": [ "nodes": [
{ {
"map_key": { "map_key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,0:0:0-0:30:30", "range": ",0:0:0-0:0:0",
"key": { "key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,0:0:0-0:8:8", "range": ",0:0:0-0:0:0",
"path": [ "path": [
{ {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,0:0:0-0:8:8", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "question", "string": "question"
"raw_string": "question"
} }
] ]
} }
} }
] ]
}, },
"primary": {}, "primary": {
"value": {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,0:10:10-0:30:30", "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,0:10:10-0:30:30",
"value": [ "value": [
@ -452,41 +450,30 @@
} }
] ]
} }
}
}
}, },
"value": {
"map": {
"range": ",1:0:0-2:0:0",
"nodes": [
{ {
"map_key": { "map_key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,1:0:31-1:25:56", "range": ",0:0:0-0:0:0",
"key": { "key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,1:0:31-1:13:44", "range": ",0:0:0-0:0:0",
"path": [ "path": [
{ {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,1:0:31-1:8:39", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "question", "string": "link"
"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": {}, "primary": {
"value": {
"unquoted_string": { "unquoted_string": {
"range": ",0:0:0-0:0:0", "range": ",0:0:0-0:0:0",
"value": [ "value": [
@ -495,22 +482,27 @@
} }
] ]
} }
},
"value": {}
}
}
]
}
} }
} }
}, },
{ {
"map_key": { "map_key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,3:0:58-7:1:113", "range": ",0:0:0-0:0:0",
"key": { "key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,3:0:58-3:6:64", "range": ",0:0:0-0:0:0",
"path": [ "path": [
{ {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,3:0:58-3:6:64", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "layers", "string": "layers"
"raw_string": "layers"
} }
] ]
} }
@ -520,21 +512,20 @@
"primary": {}, "primary": {},
"value": { "value": {
"map": { "map": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,3:8:66-7:1:113", "range": ",1:0:0-2:0:0",
"nodes": [ "nodes": [
{ {
"map_key": { "map_key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,4:2:70-6:3:111", "range": ",0:0:0-0:0:0",
"key": { "key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,4:2:70-4:5:73", "range": ",0:0:0-0:0:0",
"path": [ "path": [
{ {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,4:2:70-4:5:73", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "cat", "string": "cat"
"raw_string": "cat"
} }
] ]
} }
@ -544,24 +535,67 @@
"primary": {}, "primary": {},
"value": { "value": {
"map": { "map": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,4:7:75-6:3:111", "range": ",1:0:0-2:0:0",
"nodes": [ "nodes": [
{ {
"map_key": { "map_key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,5:4:81-5:30:107", "range": ",0:0:0-0:0:0",
"key": {
"range": ",0:0:0-0:0:0",
"path": [
{
"unquoted_string": {
"range": ",0:0:0-0:0:0",
"value": [
{
"string": "the cat"
}
]
}
}
]
},
"primary": {},
"value": {}
}
},
{
"map_key": {
"range": ",0:0:0-0:0:0",
"key": {
"range": ",0:0:0-0:0:0",
"path": [
{
"unquoted_string": {
"range": ",0:0:0-0:0:0",
"value": [
{
"string": "meeeowwww"
}
]
}
}
]
},
"primary": {},
"value": {}
}
},
{
"map_key": {
"range": ",0:0:0-0:0:0",
"edges": [ "edges": [
{ {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,5:4:81-5:24:101", "range": ",0:0:0-0:0:0",
"src": { "src": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,5:4:81-5:11:88", "range": ",0:0:0-0:0:0",
"path": [ "path": [
{ {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,5:4:81-5:11:88", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "the cat", "string": "the cat"
"raw_string": "the cat"
} }
] ]
} }
@ -570,15 +604,14 @@
}, },
"src_arrow": "", "src_arrow": "",
"dst": { "dst": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,5:15:92-5:24:101", "range": ",0:0:0-0:0:0",
"path": [ "path": [
{ {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,5:15:92-5:24:101", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "meeeowwww", "string": "meeeowwww"
"raw_string": "meeeowwww"
} }
] ]
} }
@ -588,8 +621,7 @@
"dst_arrow": ">" "dst_arrow": ">"
} }
], ],
"primary": {}, "primary": {
"value": {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,5:26:103-5:30:107", "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,5:26:103-5:30:107",
"value": [ "value": [
@ -599,7 +631,8 @@
} }
] ]
} }
} },
"value": {}
} }
} }
] ]
@ -614,17 +647,16 @@
}, },
{ {
"map_key": { "map_key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,9:0:115-13:1:175", "range": ",0:0:0-0:0:0",
"key": { "key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,9:0:115-9:9:124", "range": ",0:0:0-0:0:0",
"path": [ "path": [
{ {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,9:0:115-9:9:124", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "scenarios", "string": "scenarios"
"raw_string": "scenarios"
} }
] ]
} }
@ -634,21 +666,20 @@
"primary": {}, "primary": {},
"value": { "value": {
"map": { "map": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,9:11:126-13:1:175", "range": ",1:0:0-2:0:0",
"nodes": [ "nodes": [
{ {
"map_key": { "map_key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,10:2:130-12:3:173", "range": ",0:0:0-0:0:0",
"key": { "key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,10:2:130-10:7:135", "range": ",0:0:0-0:0:0",
"path": [ "path": [
{ {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,10:2:130-10:7:135", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "green", "string": "green"
"raw_string": "green"
} }
] ]
} }
@ -658,43 +689,84 @@
"primary": {}, "primary": {},
"value": { "value": {
"map": { "map": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,10:9:137-12:3:173", "range": ",1:0:0-2:0:0",
"nodes": [ "nodes": [
{ {
"map_key": { "map_key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,11:4:143-11:30:169", "range": ",0:0:0-0:0:0",
"key": { "key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,11:4:143-11:23:162", "range": ",0:0:0-0:0:0",
"path": [ "path": [
{ {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,11:4:143-11:12:151", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "question", "string": "question"
"raw_string": "question" }
]
}
}
]
},
"primary": {
"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?"
} }
] ]
} }
}, },
"value": {
"map": {
"range": ",1:0:0-2:0:0",
"nodes": [
{
"map_key": {
"range": ",0:0:0-0:0:0",
"key": {
"range": ",0:0:0-0:0:0",
"path": [
{ {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,11:13:152-11:18:157", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "style", "string": "link"
"raw_string": "style" }
]
}
}
]
},
"primary": {
"unquoted_string": {
"range": ",0:0:0-0:0:0",
"value": [
{
"string": "root.layers.cat"
} }
] ]
} }
}, },
"value": {}
}
},
{
"map_key": {
"range": ",0:0:0-0:0:0",
"key": {
"range": ",0:0:0-0:0:0",
"path": [
{ {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,11:19:158-11:23:162", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "fill", "string": "style"
"raw_string": "fill"
} }
] ]
} }
@ -703,6 +775,28 @@
}, },
"primary": {}, "primary": {},
"value": { "value": {
"map": {
"range": ",1:0:0-2:0:0",
"nodes": [
{
"map_key": {
"range": ",0:0:0-0:0:0",
"key": {
"range": ",0:0:0-0:0:0",
"path": [
{
"unquoted_string": {
"range": ",0:0:0-0:0:0",
"value": [
{
"string": "fill"
}
]
}
}
]
},
"primary": {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,11:25:164-11:30:169", "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,11:25:164-11:30:169",
"value": [ "value": [
@ -712,6 +806,17 @@
} }
] ]
} }
},
"value": {}
}
}
]
}
}
}
}
]
}
} }
} }
} }
@ -881,29 +986,27 @@
"name": "green", "name": "green",
"isFolderOnly": false, "isFolderOnly": false,
"ast": { "ast": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,0:0:0-13:1:175", "range": ",0:0:0-1:0:0",
"nodes": [ "nodes": [
{ {
"map_key": { "map_key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,0:0:0-0:30:30", "range": ",0:0:0-0:0:0",
"key": { "key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,0:0:0-0:8:8", "range": ",0:0:0-0:0:0",
"path": [ "path": [
{ {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,0:0:0-0:8:8", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "question", "string": "question"
"raw_string": "question"
} }
] ]
} }
} }
] ]
}, },
"primary": {}, "primary": {
"value": {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,0:10:10-0:30:30", "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,0:10:10-0:30:30",
"value": [ "value": [
@ -913,41 +1016,30 @@
} }
] ]
} }
}
}
}, },
"value": {
"map": {
"range": ",1:0:0-2:0:0",
"nodes": [
{ {
"map_key": { "map_key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,1:0:31-1:25:56", "range": ",0:0:0-0:0:0",
"key": { "key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,1:0:31-1:13:44", "range": ",0:0:0-0:0:0",
"path": [ "path": [
{ {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,1:0:31-1:8:39", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "question", "string": "link"
"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": {}, "primary": {
"value": {
"unquoted_string": { "unquoted_string": {
"range": ",0:0:0-0:0:0", "range": ",0:0:0-0:0:0",
"value": [ "value": [
@ -956,22 +1048,27 @@
} }
] ]
} }
},
"value": {}
}
}
]
}
} }
} }
}, },
{ {
"map_key": { "map_key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,3:0:58-7:1:113", "range": ",0:0:0-0:0:0",
"key": { "key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,3:0:58-3:6:64", "range": ",0:0:0-0:0:0",
"path": [ "path": [
{ {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,3:0:58-3:6:64", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "layers", "string": "layers"
"raw_string": "layers"
} }
] ]
} }
@ -981,21 +1078,20 @@
"primary": {}, "primary": {},
"value": { "value": {
"map": { "map": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,3:8:66-7:1:113", "range": ",1:0:0-2:0:0",
"nodes": [ "nodes": [
{ {
"map_key": { "map_key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,4:2:70-6:3:111", "range": ",0:0:0-0:0:0",
"key": { "key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,4:2:70-4:5:73", "range": ",0:0:0-0:0:0",
"path": [ "path": [
{ {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,4:2:70-4:5:73", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "cat", "string": "cat"
"raw_string": "cat"
} }
] ]
} }
@ -1005,24 +1101,67 @@
"primary": {}, "primary": {},
"value": { "value": {
"map": { "map": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,4:7:75-6:3:111", "range": ",1:0:0-2:0:0",
"nodes": [ "nodes": [
{ {
"map_key": { "map_key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,5:4:81-5:30:107", "range": ",0:0:0-0:0:0",
"key": {
"range": ",0:0:0-0:0:0",
"path": [
{
"unquoted_string": {
"range": ",0:0:0-0:0:0",
"value": [
{
"string": "the cat"
}
]
}
}
]
},
"primary": {},
"value": {}
}
},
{
"map_key": {
"range": ",0:0:0-0:0:0",
"key": {
"range": ",0:0:0-0:0:0",
"path": [
{
"unquoted_string": {
"range": ",0:0:0-0:0:0",
"value": [
{
"string": "meeeowwww"
}
]
}
}
]
},
"primary": {},
"value": {}
}
},
{
"map_key": {
"range": ",0:0:0-0:0:0",
"edges": [ "edges": [
{ {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,5:4:81-5:24:101", "range": ",0:0:0-0:0:0",
"src": { "src": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,5:4:81-5:11:88", "range": ",0:0:0-0:0:0",
"path": [ "path": [
{ {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,5:4:81-5:11:88", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "the cat", "string": "the cat"
"raw_string": "the cat"
} }
] ]
} }
@ -1031,15 +1170,14 @@
}, },
"src_arrow": "", "src_arrow": "",
"dst": { "dst": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,5:15:92-5:24:101", "range": ",0:0:0-0:0:0",
"path": [ "path": [
{ {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,5:15:92-5:24:101", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "meeeowwww", "string": "meeeowwww"
"raw_string": "meeeowwww"
} }
] ]
} }
@ -1049,8 +1187,7 @@
"dst_arrow": ">" "dst_arrow": ">"
} }
], ],
"primary": {}, "primary": {
"value": {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,5:26:103-5:30:107", "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,5:26:103-5:30:107",
"value": [ "value": [
@ -1060,7 +1197,8 @@
} }
] ]
} }
} },
"value": {}
} }
} }
] ]
@ -1075,17 +1213,16 @@
}, },
{ {
"map_key": { "map_key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,9:0:115-13:1:175", "range": ",0:0:0-0:0:0",
"key": { "key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,9:0:115-9:9:124", "range": ",0:0:0-0:0:0",
"path": [ "path": [
{ {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,9:0:115-9:9:124", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "scenarios", "string": "scenarios"
"raw_string": "scenarios"
} }
] ]
} }
@ -1095,21 +1232,20 @@
"primary": {}, "primary": {},
"value": { "value": {
"map": { "map": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,9:11:126-13:1:175", "range": ",1:0:0-2:0:0",
"nodes": [ "nodes": [
{ {
"map_key": { "map_key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,10:2:130-12:3:173", "range": ",0:0:0-0:0:0",
"key": { "key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,10:2:130-10:7:135", "range": ",0:0:0-0:0:0",
"path": [ "path": [
{ {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,10:2:130-10:7:135", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "green", "string": "green"
"raw_string": "green"
} }
] ]
} }
@ -1119,43 +1255,84 @@
"primary": {}, "primary": {},
"value": { "value": {
"map": { "map": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,10:9:137-12:3:173", "range": ",1:0:0-2:0:0",
"nodes": [ "nodes": [
{ {
"map_key": { "map_key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,11:4:143-11:30:169", "range": ",0:0:0-0:0:0",
"key": { "key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,11:4:143-11:23:162", "range": ",0:0:0-0:0:0",
"path": [ "path": [
{ {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,11:4:143-11:12:151", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "question", "string": "question"
"raw_string": "question" }
]
}
}
]
},
"primary": {
"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?"
} }
] ]
} }
}, },
"value": {
"map": {
"range": ",1:0:0-2:0:0",
"nodes": [
{
"map_key": {
"range": ",0:0:0-0:0:0",
"key": {
"range": ",0:0:0-0:0:0",
"path": [
{ {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,11:13:152-11:18:157", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "style", "string": "link"
"raw_string": "style" }
]
}
}
]
},
"primary": {
"unquoted_string": {
"range": ",0:0:0-0:0:0",
"value": [
{
"string": "root.layers.cat"
} }
] ]
} }
}, },
"value": {}
}
},
{
"map_key": {
"range": ",0:0:0-0:0:0",
"key": {
"range": ",0:0:0-0:0:0",
"path": [
{ {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,11:19:158-11:23:162", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "fill", "string": "style"
"raw_string": "fill"
} }
] ]
} }
@ -1164,6 +1341,28 @@
}, },
"primary": {}, "primary": {},
"value": { "value": {
"map": {
"range": ",1:0:0-2:0:0",
"nodes": [
{
"map_key": {
"range": ",0:0:0-0:0:0",
"key": {
"range": ",0:0:0-0:0:0",
"path": [
{
"unquoted_string": {
"range": ",0:0:0-0:0:0",
"value": [
{
"string": "fill"
}
]
}
}
]
},
"primary": {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,11:25:164-11:30:169", "range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,11:25:164-11:30:169",
"value": [ "value": [
@ -1173,6 +1372,17 @@
} }
] ]
} }
},
"value": {}
}
}
]
}
}
}
}
]
}
} }
} }
} }

View file

@ -279,32 +279,20 @@
"name": "x", "name": "x",
"isFolderOnly": true, "isFolderOnly": true,
"ast": { "ast": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,0:0:0-9:1:101", "range": ",0:0:0-1:0:0",
"nodes": [ "nodes": [
{ {
"map_key": { "map_key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,0:0:0-0:25:25", "range": ",0:0:0-0:0:0",
"key": { "key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,0:0:0-0:6:6", "range": ",0:0:0-0:0:0",
"path": [ "path": [
{ {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,0:0:0-0:1:1", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "x", "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"
} }
] ]
} }
@ -313,6 +301,28 @@
}, },
"primary": {}, "primary": {},
"value": { "value": {
"map": {
"range": ",1:0:0-2:0:0",
"nodes": [
{
"map_key": {
"range": ",0:0:0-0:0:0",
"key": {
"range": ",0:0:0-0:0:0",
"path": [
{
"unquoted_string": {
"range": ",0:0:0-0:0:0",
"value": [
{
"string": "link"
}
]
}
}
]
},
"primary": {
"unquoted_string": { "unquoted_string": {
"range": ",0:0:0-0:0:0", "range": ",0:0:0-0:0:0",
"value": [ "value": [
@ -321,22 +331,27 @@
} }
] ]
} }
},
"value": {}
}
}
]
}
} }
} }
}, },
{ {
"map_key": { "map_key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,1:0:26-9:1:101", "range": ",0:0:0-0:0:0",
"key": { "key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,1:0:26-1:6:32", "range": ",0:0:0-0:0:0",
"path": [ "path": [
{ {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,1:0:26-1:6:32", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "layers", "string": "layers"
"raw_string": "layers"
} }
] ]
} }
@ -346,21 +361,20 @@
"primary": {}, "primary": {},
"value": { "value": {
"map": { "map": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,1:8:34-9:1:101", "range": ",1:0:0-2:0:0",
"nodes": [ "nodes": [
{ {
"map_key": { "map_key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,2:2:38-8:3:99", "range": ",0:0:0-0:0:0",
"key": { "key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,2:2:38-2:3:39", "range": ",0:0:0-0:0:0",
"path": [ "path": [
{ {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,2:2:38-2:3:39", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "x", "string": "x"
"raw_string": "x"
} }
] ]
} }
@ -370,21 +384,20 @@
"primary": {}, "primary": {},
"value": { "value": {
"map": { "map": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,2:5:41-8:3:99", "range": ",1:0:0-2:0:0",
"nodes": [ "nodes": [
{ {
"map_key": { "map_key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,3:4:47-7:5:95", "range": ",0:0:0-0:0:0",
"key": { "key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,3:4:47-3:10:53", "range": ",0:0:0-0:0:0",
"path": [ "path": [
{ {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,3:4:47-3:10:53", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "layers", "string": "layers"
"raw_string": "layers"
} }
] ]
} }
@ -394,21 +407,20 @@
"primary": {}, "primary": {},
"value": { "value": {
"map": { "map": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,3:12:55-7:5:95", "range": ",1:0:0-2:0:0",
"nodes": [ "nodes": [
{ {
"map_key": { "map_key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,4:6:63-6:7:89", "range": ",0:0:0-0:0:0",
"key": { "key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,4:6:63-4:7:64", "range": ",0:0:0-0:0:0",
"path": [ "path": [
{ {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,4:6:63-4:7:64", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "x", "string": "x"
"raw_string": "x"
} }
] ]
} }
@ -418,21 +430,20 @@
"primary": {}, "primary": {},
"value": { "value": {
"map": { "map": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,4:9:66-6:7:89", "range": ",1:0:0-2:0:0",
"nodes": [ "nodes": [
{ {
"map_key": { "map_key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,5:8:76-5:13:81", "range": ",0:0:0-0:0:0",
"key": { "key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,5:8:76-5:13:81", "range": ",0:0:0-0:0:0",
"path": [ "path": [
{ {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,5:8:76-5:13:81", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "hello", "string": "hello"
"raw_string": "hello"
} }
] ]
} }
@ -495,64 +506,20 @@
"name": "x", "name": "x",
"isFolderOnly": false, "isFolderOnly": false,
"ast": { "ast": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,0:0:0-9:1:101", "range": ",0:0:0-1:0:0",
"nodes": [ "nodes": [
{ {
"map_key": { "map_key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,0:0:0-0:25:25", "range": ",0:0:0-0:0:0",
"key": { "key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,0:0:0-0:6:6", "range": ",0:0:0-0:0:0",
"path": [ "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": { "unquoted_string": {
"range": ",0:0:0-0:0:0", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "root.layers.x.layers.x" "string": "layers"
}
]
}
}
}
},
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,1:0:26-9:1:101",
"key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,1:0:26-1:6:32",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,1:0:26-1:6:32",
"value": [
{
"string": "layers",
"raw_string": "layers"
} }
] ]
} }
@ -562,21 +529,20 @@
"primary": {}, "primary": {},
"value": { "value": {
"map": { "map": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,1:8:34-9:1:101", "range": ",1:0:0-2:0:0",
"nodes": [ "nodes": [
{ {
"map_key": { "map_key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,2:2:38-8:3:99", "range": ",0:0:0-0:0:0",
"key": { "key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,2:2:38-2:3:39", "range": ",0:0:0-0:0:0",
"path": [ "path": [
{ {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,2:2:38-2:3:39", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "x", "string": "x"
"raw_string": "x"
} }
] ]
} }
@ -586,69 +552,20 @@
"primary": {}, "primary": {},
"value": { "value": {
"map": { "map": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,2:5:41-8:3:99", "range": ",1:0:0-2:0:0",
"nodes": [ "nodes": [
{ {
"map_key": { "map_key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,3:4:47-7:5:95", "range": ",0:0:0-0:0:0",
"key": { "key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,3:4:47-3:10:53", "range": ",0:0:0-0:0:0",
"path": [ "path": [
{ {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,3:4:47-3:10:53", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "layers", "string": "hello"
"raw_string": "layers"
}
]
}
}
]
},
"primary": {},
"value": {
"map": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,3:12:55-7:5:95",
"nodes": [
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,4:6:63-6:7:89",
"key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,4:6:63-4:7:64",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,4:6:63-4:7:64",
"value": [
{
"string": "x",
"raw_string": "x"
}
]
}
}
]
},
"primary": {},
"value": {
"map": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,4:9:66-6:7:89",
"nodes": [
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,5:8:76-5:13:81",
"key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,5:8:76-5:13:81",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-nested.d2,5:8:76-5:13:81",
"value": [
{
"string": "hello",
"raw_string": "hello"
} }
] ]
} }
@ -670,16 +587,6 @@
} }
} }
] ]
}
}
}
}
]
}
}
}
}
]
}, },
"root": { "root": {
"id": "", "id": "",

View file

@ -221,32 +221,20 @@
"name": "x", "name": "x",
"isFolderOnly": false, "isFolderOnly": false,
"ast": { "ast": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-ok.d2,0:0:0-5:1:42", "range": ",0:0:0-1:0:0",
"nodes": [ "nodes": [
{ {
"map_key": { "map_key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-ok.d2,0:0:0-0:16:16", "range": ",0:0:0-0:0:0",
"key": { "key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-ok.d2,0:0:0-0:6:6", "range": ",0:0:0-0:0:0",
"path": [ "path": [
{ {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-ok.d2,0:0:0-0:1:1", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "x", "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"
} }
] ]
} }
@ -255,6 +243,28 @@
}, },
"primary": {}, "primary": {},
"value": { "value": {
"map": {
"range": ",1:0:0-2:0:0",
"nodes": [
{
"map_key": {
"range": ",0:0:0-0:0:0",
"key": {
"range": ",0:0:0-0:0:0",
"path": [
{
"unquoted_string": {
"range": ",0:0:0-0:0:0",
"value": [
{
"string": "link"
}
]
}
}
]
},
"primary": {
"unquoted_string": { "unquoted_string": {
"range": ",0:0:0-0:0:0", "range": ",0:0:0-0:0:0",
"value": [ "value": [
@ -263,22 +273,27 @@
} }
] ]
} }
},
"value": {}
}
}
]
}
} }
} }
}, },
{ {
"map_key": { "map_key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-ok.d2,1:0:17-5:1:42", "range": ",0:0:0-0:0:0",
"key": { "key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-ok.d2,1:0:17-1:6:23", "range": ",0:0:0-0:0:0",
"path": [ "path": [
{ {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-ok.d2,1:0:17-1:6:23", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "layers", "string": "layers"
"raw_string": "layers"
} }
] ]
} }
@ -288,21 +303,20 @@
"primary": {}, "primary": {},
"value": { "value": {
"map": { "map": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-ok.d2,1:8:25-5:1:42", "range": ",1:0:0-2:0:0",
"nodes": [ "nodes": [
{ {
"map_key": { "map_key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-ok.d2,2:1:28-4:2:40", "range": ",0:0:0-0:0:0",
"key": { "key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-ok.d2,2:1:28-2:2:29", "range": ",0:0:0-0:0:0",
"path": [ "path": [
{ {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-ok.d2,2:1:28-2:2:29", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "x", "string": "x"
"raw_string": "x"
} }
] ]
} }
@ -312,21 +326,20 @@
"primary": {}, "primary": {},
"value": { "value": {
"map": { "map": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-ok.d2,2:4:31-4:2:40", "range": ",1:0:0-2:0:0",
"nodes": [ "nodes": [
{ {
"map_key": { "map_key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-ok.d2,3:3:36-3:4:37", "range": ",0:0:0-0:0:0",
"key": { "key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-ok.d2,3:3:36-3:4:37", "range": ",0:0:0-0:0:0",
"path": [ "path": [
{ {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-ok.d2,3:3:36-3:4:37", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "y", "string": "y"
"raw_string": "y"
} }
] ]
} }

View file

@ -331,21 +331,20 @@
"name": "x", "name": "x",
"isFolderOnly": false, "isFolderOnly": false,
"ast": { "ast": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,0:0:0-11:1:121", "range": ",0:0:0-1:0:0",
"nodes": [ "nodes": [
{ {
"map_key": { "map_key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,0:0:0-0:1:1", "range": ",0:0:0-0:0:0",
"key": { "key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,0:0:0-0:1:1", "range": ",0:0:0-0:0:0",
"path": [ "path": [
{ {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,0:0:0-0:1:1", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "x", "string": "x"
"raw_string": "x"
} }
] ]
} }
@ -358,17 +357,16 @@
}, },
{ {
"map_key": { "map_key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,1:0:2-11:1:121", "range": ",0:0:0-0:0:0",
"key": { "key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,1:0:2-1:6:8", "range": ",0:0:0-0:0:0",
"path": [ "path": [
{ {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,1:0:2-1:6:8", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "layers", "string": "layers"
"raw_string": "layers"
} }
] ]
} }
@ -378,21 +376,20 @@
"primary": {}, "primary": {},
"value": { "value": {
"map": { "map": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,1:8:10-11:1:121", "range": ",1:0:0-2:0:0",
"nodes": [ "nodes": [
{ {
"map_key": { "map_key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,2:1:13-10:3:119", "range": ",0:0:0-0:0:0",
"key": { "key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,2:1:13-2:2:14", "range": ",0:0:0-0:0:0",
"path": [ "path": [
{ {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,2:1:13-2:2:14", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "x", "string": "x"
"raw_string": "x"
} }
] ]
} }
@ -402,21 +399,20 @@
"primary": {}, "primary": {},
"value": { "value": {
"map": { "map": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,2:4:16-10:3:119", "range": ",1:0:0-2:0:0",
"nodes": [ "nodes": [
{ {
"map_key": { "map_key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,3:3:21-3:5:23", "range": ",0:0:0-0:0:0",
"key": { "key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,3:3:21-3:5:23", "range": ",0:0:0-0:0:0",
"path": [ "path": [
{ {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,3:3:21-3:5:23", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "yo", "string": "yo"
"raw_string": "yo"
} }
] ]
} }
@ -429,17 +425,16 @@
}, },
{ {
"map_key": { "map_key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,4:4:28-9:5:115", "range": ",0:0:0-0:0:0",
"key": { "key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,4:4:28-4:10:34", "range": ",0:0:0-0:0:0",
"path": [ "path": [
{ {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,4:4:28-4:10:34", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "layers", "string": "layers"
"raw_string": "layers"
} }
] ]
} }
@ -449,21 +444,20 @@
"primary": {}, "primary": {},
"value": { "value": {
"map": { "map": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,4:12:36-9:5:115", "range": ",1:0:0-2:0:0",
"nodes": [ "nodes": [
{ {
"map_key": { "map_key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,5:6:44-8:7:109", "range": ",0:0:0-0:0:0",
"key": { "key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,5:6:44-5:7:45", "range": ",0:0:0-0:0:0",
"path": [ "path": [
{ {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,5:6:44-5:7:45", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "x", "string": "x"
"raw_string": "x"
} }
] ]
} }
@ -473,32 +467,20 @@
"primary": {}, "primary": {},
"value": { "value": {
"map": { "map": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,5:9:47-8:7:109", "range": ",1:0:0-2:0:0",
"nodes": [ "nodes": [
{ {
"map_key": { "map_key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,6:8:57-6:32:81", "range": ",0:0:0-0:0:0",
"key": { "key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,6:8:57-6:18:67", "range": ",0:0:0-0:0:0",
"path": [ "path": [
{ {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,6:8:57-6:13:62", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "hello", "string": "hello"
"raw_string": "hello"
}
]
}
},
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,6:14:63-6:18:67",
"value": [
{
"string": "link",
"raw_string": "link"
} }
] ]
} }
@ -507,6 +489,28 @@
}, },
"primary": {}, "primary": {},
"value": { "value": {
"map": {
"range": ",1:0:0-2:0:0",
"nodes": [
{
"map_key": {
"range": ",0:0:0-0:0:0",
"key": {
"range": ",0:0:0-0:0:0",
"path": [
{
"unquoted_string": {
"range": ",0:0:0-0:0:0",
"value": [
{
"string": "link"
}
]
}
}
]
},
"primary": {
"unquoted_string": { "unquoted_string": {
"range": ",0:0:0-0:0:0", "range": ",0:0:0-0:0:0",
"value": [ "value": [
@ -515,33 +519,27 @@
} }
] ]
} }
},
"value": {}
}
}
]
}
} }
} }
}, },
{ {
"map_key": { "map_key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,7:8:90-7:19:101", "range": ",0:0:0-0:0:0",
"key": { "key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,7:8:90-7:16:98", "range": ",0:0:0-0:0:0",
"path": [ "path": [
{ {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,7:8:90-7:11:93", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "hey", "string": "hey"
"raw_string": "hey"
}
]
}
},
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,7:12:94-7:16:98",
"value": [
{
"string": "link",
"raw_string": "link"
} }
] ]
} }
@ -550,6 +548,28 @@
}, },
"primary": {}, "primary": {},
"value": { "value": {
"map": {
"range": ",1:0:0-2:0:0",
"nodes": [
{
"map_key": {
"range": ",0:0:0-0:0:0",
"key": {
"range": ",0:0:0-0:0:0",
"path": [
{
"unquoted_string": {
"range": ",0:0:0-0:0:0",
"value": [
{
"string": "link"
}
]
}
}
]
},
"primary": {
"unquoted_string": { "unquoted_string": {
"range": ",0:0:0-0:0:0", "range": ",0:0:0-0:0:0",
"value": [ "value": [
@ -558,6 +578,12 @@
} }
] ]
} }
},
"value": {}
}
}
]
}
} }
} }
} }
@ -659,21 +685,20 @@
"name": "x", "name": "x",
"isFolderOnly": false, "isFolderOnly": false,
"ast": { "ast": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,0:0:0-11:1:121", "range": ",0:0:0-1:0:0",
"nodes": [ "nodes": [
{ {
"map_key": { "map_key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,0:0:0-0:1:1", "range": ",0:0:0-0:0:0",
"key": { "key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,0:0:0-0:1:1", "range": ",0:0:0-0:0:0",
"path": [ "path": [
{ {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,0:0:0-0:1:1", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "x", "string": "yo"
"raw_string": "x"
} }
] ]
} }
@ -686,17 +711,16 @@
}, },
{ {
"map_key": { "map_key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,1:0:2-11:1:121", "range": ",0:0:0-0:0:0",
"key": { "key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,1:0:2-1:6:8", "range": ",0:0:0-0:0:0",
"path": [ "path": [
{ {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,1:0:2-1:6:8", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "layers", "string": "layers"
"raw_string": "layers"
} }
] ]
} }
@ -706,21 +730,20 @@
"primary": {}, "primary": {},
"value": { "value": {
"map": { "map": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,1:8:10-11:1:121", "range": ",1:0:0-2:0:0",
"nodes": [ "nodes": [
{ {
"map_key": { "map_key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,2:1:13-10:3:119", "range": ",0:0:0-0:0:0",
"key": { "key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,2:1:13-2:2:14", "range": ",0:0:0-0:0:0",
"path": [ "path": [
{ {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,2:1:13-2:2:14", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "x", "string": "x"
"raw_string": "x"
} }
] ]
} }
@ -730,21 +753,20 @@
"primary": {}, "primary": {},
"value": { "value": {
"map": { "map": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,2:4:16-10:3:119", "range": ",1:0:0-2:0:0",
"nodes": [ "nodes": [
{ {
"map_key": { "map_key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,3:3:21-3:5:23", "range": ",0:0:0-0:0:0",
"key": { "key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,3:3:21-3:5:23", "range": ",0:0:0-0:0:0",
"path": [ "path": [
{ {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,3:3:21-3:5:23", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "yo", "string": "hello"
"raw_string": "yo"
} }
] ]
} }
@ -752,22 +774,58 @@
] ]
}, },
"primary": {}, "primary": {},
"value": {
"map": {
"range": ",1:0:0-2:0:0",
"nodes": [
{
"map_key": {
"range": ",0:0:0-0:0:0",
"key": {
"range": ",0:0:0-0:0:0",
"path": [
{
"unquoted_string": {
"range": ",0:0:0-0:0:0",
"value": [
{
"string": "link"
}
]
}
}
]
},
"primary": {
"unquoted_string": {
"range": ",0:0:0-0:0:0",
"value": [
{
"string": "root.layers.x"
}
]
}
},
"value": {} "value": {}
} }
}
]
}
}
}
}, },
{ {
"map_key": { "map_key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,4:4:28-9:5:115", "range": ",0:0:0-0:0:0",
"key": { "key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,4:4:28-4:10:34", "range": ",0:0:0-0:0:0",
"path": [ "path": [
{ {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,4:4:28-4:10:34", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "layers", "string": "hey"
"raw_string": "layers"
} }
] ]
} }
@ -777,64 +835,27 @@
"primary": {}, "primary": {},
"value": { "value": {
"map": { "map": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,4:12:36-9:5:115", "range": ",1:0:0-2:0:0",
"nodes": [ "nodes": [
{ {
"map_key": { "map_key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,5:6:44-8:7:109", "range": ",0:0:0-0:0:0",
"key": { "key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,5:6:44-5:7:45", "range": ",0:0:0-0:0:0",
"path": [ "path": [
{ {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,5:6:44-5:7:45", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "x", "string": "link"
"raw_string": "x"
} }
] ]
} }
} }
] ]
}, },
"primary": {}, "primary": {
"value": {
"map": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,5:9:47-8:7:109",
"nodes": [
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,6:8:57-6:32:81",
"key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,6:8:57-6:18:67",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,6:8:57-6:13:62",
"value": [
{
"string": "hello",
"raw_string": "hello"
}
]
}
},
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,6:14:63-6:18:67",
"value": [
{
"string": "link",
"raw_string": "link"
}
]
}
}
]
},
"primary": {},
"value": {
"unquoted_string": { "unquoted_string": {
"range": ",0:0:0-0:0:0", "range": ",0:0:0-0:0:0",
"value": [ "value": [
@ -843,55 +864,8 @@
} }
] ]
} }
}
}
}, },
{ "value": {}
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,7:8:90-7:19:101",
"key": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,7:8:90-7:16:98",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,7:8:90-7:11:93",
"value": [
{
"string": "hey",
"raw_string": "hey"
}
]
}
},
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/link-board-underscore.d2,7:12:94-7:16:98",
"value": [
{
"string": "link",
"raw_string": "link"
}
]
}
}
]
},
"primary": {},
"value": {
"unquoted_string": {
"range": ",0:0:0-0:0:0",
"value": [
{
"string": "root.layers.x"
}
]
}
}
}
}
]
}
}
} }
} }
] ]

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -239,21 +239,20 @@
"name": "one", "name": "one",
"isFolderOnly": false, "isFolderOnly": false,
"ast": { "ast": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,0:0:0-10:0:65", "range": ",0:0:0-1:0:0",
"nodes": [ "nodes": [
{ {
"map_key": { "map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,0:0:0-0:4:4", "range": ",0:0:0-0:0:0",
"key": { "key": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,0:0:0-0:4:4", "range": ",0:0:0-0:0:0",
"path": [ "path": [
{ {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,0:0:0-0:4:4", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "base", "string": "base"
"raw_string": "base"
} }
] ]
} }
@ -266,17 +265,16 @@
}, },
{ {
"map_key": { "map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,2:0:6-9:1:64", "range": ",0:0:0-0:0:0",
"key": { "key": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,2:0:6-2:6:12", "range": ",0:0:0-0:0:0",
"path": [ "path": [
{ {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,2:0:6-2:6:12", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "layers", "string": "layers"
"raw_string": "layers"
} }
] ]
} }
@ -286,21 +284,20 @@
"primary": {}, "primary": {},
"value": { "value": {
"map": { "map": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,2:8:14-9:1:64", "range": ",1:0:0-2:0:0",
"nodes": [ "nodes": [
{ {
"map_key": { "map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,3:2:18-5:3:38", "range": ",0:0:0-0:0:0",
"key": { "key": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,3:2:18-3:5:21", "range": ",0:0:0-0:0:0",
"path": [ "path": [
{ {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,3:2:18-3:5:21", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "one", "string": "one"
"raw_string": "one"
} }
] ]
} }
@ -310,21 +307,20 @@
"primary": {}, "primary": {},
"value": { "value": {
"map": { "map": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,3:7:23-5:3:38", "range": ",1:0:0-2:0:0",
"nodes": [ "nodes": [
{ {
"map_key": { "map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,4:4:29-4:9:34", "range": ",0:0:0-0:0:0",
"key": { "key": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,4:4:29-4:9:34", "range": ",0:0:0-0:0:0",
"path": [ "path": [
{ {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,4:4:29-4:9:34", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "santa", "string": "santa"
"raw_string": "santa"
} }
] ]
} }
@ -342,17 +338,16 @@
}, },
{ {
"map_key": { "map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,6:2:41-8:3:62", "range": ",0:0:0-0:0:0",
"key": { "key": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,6:2:41-6:5:44", "range": ",0:0:0-0:0:0",
"path": [ "path": [
{ {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,6:2:41-6:5:44", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "two", "string": "two"
"raw_string": "two"
} }
] ]
} }
@ -362,21 +357,20 @@
"primary": {}, "primary": {},
"value": { "value": {
"map": { "map": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,6:7:46-8:3:62", "range": ",1:0:0-2:0:0",
"nodes": [ "nodes": [
{ {
"map_key": { "map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,7:4:52-7:10:58", "range": ",0:0:0-0:0:0",
"key": { "key": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,7:4:52-7:10:58", "range": ",0:0:0-0:0:0",
"path": [ "path": [
{ {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,7:4:52-7:10:58", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "clause", "string": "clause"
"raw_string": "clause"
} }
] ]
} }
@ -475,21 +469,20 @@
"name": "two", "name": "two",
"isFolderOnly": false, "isFolderOnly": false,
"ast": { "ast": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,0:0:0-10:0:65", "range": ",0:0:0-1:0:0",
"nodes": [ "nodes": [
{ {
"map_key": { "map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,0:0:0-0:4:4", "range": ",0:0:0-0:0:0",
"key": { "key": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,0:0:0-0:4:4", "range": ",0:0:0-0:0:0",
"path": [ "path": [
{ {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,0:0:0-0:4:4", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "base", "string": "base"
"raw_string": "base"
} }
] ]
} }
@ -502,17 +495,16 @@
}, },
{ {
"map_key": { "map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,2:0:6-9:1:64", "range": ",0:0:0-0:0:0",
"key": { "key": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,2:0:6-2:6:12", "range": ",0:0:0-0:0:0",
"path": [ "path": [
{ {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,2:0:6-2:6:12", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "layers", "string": "layers"
"raw_string": "layers"
} }
] ]
} }
@ -522,21 +514,20 @@
"primary": {}, "primary": {},
"value": { "value": {
"map": { "map": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,2:8:14-9:1:64", "range": ",1:0:0-2:0:0",
"nodes": [ "nodes": [
{ {
"map_key": { "map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,3:2:18-5:3:38", "range": ",0:0:0-0:0:0",
"key": { "key": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,3:2:18-3:5:21", "range": ",0:0:0-0:0:0",
"path": [ "path": [
{ {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,3:2:18-3:5:21", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "one", "string": "one"
"raw_string": "one"
} }
] ]
} }
@ -546,21 +537,20 @@
"primary": {}, "primary": {},
"value": { "value": {
"map": { "map": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,3:7:23-5:3:38", "range": ",1:0:0-2:0:0",
"nodes": [ "nodes": [
{ {
"map_key": { "map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,4:4:29-4:9:34", "range": ",0:0:0-0:0:0",
"key": { "key": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,4:4:29-4:9:34", "range": ",0:0:0-0:0:0",
"path": [ "path": [
{ {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,4:4:29-4:9:34", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "santa", "string": "santa"
"raw_string": "santa"
} }
] ]
} }
@ -578,17 +568,16 @@
}, },
{ {
"map_key": { "map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,6:2:41-8:3:62", "range": ",0:0:0-0:0:0",
"key": { "key": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,6:2:41-6:5:44", "range": ",0:0:0-0:0:0",
"path": [ "path": [
{ {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,6:2:41-6:5:44", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "two", "string": "two"
"raw_string": "two"
} }
] ]
} }
@ -598,21 +587,20 @@
"primary": {}, "primary": {},
"value": { "value": {
"map": { "map": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,6:7:46-8:3:62", "range": ",1:0:0-2:0:0",
"nodes": [ "nodes": [
{ {
"map_key": { "map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,7:4:52-7:10:58", "range": ",0:0:0-0:0:0",
"key": { "key": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,7:4:52-7:10:58", "range": ",0:0:0-0:0:0",
"path": [ "path": [
{ {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,7:4:52-7:10:58", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "clause", "string": "clause"
"raw_string": "clause"
} }
] ]
} }

View file

@ -347,24 +347,157 @@
"name": "1", "name": "1",
"isFolderOnly": false, "isFolderOnly": false,
"ast": { "ast": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/scenarios_edge_index.d2,0:0:0-7:0:69", "range": ",0:0:0-1:0:0",
"nodes": [ "nodes": [
{ {
"map_key": { "map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/scenarios_edge_index.d2,0:0:0-0:6:6", "range": ",0:0:0-0:0:0",
"edges": [ "key": {
{ "range": ",0:0:0-0:0:0",
"range": "d2/testdata/d2compiler/TestCompile2/boards/scenarios_edge_index.d2,0:0:0-0:6:6",
"src": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/scenarios_edge_index.d2,0:0:0-0:1:1",
"path": [ "path": [
{ {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/scenarios_edge_index.d2,0:0:0-0:1:1", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "a", "string": "a"
"raw_string": "a" }
]
}
}
]
},
"primary": {},
"value": {}
}
},
{
"map_key": {
"range": ",0:0:0-0:0:0",
"key": {
"range": ",0:0:0-0:0:0",
"path": [
{
"unquoted_string": {
"range": ",0:0:0-0:0:0",
"value": [
{
"string": "x"
}
]
}
}
]
},
"primary": {},
"value": {}
}
},
{
"map_key": {
"range": ",0:0:0-0:0:0",
"key": {
"range": ",0:0:0-0:0:0",
"path": [
{
"unquoted_string": {
"range": ",0:0:0-0:0:0",
"value": [
{
"string": "scenarios"
}
]
}
}
]
},
"primary": {},
"value": {
"map": {
"range": ",1:0:0-2:0:0",
"nodes": [
{
"map_key": {
"range": ",0:0:0-0:0:0",
"key": {
"range": ",0:0:0-0:0:0",
"path": [
{
"unquoted_string": {
"range": ",0:0:0-0:0:0",
"value": [
{
"string": "1"
}
]
}
}
]
},
"primary": {},
"value": {
"map": {
"range": ",1:0:0-2:0:0",
"nodes": [
{
"map_key": {
"range": ",0:0:0-0:0:0",
"key": {
"range": ",0:0:0-0:0:0",
"path": [
{
"unquoted_string": {
"range": ",0:0:0-0:0:0",
"value": [
{
"string": "a"
}
]
}
}
]
},
"primary": {},
"value": {}
}
},
{
"map_key": {
"range": ",0:0:0-0:0:0",
"key": {
"range": ",0:0:0-0:0:0",
"path": [
{
"unquoted_string": {
"range": ",0:0:0-0:0:0",
"value": [
{
"string": "x"
}
]
}
}
]
},
"primary": {},
"value": {}
}
},
{
"map_key": {
"range": ",0:0:0-0:0:0",
"edges": [
{
"range": ",0:0:0-0:0:0",
"src": {
"range": ",0:0:0-0:0:0",
"path": [
{
"unquoted_string": {
"range": ",0:0:0-0:0:0",
"value": [
{
"string": "a"
} }
] ]
} }
@ -373,15 +506,130 @@
}, },
"src_arrow": "", "src_arrow": "",
"dst": { "dst": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/scenarios_edge_index.d2,0:5:5-0:6:6", "range": ",0:0:0-0:0:0",
"path": [ "path": [
{ {
"unquoted_string": { "unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/scenarios_edge_index.d2,0:5:5-0:6:6", "range": ",0:0:0-0:0:0",
"value": [ "value": [
{ {
"string": "x", "string": "x"
"raw_string": "x" }
]
}
}
]
},
"dst_arrow": ">"
}
],
"primary": {},
"value": {
"map": {
"range": ",1:0:0-2:0:0",
"nodes": [
{
"map_key": {
"range": ",0:0:0-0:0:0",
"key": {
"range": ",0:0:0-0:0:0",
"path": [
{
"unquoted_string": {
"range": ",0:0:0-0:0:0",
"value": [
{
"string": "style"
}
]
}
}
]
},
"primary": {},
"value": {
"map": {
"range": ",1:0:0-2:0:0",
"nodes": [
{
"map_key": {
"range": ",0:0:0-0:0:0",
"key": {
"range": ",0:0:0-0:0:0",
"path": [
{
"unquoted_string": {
"range": ",0:0:0-0:0:0",
"value": [
{
"string": "opacity"
}
]
}
}
]
},
"primary": {
"number": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/scenarios_edge_index.d2,4:31:59-4:34:62",
"raw": "0.1",
"value": "1/10"
}
},
"value": {}
}
}
]
}
}
}
}
]
}
}
}
}
]
}
}
}
}
]
}
}
}
},
{
"map_key": {
"range": ",0:0:0-0:0:0",
"edges": [
{
"range": ",0:0:0-0:0:0",
"src": {
"range": ",0:0:0-0:0:0",
"path": [
{
"unquoted_string": {
"range": ",0:0:0-0:0:0",
"value": [
{
"string": "a"
}
]
}
}
]
},
"src_arrow": "",
"dst": {
"range": ",0:0:0-0:0:0",
"path": [
{
"unquoted_string": {
"range": ",0:0:0-0:0:0",
"value": [
{
"string": "x"
} }
] ]
} }
@ -394,148 +642,6 @@
"primary": {}, "primary": {},
"value": {} "value": {}
} }
},
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/scenarios_edge_index.d2,2:0:8-6:1:68",
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/scenarios_edge_index.d2,2:0:8-2:9:17",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/scenarios_edge_index.d2,2:0:8-2:9:17",
"value": [
{
"string": "scenarios",
"raw_string": "scenarios"
}
]
}
}
]
},
"primary": {},
"value": {
"map": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/scenarios_edge_index.d2,2:11:19-6:1:68",
"nodes": [
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/scenarios_edge_index.d2,3:2:23-5:3:66",
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/scenarios_edge_index.d2,3:2:23-3:3:24",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/scenarios_edge_index.d2,3:2:23-3:3:24",
"value": [
{
"string": "1",
"raw_string": "1"
}
]
}
}
]
},
"primary": {},
"value": {
"map": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/scenarios_edge_index.d2,3:5:26-5:3:66",
"nodes": [
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/scenarios_edge_index.d2,4:4:32-4:34:62",
"edges": [
{
"range": "d2/testdata/d2compiler/TestCompile2/boards/scenarios_edge_index.d2,4:5:33-4:11:39",
"src": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/scenarios_edge_index.d2,4:5:33-4:6:34",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/scenarios_edge_index.d2,4:5:33-4:6:34",
"value": [
{
"string": "a",
"raw_string": "a"
}
]
}
}
]
},
"src_arrow": "",
"dst": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/scenarios_edge_index.d2,4:10:38-4:11:39",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/scenarios_edge_index.d2,4:10:38-4:11:39",
"value": [
{
"string": "x",
"raw_string": "x"
}
]
}
}
]
},
"dst_arrow": ">"
}
],
"edge_index": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/scenarios_edge_index.d2,4:12:40-4:15:43",
"int": 0,
"glob": false
},
"edge_key": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/scenarios_edge_index.d2,4:16:44-4:29:57",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/scenarios_edge_index.d2,4:16:44-4:21:49",
"value": [
{
"string": "style",
"raw_string": "style"
}
]
}
},
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/scenarios_edge_index.d2,4:22:50-4:29:57",
"value": [
{
"string": "opacity",
"raw_string": "opacity"
}
]
}
}
]
},
"primary": {},
"value": {
"number": {
"range": "d2/testdata/d2compiler/TestCompile2/boards/scenarios_edge_index.d2,4:31:59-4:34:62",
"raw": "0.1",
"value": "1/10"
}
}
}
}
]
}
}
}
}
]
}
}
}
} }
] ]
}, },