globs: filter works with default values

This commit is contained in:
Alexander Wang 2024-08-07 02:11:04 +08:00
parent f0b3a950fb
commit 96b386a26d
No known key found for this signature in database
GPG key ID: BE3937D0D52D8927
10 changed files with 2503 additions and 56 deletions

View file

@ -11,6 +11,7 @@
- Sequence diagram: The spacing between self-referential edges and regular edges is uniform [#2043](https://github.com/terrastruct/d2/pull/2043)
- Compiler: Error on multi-line labels in `sql_table` shapes [#2057](https://github.com/terrastruct/d2/pull/2057)
- Sequence diagram: Image shape actors can use spans and notes [#2056](https://github.com/terrastruct/d2/issues/2056)
- Globs: Filters work with default values (e.g. `&opacity: 1` will capture everything without opacity explicitly set) [#2090](https://github.com/terrastruct/d2/pull/2090)
#### Bugfixes ⛑️

View file

@ -4924,6 +4924,77 @@ scenarios: {
assert.Equal(t, "circle", g.Scenarios[1].Objects[1].Attributes.Shape.Value)
},
},
{
name: "default-glob-filter/1",
run: func(t *testing.T) {
g, _ := assertCompile(t, `
*: {
&shape: rectangle
style.fill: red
}
*: {
&style.opacity: 1
style.stroke: blue
}
a
b.shape: circle
c.shape: rectangle
`, ``)
assert.Equal(t, "red", g.Objects[0].Style.Fill.Value)
assert.Equal(t, "blue", g.Objects[0].Style.Stroke.Value)
assert.Equal(t, (*d2graph.Scalar)(nil), g.Objects[1].Style.Fill)
assert.Equal(t, "red", g.Objects[2].Style.Fill.Value)
},
},
{
name: "default-glob-filter/2",
run: func(t *testing.T) {
g, _ := assertCompile(t, `
*: {
&shape: rectangle
style.opacity: 0.2
}
a
b -> c
`, ``)
assert.Equal(t, "0.2", g.Objects[0].Style.Opacity.Value)
assert.Equal(t, (*d2graph.Scalar)(nil), g.Edges[0].Style.Opacity)
},
},
{
name: "default-glob-filter/3",
run: func(t *testing.T) {
g, _ := assertCompile(t, `
*: {
&icon: ""
style.opacity: 0.2
}
a
b.icon: https://google.com/cat.jpg
`, ``)
assert.Equal(t, "0.2", g.Objects[0].Style.Opacity.Value)
assert.Equal(t, (*d2graph.Scalar)(nil), g.Objects[1].Style.Opacity)
},
},
{
name: "default-glob-filter/4",
run: func(t *testing.T) {
g, _ := assertCompile(t, `
*: {
&opacity: 1
style.stroke: red
}
(* -> *)[*]: {
&opacity: 1
style.stroke: red
}
a
b -> c
`, ``)
assert.Equal(t, "red", g.Objects[0].Style.Stroke.Value)
assert.Equal(t, "red", g.Edges[0].Style.Stroke.Value)
},
},
}
for _, tc := range tca {

View file

@ -674,44 +674,78 @@ func (c *compiler) ampersandFilter(refctx *RefContext) bool {
return false
}
if len(fa) == 0 {
if refctx.Key.Key.Last().ScalarString() != "label" {
if refctx.Key.Value.ScalarBox().Unbox().ScalarString() == "*" {
return false
}
kp := refctx.Key.Key.Copy()
kp.Path = kp.Path[:len(kp.Path)-1]
if len(kp.Path) == 0 {
// The field/edge has no value for this filter
// But the filter might still match default, e.g. opacity 1
// So we make a fake field for the default
// NOTE: this does not apply to things that themes control, like stroke and fill
// Nor does it apply to layout things like width and height
switch refctx.Key.Key.Last().ScalarString() {
case "shape":
f := &Field{
Primary_: &Scalar{
Value: d2ast.FlatUnquotedString("rectangle"),
},
}
return c._ampersandFilter(f, refctx)
case "border-radius", "stroke-dash":
f := &Field{
Primary_: &Scalar{
Value: d2ast.FlatUnquotedString("0"),
},
}
return c._ampersandFilter(f, refctx)
case "opacity":
f := &Field{
Primary_: &Scalar{
Value: d2ast.FlatUnquotedString("1"),
},
}
return c._ampersandFilter(f, refctx)
case "stroke-width":
f := &Field{
Primary_: &Scalar{
Value: d2ast.FlatUnquotedString("2"),
},
}
return c._ampersandFilter(f, refctx)
case "icon", "tooltip", "link":
f := &Field{
Primary_: &Scalar{
Value: d2ast.FlatUnquotedString(""),
},
}
return c._ampersandFilter(f, refctx)
case "shadow", "multiple", "3d", "animated", "filled":
f := &Field{
Primary_: &Scalar{
Value: d2ast.FlatUnquotedString("false"),
},
}
return c._ampersandFilter(f, refctx)
case "label":
f := &Field{}
n := refctx.ScopeMap.Parent()
switch n := n.(type) {
case *Field:
fa = append(fa, n)
case *Edge:
if n.Primary_ == nil {
if refctx.Key.Value.ScalarBox().Unbox().ScalarString() == "" {
return true
if n.Primary() == nil {
switch n := n.(type) {
case *Field:
// The label value for fields is their key value
f.Primary_ = &Scalar{
Value: d2ast.FlatUnquotedString(n.Name),
}
case *Edge:
// But for edges, it's nothing
return false
}
if n.Primary_.Value.ScalarString() != refctx.Key.Value.ScalarBox().Unbox().ScalarString() {
return false
}
}
} else {
fa, err = refctx.ScopeMap.EnsureField(kp, refctx, false, c)
if err != nil {
c.err.Errors = append(c.err.Errors, err.(d2ast.Error))
return false
} else {
f.Primary_ = n.Primary()
}
return c._ampersandFilter(f, refctx)
default:
return false
}
for _, f := range fa {
label := f.Name
if f.Primary_ != nil {
label = f.Primary_.Value.ScalarString()
}
if label != refctx.Key.Value.ScalarBox().Unbox().ScalarString() {
return false
}
}
return true
}
for _, f := range fa {
ok := c._ampersandFilter(f, refctx)

View file

@ -175,7 +175,6 @@ x -> y: hi
}
a
# if i remove this line, the glob applies as expected
b
b.label: a
`)

View file

@ -0,0 +1,541 @@
{
"graph": {
"name": "",
"isFolderOnly": false,
"ast": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter.d2,0:0:0-12:0:130",
"nodes": [
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter.d2,1:0:1-4:1:44",
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter.d2,1:0:1-1:1:2",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter.d2,1:0:1-1:1:2",
"value": [
{
"string": "*",
"raw_string": "*"
}
],
"pattern": [
"*"
]
}
}
]
},
"primary": {},
"value": {
"map": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter.d2,1:3:4-4:1:44",
"nodes": [
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter.d2,2:1:7-2:18:24",
"ampersand": true,
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter.d2,2:2:8-2:7:13",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter.d2,2:2:8-2:7:13",
"value": [
{
"string": "shape",
"raw_string": "shape"
}
]
}
}
]
},
"primary": {},
"value": {
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter.d2,2:9:15-2:18:24",
"value": [
{
"string": "rectangle",
"raw_string": "rectangle"
}
]
}
}
}
},
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter.d2,3:2:27-3:17:42",
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter.d2,3:2:27-3:12:37",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter.d2,3:2:27-3:7:32",
"value": [
{
"string": "style",
"raw_string": "style"
}
]
}
},
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter.d2,3:8:33-3:12:37",
"value": [
{
"string": "fill",
"raw_string": "fill"
}
]
}
}
]
},
"primary": {},
"value": {
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter.d2,3:14:39-3:17:42",
"value": [
{
"string": "red",
"raw_string": "red"
}
]
}
}
}
}
]
}
}
}
},
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter.d2,5:0:45-8:1:92",
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter.d2,5:0:45-5:1:46",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter.d2,5:0:45-5:1:46",
"value": [
{
"string": "*",
"raw_string": "*"
}
],
"pattern": [
"*"
]
}
}
]
},
"primary": {},
"value": {
"map": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter.d2,5:3:48-8:1:92",
"nodes": [
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter.d2,6:2:52-6:19:69",
"ampersand": true,
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter.d2,6:3:53-6:16:66",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter.d2,6:3:53-6:8:58",
"value": [
{
"string": "style",
"raw_string": "style"
}
]
}
},
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter.d2,6:9:59-6:16:66",
"value": [
{
"string": "opacity",
"raw_string": "opacity"
}
]
}
}
]
},
"primary": {},
"value": {
"number": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter.d2,6:18:68-6:19:69",
"raw": "1",
"value": "1"
}
}
}
},
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter.d2,7:2:72-7:20:90",
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter.d2,7:2:72-7:14:84",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter.d2,7:2:72-7:7:77",
"value": [
{
"string": "style",
"raw_string": "style"
}
]
}
},
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter.d2,7:8:78-7:14:84",
"value": [
{
"string": "stroke",
"raw_string": "stroke"
}
]
}
}
]
},
"primary": {},
"value": {
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter.d2,7:16:86-7:20:90",
"value": [
{
"string": "blue",
"raw_string": "blue"
}
]
}
}
}
}
]
}
}
}
},
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter.d2,9:0:93-9:1:94",
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter.d2,9:0:93-9:1:94",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter.d2,9:0:93-9:1:94",
"value": [
{
"string": "a",
"raw_string": "a"
}
]
}
}
]
},
"primary": {},
"value": {}
}
},
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter.d2,10:0:95-10:15:110",
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter.d2,10:0:95-10:7:102",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter.d2,10:0:95-10:1:96",
"value": [
{
"string": "b",
"raw_string": "b"
}
]
}
},
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter.d2,10:2:97-10:7:102",
"value": [
{
"string": "shape",
"raw_string": "shape"
}
]
}
}
]
},
"primary": {},
"value": {
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter.d2,10:9:104-10:15:110",
"value": [
{
"string": "circle",
"raw_string": "circle"
}
]
}
}
}
},
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter.d2,11:0:111-11:18:129",
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter.d2,11:0:111-11:7:118",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter.d2,11:0:111-11:1:112",
"value": [
{
"string": "c",
"raw_string": "c"
}
]
}
},
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter.d2,11:2:113-11:7:118",
"value": [
{
"string": "shape",
"raw_string": "shape"
}
]
}
}
]
},
"primary": {},
"value": {
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter.d2,11:9:120-11:18:129",
"value": [
{
"string": "rectangle",
"raw_string": "rectangle"
}
]
}
}
}
}
]
},
"root": {
"id": "",
"id_val": "",
"attributes": {
"label": {
"value": ""
},
"labelDimensions": {
"width": 0,
"height": 0
},
"style": {},
"near_key": null,
"shape": {
"value": ""
},
"direction": {
"value": ""
},
"constraint": null
},
"zIndex": 0
},
"edges": null,
"objects": [
{
"id": "a",
"id_val": "a",
"references": [
{
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter.d2,9:0:93-9:1:94",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter.d2,9:0:93-9:1:94",
"value": [
{
"string": "a",
"raw_string": "a"
}
]
}
}
]
},
"key_path_index": 0,
"map_key_edge_index": -1
}
],
"attributes": {
"label": {
"value": "a"
},
"labelDimensions": {
"width": 0,
"height": 0
},
"style": {
"fill": {
"value": "red"
}
},
"near_key": null,
"shape": {
"value": "rectangle"
},
"direction": {
"value": ""
},
"constraint": null
},
"zIndex": 0
},
{
"id": "b",
"id_val": "b",
"references": [
{
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter.d2,10:0:95-10:7:102",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter.d2,10:0:95-10:1:96",
"value": [
{
"string": "b",
"raw_string": "b"
}
]
}
},
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter.d2,10:2:97-10:7:102",
"value": [
{
"string": "shape",
"raw_string": "shape"
}
]
}
}
]
},
"key_path_index": 0,
"map_key_edge_index": -1
}
],
"attributes": {
"label": {
"value": "b"
},
"labelDimensions": {
"width": 0,
"height": 0
},
"style": {},
"near_key": null,
"shape": {
"value": "circle"
},
"direction": {
"value": ""
},
"constraint": null
},
"zIndex": 0
},
{
"id": "c",
"id_val": "c",
"references": [
{
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter.d2,11:0:111-11:7:118",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter.d2,11:0:111-11:1:112",
"value": [
{
"string": "c",
"raw_string": "c"
}
]
}
},
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter.d2,11:2:113-11:7:118",
"value": [
{
"string": "shape",
"raw_string": "shape"
}
]
}
}
]
},
"key_path_index": 0,
"map_key_edge_index": -1
}
],
"attributes": {
"label": {
"value": "c"
},
"labelDimensions": {
"width": 0,
"height": 0
},
"style": {
"fill": {
"value": "red"
}
},
"near_key": null,
"shape": {
"value": "rectangle"
},
"direction": {
"value": ""
},
"constraint": null
},
"zIndex": 0
}
]
},
"err": null
}

View file

@ -0,0 +1,551 @@
{
"graph": {
"name": "",
"isFolderOnly": false,
"ast": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/1.d2,0:0:0-12:0:130",
"nodes": [
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/1.d2,1:0:1-4:1:44",
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/1.d2,1:0:1-1:1:2",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/1.d2,1:0:1-1:1:2",
"value": [
{
"string": "*",
"raw_string": "*"
}
],
"pattern": [
"*"
]
}
}
]
},
"primary": {},
"value": {
"map": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/1.d2,1:3:4-4:1:44",
"nodes": [
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/1.d2,2:1:7-2:18:24",
"ampersand": true,
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/1.d2,2:2:8-2:7:13",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/1.d2,2:2:8-2:7:13",
"value": [
{
"string": "shape",
"raw_string": "shape"
}
]
}
}
]
},
"primary": {},
"value": {
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/1.d2,2:9:15-2:18:24",
"value": [
{
"string": "rectangle",
"raw_string": "rectangle"
}
]
}
}
}
},
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/1.d2,3:2:27-3:17:42",
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/1.d2,3:2:27-3:12:37",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/1.d2,3:2:27-3:7:32",
"value": [
{
"string": "style",
"raw_string": "style"
}
]
}
},
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/1.d2,3:8:33-3:12:37",
"value": [
{
"string": "fill",
"raw_string": "fill"
}
]
}
}
]
},
"primary": {},
"value": {
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/1.d2,3:14:39-3:17:42",
"value": [
{
"string": "red",
"raw_string": "red"
}
]
}
}
}
}
]
}
}
}
},
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/1.d2,5:0:45-8:1:92",
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/1.d2,5:0:45-5:1:46",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/1.d2,5:0:45-5:1:46",
"value": [
{
"string": "*",
"raw_string": "*"
}
],
"pattern": [
"*"
]
}
}
]
},
"primary": {},
"value": {
"map": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/1.d2,5:3:48-8:1:92",
"nodes": [
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/1.d2,6:2:52-6:19:69",
"ampersand": true,
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/1.d2,6:3:53-6:16:66",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/1.d2,6:3:53-6:8:58",
"value": [
{
"string": "style",
"raw_string": "style"
}
]
}
},
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/1.d2,6:9:59-6:16:66",
"value": [
{
"string": "opacity",
"raw_string": "opacity"
}
]
}
}
]
},
"primary": {},
"value": {
"number": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/1.d2,6:18:68-6:19:69",
"raw": "1",
"value": "1"
}
}
}
},
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/1.d2,7:2:72-7:20:90",
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/1.d2,7:2:72-7:14:84",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/1.d2,7:2:72-7:7:77",
"value": [
{
"string": "style",
"raw_string": "style"
}
]
}
},
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/1.d2,7:8:78-7:14:84",
"value": [
{
"string": "stroke",
"raw_string": "stroke"
}
]
}
}
]
},
"primary": {},
"value": {
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/1.d2,7:16:86-7:20:90",
"value": [
{
"string": "blue",
"raw_string": "blue"
}
]
}
}
}
}
]
}
}
}
},
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/1.d2,9:0:93-9:1:94",
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/1.d2,9:0:93-9:1:94",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/1.d2,9:0:93-9:1:94",
"value": [
{
"string": "a",
"raw_string": "a"
}
]
}
}
]
},
"primary": {},
"value": {}
}
},
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/1.d2,10:0:95-10:15:110",
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/1.d2,10:0:95-10:7:102",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/1.d2,10:0:95-10:1:96",
"value": [
{
"string": "b",
"raw_string": "b"
}
]
}
},
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/1.d2,10:2:97-10:7:102",
"value": [
{
"string": "shape",
"raw_string": "shape"
}
]
}
}
]
},
"primary": {},
"value": {
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/1.d2,10:9:104-10:15:110",
"value": [
{
"string": "circle",
"raw_string": "circle"
}
]
}
}
}
},
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/1.d2,11:0:111-11:18:129",
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/1.d2,11:0:111-11:7:118",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/1.d2,11:0:111-11:1:112",
"value": [
{
"string": "c",
"raw_string": "c"
}
]
}
},
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/1.d2,11:2:113-11:7:118",
"value": [
{
"string": "shape",
"raw_string": "shape"
}
]
}
}
]
},
"primary": {},
"value": {
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/1.d2,11:9:120-11:18:129",
"value": [
{
"string": "rectangle",
"raw_string": "rectangle"
}
]
}
}
}
}
]
},
"root": {
"id": "",
"id_val": "",
"attributes": {
"label": {
"value": ""
},
"labelDimensions": {
"width": 0,
"height": 0
},
"style": {},
"near_key": null,
"shape": {
"value": ""
},
"direction": {
"value": ""
},
"constraint": null
},
"zIndex": 0
},
"edges": null,
"objects": [
{
"id": "a",
"id_val": "a",
"references": [
{
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/1.d2,9:0:93-9:1:94",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/1.d2,9:0:93-9:1:94",
"value": [
{
"string": "a",
"raw_string": "a"
}
]
}
}
]
},
"key_path_index": 0,
"map_key_edge_index": -1
}
],
"attributes": {
"label": {
"value": "a"
},
"labelDimensions": {
"width": 0,
"height": 0
},
"style": {
"stroke": {
"value": "blue"
},
"fill": {
"value": "red"
}
},
"near_key": null,
"shape": {
"value": "rectangle"
},
"direction": {
"value": ""
},
"constraint": null
},
"zIndex": 0
},
{
"id": "b",
"id_val": "b",
"references": [
{
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/1.d2,10:0:95-10:7:102",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/1.d2,10:0:95-10:1:96",
"value": [
{
"string": "b",
"raw_string": "b"
}
]
}
},
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/1.d2,10:2:97-10:7:102",
"value": [
{
"string": "shape",
"raw_string": "shape"
}
]
}
}
]
},
"key_path_index": 0,
"map_key_edge_index": -1
}
],
"attributes": {
"label": {
"value": "b"
},
"labelDimensions": {
"width": 0,
"height": 0
},
"style": {
"stroke": {
"value": "blue"
}
},
"near_key": null,
"shape": {
"value": "circle"
},
"direction": {
"value": ""
},
"constraint": null
},
"zIndex": 0
},
{
"id": "c",
"id_val": "c",
"references": [
{
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/1.d2,11:0:111-11:7:118",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/1.d2,11:0:111-11:1:112",
"value": [
{
"string": "c",
"raw_string": "c"
}
]
}
},
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/1.d2,11:2:113-11:7:118",
"value": [
{
"string": "shape",
"raw_string": "shape"
}
]
}
}
]
},
"key_path_index": 0,
"map_key_edge_index": -1
}
],
"attributes": {
"label": {
"value": "c"
},
"labelDimensions": {
"width": 0,
"height": 0
},
"style": {
"stroke": {
"value": "blue"
},
"fill": {
"value": "red"
}
},
"near_key": null,
"shape": {
"value": "rectangle"
},
"direction": {
"value": ""
},
"constraint": null
},
"zIndex": 0
}
]
},
"err": null
}

View file

@ -0,0 +1,391 @@
{
"graph": {
"name": "",
"isFolderOnly": false,
"ast": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/2.d2,0:0:0-7:0:57",
"nodes": [
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/2.d2,1:0:1-4:1:47",
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/2.d2,1:0:1-1:1:2",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/2.d2,1:0:1-1:1:2",
"value": [
{
"string": "*",
"raw_string": "*"
}
],
"pattern": [
"*"
]
}
}
]
},
"primary": {},
"value": {
"map": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/2.d2,1:3:4-4:1:47",
"nodes": [
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/2.d2,2:1:7-2:18:24",
"ampersand": true,
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/2.d2,2:2:8-2:7:13",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/2.d2,2:2:8-2:7:13",
"value": [
{
"string": "shape",
"raw_string": "shape"
}
]
}
}
]
},
"primary": {},
"value": {
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/2.d2,2:9:15-2:18:24",
"value": [
{
"string": "rectangle",
"raw_string": "rectangle"
}
]
}
}
}
},
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/2.d2,3:2:27-3:20:45",
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/2.d2,3:2:27-3:15:40",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/2.d2,3:2:27-3:7:32",
"value": [
{
"string": "style",
"raw_string": "style"
}
]
}
},
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/2.d2,3:8:33-3:15:40",
"value": [
{
"string": "opacity",
"raw_string": "opacity"
}
]
}
}
]
},
"primary": {},
"value": {
"number": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/2.d2,3:17:42-3:20:45",
"raw": "0.2",
"value": "1/5"
}
}
}
}
]
}
}
}
},
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/2.d2,5:0:48-5:1:49",
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/2.d2,5:0:48-5:1:49",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/2.d2,5:0:48-5:1:49",
"value": [
{
"string": "a",
"raw_string": "a"
}
]
}
}
]
},
"primary": {},
"value": {}
}
},
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/2.d2,6:0:50-6:6:56",
"edges": [
{
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/2.d2,6:0:50-6:6:56",
"src": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/2.d2,6:0:50-6:1:51",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/2.d2,6:0:50-6:1:51",
"value": [
{
"string": "b",
"raw_string": "b"
}
]
}
}
]
},
"src_arrow": "",
"dst": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/2.d2,6:5:55-6:6:56",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/2.d2,6:5:55-6:6:56",
"value": [
{
"string": "c",
"raw_string": "c"
}
]
}
}
]
},
"dst_arrow": ">"
}
],
"primary": {},
"value": {}
}
}
]
},
"root": {
"id": "",
"id_val": "",
"attributes": {
"label": {
"value": ""
},
"labelDimensions": {
"width": 0,
"height": 0
},
"style": {},
"near_key": null,
"shape": {
"value": ""
},
"direction": {
"value": ""
},
"constraint": null
},
"zIndex": 0
},
"edges": [
{
"index": 0,
"isCurve": false,
"src_arrow": false,
"dst_arrow": true,
"references": [
{
"map_key_edge_index": 0
}
],
"attributes": {
"label": {
"value": ""
},
"labelDimensions": {
"width": 0,
"height": 0
},
"style": {},
"near_key": null,
"shape": {
"value": ""
},
"direction": {
"value": ""
},
"constraint": null
},
"zIndex": 0
}
],
"objects": [
{
"id": "a",
"id_val": "a",
"references": [
{
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/2.d2,5:0:48-5:1:49",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/2.d2,5:0:48-5:1:49",
"value": [
{
"string": "a",
"raw_string": "a"
}
]
}
}
]
},
"key_path_index": 0,
"map_key_edge_index": -1
}
],
"attributes": {
"label": {
"value": "a"
},
"labelDimensions": {
"width": 0,
"height": 0
},
"style": {
"opacity": {
"value": "0.2"
}
},
"near_key": null,
"shape": {
"value": "rectangle"
},
"direction": {
"value": ""
},
"constraint": null
},
"zIndex": 0
},
{
"id": "b",
"id_val": "b",
"references": [
{
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/2.d2,6:0:50-6:1:51",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/2.d2,6:0:50-6:1:51",
"value": [
{
"string": "b",
"raw_string": "b"
}
]
}
}
]
},
"key_path_index": 0,
"map_key_edge_index": 0
}
],
"attributes": {
"label": {
"value": "b"
},
"labelDimensions": {
"width": 0,
"height": 0
},
"style": {
"opacity": {
"value": "0.2"
}
},
"near_key": null,
"shape": {
"value": "rectangle"
},
"direction": {
"value": ""
},
"constraint": null
},
"zIndex": 0
},
{
"id": "c",
"id_val": "c",
"references": [
{
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/2.d2,6:5:55-6:6:56",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/2.d2,6:5:55-6:6:56",
"value": [
{
"string": "c",
"raw_string": "c"
}
]
}
}
]
},
"key_path_index": 0,
"map_key_edge_index": 0
}
],
"attributes": {
"label": {
"value": "c"
},
"labelDimensions": {
"width": 0,
"height": 0
},
"style": {
"opacity": {
"value": "0.2"
}
},
"near_key": null,
"shape": {
"value": "rectangle"
},
"direction": {
"value": ""
},
"constraint": null
},
"zIndex": 0
}
]
},
"err": null
}

View file

@ -0,0 +1,324 @@
{
"graph": {
"name": "",
"isFolderOnly": false,
"ast": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/3.d2,0:0:0-7:0:77",
"nodes": [
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/3.d2,1:0:1-4:1:39",
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/3.d2,1:0:1-1:1:2",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/3.d2,1:0:1-1:1:2",
"value": [
{
"string": "*",
"raw_string": "*"
}
],
"pattern": [
"*"
]
}
}
]
},
"primary": {},
"value": {
"map": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/3.d2,1:3:4-4:1:39",
"nodes": [
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/3.d2,2:1:7-2:10:16",
"ampersand": true,
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/3.d2,2:2:8-2:6:12",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/3.d2,2:2:8-2:6:12",
"value": [
{
"string": "icon",
"raw_string": "icon"
}
]
}
}
]
},
"primary": {},
"value": {
"double_quoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/3.d2,2:8:14-2:10:16",
"value": null
}
}
}
},
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/3.d2,3:2:19-3:20:37",
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/3.d2,3:2:19-3:15:32",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/3.d2,3:2:19-3:7:24",
"value": [
{
"string": "style",
"raw_string": "style"
}
]
}
},
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/3.d2,3:8:25-3:15:32",
"value": [
{
"string": "opacity",
"raw_string": "opacity"
}
]
}
}
]
},
"primary": {},
"value": {
"number": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/3.d2,3:17:34-3:20:37",
"raw": "0.2",
"value": "1/5"
}
}
}
}
]
}
}
}
},
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/3.d2,5:0:40-5:1:41",
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/3.d2,5:0:40-5:1:41",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/3.d2,5:0:40-5:1:41",
"value": [
{
"string": "a",
"raw_string": "a"
}
]
}
}
]
},
"primary": {},
"value": {}
}
},
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/3.d2,6:0:42-6:34:76",
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/3.d2,6:0:42-6:6:48",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/3.d2,6:0:42-6:1:43",
"value": [
{
"string": "b",
"raw_string": "b"
}
]
}
},
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/3.d2,6:2:44-6:6:48",
"value": [
{
"string": "icon",
"raw_string": "icon"
}
]
}
}
]
},
"primary": {},
"value": {
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/3.d2,6:8:50-6:34:76",
"value": [
{
"string": "https://google.com/cat.jpg",
"raw_string": "https://google.com/cat.jpg"
}
]
}
}
}
}
]
},
"root": {
"id": "",
"id_val": "",
"attributes": {
"label": {
"value": ""
},
"labelDimensions": {
"width": 0,
"height": 0
},
"style": {},
"near_key": null,
"shape": {
"value": ""
},
"direction": {
"value": ""
},
"constraint": null
},
"zIndex": 0
},
"edges": null,
"objects": [
{
"id": "a",
"id_val": "a",
"references": [
{
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/3.d2,5:0:40-5:1:41",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/3.d2,5:0:40-5:1:41",
"value": [
{
"string": "a",
"raw_string": "a"
}
]
}
}
]
},
"key_path_index": 0,
"map_key_edge_index": -1
}
],
"attributes": {
"label": {
"value": "a"
},
"labelDimensions": {
"width": 0,
"height": 0
},
"style": {
"opacity": {
"value": "0.2"
}
},
"near_key": null,
"shape": {
"value": "rectangle"
},
"direction": {
"value": ""
},
"constraint": null
},
"zIndex": 0
},
{
"id": "b",
"id_val": "b",
"references": [
{
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/3.d2,6:0:42-6:6:48",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/3.d2,6:0:42-6:1:43",
"value": [
{
"string": "b",
"raw_string": "b"
}
]
}
},
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/3.d2,6:2:44-6:6:48",
"value": [
{
"string": "icon",
"raw_string": "icon"
}
]
}
}
]
},
"key_path_index": 0,
"map_key_edge_index": -1
}
],
"attributes": {
"label": {
"value": "b"
},
"labelDimensions": {
"width": 0,
"height": 0
},
"style": {},
"icon": {
"Scheme": "https",
"Opaque": "",
"User": null,
"Host": "google.com",
"Path": "/cat.jpg",
"RawPath": "",
"OmitHost": false,
"ForceQuery": false,
"RawQuery": "",
"Fragment": "",
"RawFragment": ""
},
"near_key": null,
"shape": {
"value": "rectangle"
},
"direction": {
"value": ""
},
"constraint": null
},
"zIndex": 0
}
]
},
"err": null
}

View file

@ -0,0 +1,535 @@
{
"graph": {
"name": "",
"isFolderOnly": false,
"ast": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/4.d2,0:0:0-11:0:100",
"nodes": [
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/4.d2,1:0:1-4:1:40",
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/4.d2,1:0:1-1:1:2",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/4.d2,1:0:1-1:1:2",
"value": [
{
"string": "*",
"raw_string": "*"
}
],
"pattern": [
"*"
]
}
}
]
},
"primary": {},
"value": {
"map": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/4.d2,1:3:4-4:1:40",
"nodes": [
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/4.d2,2:1:7-2:12:18",
"ampersand": true,
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/4.d2,2:2:8-2:9:15",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/4.d2,2:2:8-2:9:15",
"value": [
{
"string": "opacity",
"raw_string": "opacity"
}
]
}
}
]
},
"primary": {},
"value": {
"number": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/4.d2,2:11:17-2:12:18",
"raw": "1",
"value": "1"
}
}
}
},
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/4.d2,3:2:21-3:19:38",
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/4.d2,3:2:21-3:14:33",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/4.d2,3:2:21-3:7:26",
"value": [
{
"string": "style",
"raw_string": "style"
}
]
}
},
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/4.d2,3:8:27-3:14:33",
"value": [
{
"string": "stroke",
"raw_string": "stroke"
}
]
}
}
]
},
"primary": {},
"value": {
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/4.d2,3:16:35-3:19:38",
"value": [
{
"string": "red",
"raw_string": "red"
}
]
}
}
}
}
]
}
}
}
},
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/4.d2,5:0:41-8:1:90",
"edges": [
{
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/4.d2,5:1:42-5:7:48",
"src": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/4.d2,5:1:42-5:2:43",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/4.d2,5:1:42-5:2:43",
"value": [
{
"string": "*",
"raw_string": "*"
}
],
"pattern": [
"*"
]
}
}
]
},
"src_arrow": "",
"dst": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/4.d2,5:6:47-5:7:48",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/4.d2,5:6:47-5:7:48",
"value": [
{
"string": "*",
"raw_string": "*"
}
],
"pattern": [
"*"
]
}
}
]
},
"dst_arrow": ">"
}
],
"edge_index": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/4.d2,5:8:49-5:11:52",
"int": null,
"glob": true
},
"primary": {},
"value": {
"map": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/4.d2,5:13:54-8:1:90",
"nodes": [
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/4.d2,6:1:57-6:12:68",
"ampersand": true,
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/4.d2,6:2:58-6:9:65",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/4.d2,6:2:58-6:9:65",
"value": [
{
"string": "opacity",
"raw_string": "opacity"
}
]
}
}
]
},
"primary": {},
"value": {
"number": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/4.d2,6:11:67-6:12:68",
"raw": "1",
"value": "1"
}
}
}
},
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/4.d2,7:2:71-7:19:88",
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/4.d2,7:2:71-7:14:83",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/4.d2,7:2:71-7:7:76",
"value": [
{
"string": "style",
"raw_string": "style"
}
]
}
},
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/4.d2,7:8:77-7:14:83",
"value": [
{
"string": "stroke",
"raw_string": "stroke"
}
]
}
}
]
},
"primary": {},
"value": {
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/4.d2,7:16:85-7:19:88",
"value": [
{
"string": "red",
"raw_string": "red"
}
]
}
}
}
}
]
}
}
}
},
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/4.d2,9:0:91-9:1:92",
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/4.d2,9:0:91-9:1:92",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/4.d2,9:0:91-9:1:92",
"value": [
{
"string": "a",
"raw_string": "a"
}
]
}
}
]
},
"primary": {},
"value": {}
}
},
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/4.d2,10:0:93-10:6:99",
"edges": [
{
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/4.d2,10:0:93-10:6:99",
"src": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/4.d2,10:0:93-10:1:94",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/4.d2,10:0:93-10:1:94",
"value": [
{
"string": "b",
"raw_string": "b"
}
]
}
}
]
},
"src_arrow": "",
"dst": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/4.d2,10:5:98-10:6:99",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/4.d2,10:5:98-10:6:99",
"value": [
{
"string": "c",
"raw_string": "c"
}
]
}
}
]
},
"dst_arrow": ">"
}
],
"primary": {},
"value": {}
}
}
]
},
"root": {
"id": "",
"id_val": "",
"attributes": {
"label": {
"value": ""
},
"labelDimensions": {
"width": 0,
"height": 0
},
"style": {},
"near_key": null,
"shape": {
"value": ""
},
"direction": {
"value": ""
},
"constraint": null
},
"zIndex": 0
},
"edges": [
{
"index": 0,
"isCurve": false,
"src_arrow": false,
"dst_arrow": true,
"references": [
{
"map_key_edge_index": 0
},
{
"map_key_edge_index": 0
}
],
"attributes": {
"label": {
"value": ""
},
"labelDimensions": {
"width": 0,
"height": 0
},
"style": {
"stroke": {
"value": "red"
}
},
"near_key": null,
"shape": {
"value": ""
},
"direction": {
"value": ""
},
"constraint": null
},
"zIndex": 0
}
],
"objects": [
{
"id": "a",
"id_val": "a",
"references": [
{
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/4.d2,9:0:91-9:1:92",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/4.d2,9:0:91-9:1:92",
"value": [
{
"string": "a",
"raw_string": "a"
}
]
}
}
]
},
"key_path_index": 0,
"map_key_edge_index": -1
}
],
"attributes": {
"label": {
"value": "a"
},
"labelDimensions": {
"width": 0,
"height": 0
},
"style": {
"stroke": {
"value": "red"
}
},
"near_key": null,
"shape": {
"value": "rectangle"
},
"direction": {
"value": ""
},
"constraint": null
},
"zIndex": 0
},
{
"id": "b",
"id_val": "b",
"references": [
{
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/4.d2,10:0:93-10:1:94",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/4.d2,10:0:93-10:1:94",
"value": [
{
"string": "b",
"raw_string": "b"
}
]
}
}
]
},
"key_path_index": 0,
"map_key_edge_index": 0
}
],
"attributes": {
"label": {
"value": "b"
},
"labelDimensions": {
"width": 0,
"height": 0
},
"style": {
"stroke": {
"value": "red"
}
},
"near_key": null,
"shape": {
"value": "rectangle"
},
"direction": {
"value": ""
},
"constraint": null
},
"zIndex": 0
},
{
"id": "c",
"id_val": "c",
"references": [
{
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/4.d2,10:5:98-10:6:99",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/default-glob-filter/4.d2,10:5:98-10:6:99",
"value": [
{
"string": "c",
"raw_string": "c"
}
]
}
}
]
},
"key_path_index": 0,
"map_key_edge_index": 0
}
],
"attributes": {
"label": {
"value": "c"
},
"labelDimensions": {
"width": 0,
"height": 0
},
"style": {
"stroke": {
"value": "red"
}
},
"near_key": null,
"shape": {
"value": "rectangle"
},
"direction": {
"value": ""
},
"constraint": null
},
"zIndex": 0
}
]
},
"err": null
}

View file

@ -267,7 +267,7 @@
"name": "label",
"primary": {
"value": {
"range": "TestCompile/filters/lazy-filter.d2,9:9:109-9:10:110",
"range": "TestCompile/filters/lazy-filter.d2,8:9:55-8:10:56",
"value": [
{
"string": "a",
@ -279,7 +279,7 @@
"references": [
{
"string": {
"range": "TestCompile/filters/lazy-filter.d2,9:2:102-9:7:107",
"range": "TestCompile/filters/lazy-filter.d2,8:2:48-8:7:53",
"value": [
{
"string": "label",
@ -288,11 +288,11 @@
]
},
"key_path": {
"range": "TestCompile/filters/lazy-filter.d2,9:0:100-9:7:107",
"range": "TestCompile/filters/lazy-filter.d2,8:0:46-8:7:53",
"path": [
{
"unquoted_string": {
"range": "TestCompile/filters/lazy-filter.d2,9:0:100-9:1:101",
"range": "TestCompile/filters/lazy-filter.d2,8:0:46-8:1:47",
"value": [
{
"string": "b",
@ -303,7 +303,7 @@
},
{
"unquoted_string": {
"range": "TestCompile/filters/lazy-filter.d2,9:2:102-9:7:107",
"range": "TestCompile/filters/lazy-filter.d2,8:2:48-8:7:53",
"value": [
{
"string": "label",
@ -317,13 +317,13 @@
"context": {
"edge": null,
"key": {
"range": "TestCompile/filters/lazy-filter.d2,9:0:100-9:10:110",
"range": "TestCompile/filters/lazy-filter.d2,8:0:46-8:10:56",
"key": {
"range": "TestCompile/filters/lazy-filter.d2,9:0:100-9:7:107",
"range": "TestCompile/filters/lazy-filter.d2,8:0:46-8:7:53",
"path": [
{
"unquoted_string": {
"range": "TestCompile/filters/lazy-filter.d2,9:0:100-9:1:101",
"range": "TestCompile/filters/lazy-filter.d2,8:0:46-8:1:47",
"value": [
{
"string": "b",
@ -334,7 +334,7 @@
},
{
"unquoted_string": {
"range": "TestCompile/filters/lazy-filter.d2,9:2:102-9:7:107",
"range": "TestCompile/filters/lazy-filter.d2,8:2:48-8:7:53",
"value": [
{
"string": "label",
@ -348,7 +348,7 @@
"primary": {},
"value": {
"unquoted_string": {
"range": "TestCompile/filters/lazy-filter.d2,9:9:109-9:10:110",
"range": "TestCompile/filters/lazy-filter.d2,8:9:55-8:10:56",
"value": [
{
"string": "a",
@ -758,7 +758,7 @@
"references": [
{
"string": {
"range": "TestCompile/filters/lazy-filter.d2,8:0:98-8:1:99",
"range": "TestCompile/filters/lazy-filter.d2,7:0:44-7:1:45",
"value": [
{
"string": "b",
@ -767,11 +767,11 @@
]
},
"key_path": {
"range": "TestCompile/filters/lazy-filter.d2,8:0:98-8:1:99",
"range": "TestCompile/filters/lazy-filter.d2,7:0:44-7:1:45",
"path": [
{
"unquoted_string": {
"range": "TestCompile/filters/lazy-filter.d2,8:0:98-8:1:99",
"range": "TestCompile/filters/lazy-filter.d2,7:0:44-7:1:45",
"value": [
{
"string": "b",
@ -785,13 +785,13 @@
"context": {
"edge": null,
"key": {
"range": "TestCompile/filters/lazy-filter.d2,8:0:98-8:1:99",
"range": "TestCompile/filters/lazy-filter.d2,7:0:44-7:1:45",
"key": {
"range": "TestCompile/filters/lazy-filter.d2,8:0:98-8:1:99",
"range": "TestCompile/filters/lazy-filter.d2,7:0:44-7:1:45",
"path": [
{
"unquoted_string": {
"range": "TestCompile/filters/lazy-filter.d2,8:0:98-8:1:99",
"range": "TestCompile/filters/lazy-filter.d2,7:0:44-7:1:45",
"value": [
{
"string": "b",
@ -811,7 +811,7 @@
},
{
"string": {
"range": "TestCompile/filters/lazy-filter.d2,9:0:100-9:1:101",
"range": "TestCompile/filters/lazy-filter.d2,8:0:46-8:1:47",
"value": [
{
"string": "b",
@ -820,11 +820,11 @@
]
},
"key_path": {
"range": "TestCompile/filters/lazy-filter.d2,9:0:100-9:7:107",
"range": "TestCompile/filters/lazy-filter.d2,8:0:46-8:7:53",
"path": [
{
"unquoted_string": {
"range": "TestCompile/filters/lazy-filter.d2,9:0:100-9:1:101",
"range": "TestCompile/filters/lazy-filter.d2,8:0:46-8:1:47",
"value": [
{
"string": "b",
@ -835,7 +835,7 @@
},
{
"unquoted_string": {
"range": "TestCompile/filters/lazy-filter.d2,9:2:102-9:7:107",
"range": "TestCompile/filters/lazy-filter.d2,8:2:48-8:7:53",
"value": [
{
"string": "label",
@ -849,13 +849,13 @@
"context": {
"edge": null,
"key": {
"range": "TestCompile/filters/lazy-filter.d2,9:0:100-9:10:110",
"range": "TestCompile/filters/lazy-filter.d2,8:0:46-8:10:56",
"key": {
"range": "TestCompile/filters/lazy-filter.d2,9:0:100-9:7:107",
"range": "TestCompile/filters/lazy-filter.d2,8:0:46-8:7:53",
"path": [
{
"unquoted_string": {
"range": "TestCompile/filters/lazy-filter.d2,9:0:100-9:1:101",
"range": "TestCompile/filters/lazy-filter.d2,8:0:46-8:1:47",
"value": [
{
"string": "b",
@ -866,7 +866,7 @@
},
{
"unquoted_string": {
"range": "TestCompile/filters/lazy-filter.d2,9:2:102-9:7:107",
"range": "TestCompile/filters/lazy-filter.d2,8:2:48-8:7:53",
"value": [
{
"string": "label",
@ -880,7 +880,7 @@
"primary": {},
"value": {
"unquoted_string": {
"range": "TestCompile/filters/lazy-filter.d2,9:9:109-9:10:110",
"range": "TestCompile/filters/lazy-filter.d2,8:9:55-8:10:56",
"value": [
{
"string": "a",