diff --git a/d2ast/d2ast.go b/d2ast/d2ast.go index 79c256b2c..6b6f47389 100644 --- a/d2ast/d2ast.go +++ b/d2ast/d2ast.go @@ -749,7 +749,16 @@ func (kp *KeyPath) Copy() *KeyPath { func (kp *KeyPath) HasDoubleGlob() bool { for _, el := range kp.Path { - if el.ScalarString() == "**" { + if el.UnquotedString != nil && el.ScalarString() == "**" { + return true + } + } + return false +} + +func (kp *KeyPath) HasGlob() bool { + for _, el := range kp.Path { + if el.UnquotedString != nil && len(el.UnquotedString.Pattern) > 0 { return true } } diff --git a/d2ir/compile.go b/d2ir/compile.go index c2bff5f55..43763139d 100644 --- a/d2ir/compile.go +++ b/d2ir/compile.go @@ -661,17 +661,7 @@ func (c *compiler) _compileEdges(refctx *RefContext) { refctx.ScopeMap.appendFieldReferences(0, refctx.Edge.Dst, refctx) } } else { - _, err := refctx.ScopeMap.EnsureField(refctx.Edge.Src, refctx, true) - if err != nil { - c.err.Errors = append(c.err.Errors, err.(d2ast.Error)) - continue - } - _, err = refctx.ScopeMap.EnsureField(refctx.Edge.Dst, refctx, true) - if err != nil { - c.err.Errors = append(c.err.Errors, err.(d2ast.Error)) - continue - } - + var err error ea, err = refctx.ScopeMap.CreateEdge(eid, refctx) if err != nil { c.err.Errors = append(c.err.Errors, err.(d2ast.Error)) diff --git a/d2ir/d2ir.go b/d2ir/d2ir.go index e542394fd..4550a9857 100644 --- a/d2ir/d2ir.go +++ b/d2ir/d2ir.go @@ -935,34 +935,11 @@ func (m *Map) getEdges(eid *EdgeID, refctx *RefContext, ea *[]*Edge) error { return nil } - srcKP := d2ast.MakeKeyPath(eid.SrcPath) - lastMatch := 0 - for i, el := range srcKP.Path { - for j := lastMatch; j < len(refctx.Edge.Src.Path); j++ { - realEl := refctx.Edge.Src.Path[j] - if el.ScalarString() == realEl.ScalarString() { - srcKP.Path[i] = realEl - lastMatch += j + 1 - } - } - } - dstKP := d2ast.MakeKeyPath(eid.DstPath) - lastMatch = 0 - for i, el := range dstKP.Path { - for j := lastMatch; j < len(refctx.Edge.Dst.Path); j++ { - realEl := refctx.Edge.Dst.Path[j] - if el.ScalarString() == realEl.ScalarString() { - dstKP.Path[i] = realEl - lastMatch += j + 1 - } - } - } - - srcFA, err := m.EnsureField(srcKP, nil, false) + srcFA, err := refctx.ScopeMap.EnsureField(refctx.Edge.Src, nil, false) if err != nil { return err } - dstFA, err := m.EnsureField(dstKP, nil, false) + dstFA, err := refctx.ScopeMap.EnsureField(refctx.Edge.Dst, nil, false) if err != nil { return err } @@ -1045,51 +1022,36 @@ func (m *Map) createEdge(eid *EdgeID, refctx *RefContext, ea *[]*Edge) error { return d2parser.Errorf(refctx.Edge.Dst.Path[ij].Unbox(), "edge with board keyword alone doesn't make sense") } - srcKP := d2ast.MakeKeyPath(eid.SrcPath) - lastMatch := 0 - for i, el := range srcKP.Path { - for j := lastMatch; j < len(refctx.Edge.Src.Path); j++ { - realEl := refctx.Edge.Src.Path[j] - if el.ScalarString() == realEl.ScalarString() { - srcKP.Path[i] = realEl - lastMatch += j + 1 - } - } - } - dstKP := d2ast.MakeKeyPath(eid.DstPath) - lastMatch = 0 - for i, el := range dstKP.Path { - for j := lastMatch; j < len(refctx.Edge.Dst.Path); j++ { - realEl := refctx.Edge.Dst.Path[j] - if el.ScalarString() == realEl.ScalarString() { - dstKP.Path[i] = realEl - lastMatch += j + 1 - } - } - } - - srcFA, err := m.EnsureField(srcKP, nil, true) + srcFA, err := refctx.ScopeMap.EnsureField(refctx.Edge.Src, refctx, true) if err != nil { return err } - dstFA, err := m.EnsureField(dstKP, nil, true) + dstFA, err := refctx.ScopeMap.EnsureField(refctx.Edge.Dst, refctx, true) if err != nil { return err } for _, src := range srcFA { for _, dst := range dstFA { - if src == dst && (len(srcFA) > 1 || len(dstFA) > 1) { + if src == dst && (refctx.Edge.Src.HasGlob() || refctx.Edge.Dst.HasGlob()) { // Globs do not make self edges. continue } - if srcKP.HasDoubleGlob() || dstKP.HasDoubleGlob() { - // If either has a double glob we only select leafs, those without children. - if src.Map().IsContainer() || dst.Map().IsContainer() { + if refctx.Edge.Src.HasDoubleGlob() { + // If src has a double glob we only select leafs, those without children. + if src.Map().IsContainer() { + continue + } + if ParentBoard(src) != ParentBoard(dst) { + continue + } + } + if refctx.Edge.Dst.HasDoubleGlob() { + // If dst has a double glob we only select leafs, those without children. + if dst.Map().IsContainer() { continue } - // If either has a double glob we ignore connections across boards if ParentBoard(src) != ParentBoard(dst) { continue } @@ -1121,7 +1083,7 @@ func (m *Map) createEdge2(eid *EdgeID, refctx *RefContext, src, dst *Field) (*Ed eid.Index = nil eid.Glob = true - ea := m.GetEdges(eid, refctx) + ea := m.GetEdges(eid, nil) index := len(ea) eid.Index = &index eid.Glob = false @@ -1400,7 +1362,7 @@ func IDA(n Node) (ida []string) { } } -// RelIDA returns the absolute path to n relative to p. +// RelIDA returns the path to n relative to p. func RelIDA(p, n Node) (ida []string) { for { f, ok := n.(*Field) diff --git a/d2ir/pattern_test.go b/d2ir/pattern_test.go index b291e2c43..aabd8be58 100644 --- a/d2ir/pattern_test.go +++ b/d2ir/pattern_test.go @@ -285,6 +285,35 @@ d assertQuery(t, m, 0, 0, nil, "(* -> *)[*]") }, }, + { + name: "double-glob/edge/1", + run: func(t testing.TB) { + m, err := compile(t, `fast: { + a + far +} + +task: { + a +} + +task.** -> fast +`) + assert.Success(t, err) + assertQuery(t, m, 5, 1, nil, "") + }, + }, + { + name: "double-glob/edge/2", + run: func(t testing.TB) { + m, err := compile(t, `a + +**.b -> c +`) + assert.Success(t, err) + assertQuery(t, m, 3, 1, nil, "") + }, + }, } runa(t, tca) diff --git a/testdata/d2ir/TestCompile/patterns/double-glob/edge/1.exp.json b/testdata/d2ir/TestCompile/patterns/double-glob/edge/1.exp.json new file mode 100644 index 000000000..209501268 --- /dev/null +++ b/testdata/d2ir/TestCompile/patterns/double-glob/edge/1.exp.json @@ -0,0 +1,811 @@ +{ + "fields": [ + { + "name": "fast", + "composite": { + "fields": [ + { + "name": "a", + "references": [ + { + "string": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,1:2:10-1:3:11", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + }, + "key_path": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,1:2:10-1:3:11", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,1:2:10-1:3:11", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,1:2:10-1:3:11", + "key": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,1:2:10-1:3:11", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,1:2:10-1:3:11", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + } + ] + }, + "primary": {}, + "value": {} + } + } + } + ] + }, + { + "name": "far", + "references": [ + { + "string": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,2:2:14-2:5:17", + "value": [ + { + "string": "far", + "raw_string": "far" + } + ] + }, + "key_path": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,2:2:14-2:5:17", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,2:2:14-2:5:17", + "value": [ + { + "string": "far", + "raw_string": "far" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,2:2:14-2:5:17", + "key": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,2:2:14-2:5:17", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,2:2:14-2:5:17", + "value": [ + { + "string": "far", + "raw_string": "far" + } + ] + } + } + ] + }, + "primary": {}, + "value": {} + } + } + } + ] + } + ], + "edges": null + }, + "references": [ + { + "string": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,0:0:0-0:4:4", + "value": [ + { + "string": "fast", + "raw_string": "fast" + } + ] + }, + "key_path": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,0:0:0-0:4:4", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,0:0:0-0:4:4", + "value": [ + { + "string": "fast", + "raw_string": "fast" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,0:0:0-3:1:19", + "key": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,0:0:0-0:4:4", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,0:0:0-0:4:4", + "value": [ + { + "string": "fast", + "raw_string": "fast" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,0:6:6-3:1:19", + "nodes": [ + { + "map_key": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,1:2:10-1:3:11", + "key": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,1:2:10-1:3:11", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,1:2:10-1:3:11", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + } + ] + }, + "primary": {}, + "value": {} + } + }, + { + "map_key": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,2:2:14-2:5:17", + "key": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,2:2:14-2:5:17", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,2:2:14-2:5:17", + "value": [ + { + "string": "far", + "raw_string": "far" + } + ] + } + } + ] + }, + "primary": {}, + "value": {} + } + } + ] + } + } + } + } + }, + { + "string": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,9:11:47-9:15:51", + "value": [ + { + "string": "fast", + "raw_string": "fast" + } + ] + }, + "key_path": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,9:11:47-9:15:51", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,9:11:47-9:15:51", + "value": [ + { + "string": "fast", + "raw_string": "fast" + } + ] + } + } + ] + }, + "context": { + "edge": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,9:0:36-9:15:51", + "src": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,9:0:36-9:7:43", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,9:0:36-9:4:40", + "value": [ + { + "string": "task", + "raw_string": "task" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,9:5:41-9:7:43", + "value": [ + { + "string": "**", + "raw_string": "**" + } + ], + "pattern": [ + "*", + "", + "*" + ] + } + } + ] + }, + "src_arrow": "", + "dst": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,9:11:47-9:15:51", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,9:11:47-9:15:51", + "value": [ + { + "string": "fast", + "raw_string": "fast" + } + ] + } + } + ] + }, + "dst_arrow": ">" + }, + "key": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,9:0:36-9:15:51", + "edges": [ + { + "range": "TestCompile/patterns/double-glob/edge/1.d2,9:0:36-9:15:51", + "src": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,9:0:36-9:7:43", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,9:0:36-9:4:40", + "value": [ + { + "string": "task", + "raw_string": "task" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,9:5:41-9:7:43", + "value": [ + { + "string": "**", + "raw_string": "**" + } + ], + "pattern": [ + "*", + "", + "*" + ] + } + } + ] + }, + "src_arrow": "", + "dst": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,9:11:47-9:15:51", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,9:11:47-9:15:51", + "value": [ + { + "string": "fast", + "raw_string": "fast" + } + ] + } + } + ] + }, + "dst_arrow": ">" + } + ], + "primary": {}, + "value": {} + } + } + } + ] + }, + { + "name": "task", + "composite": { + "fields": [ + { + "name": "a", + "references": [ + { + "string": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,6:2:31-6:3:32", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + }, + "key_path": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,6:2:31-6:3:32", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,6:2:31-6:3:32", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,6:2:31-6:3:32", + "key": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,6:2:31-6:3:32", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,6:2:31-6:3:32", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + } + ] + }, + "primary": {}, + "value": {} + } + } + } + ] + } + ], + "edges": null + }, + "references": [ + { + "string": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,5:0:21-5:4:25", + "value": [ + { + "string": "task", + "raw_string": "task" + } + ] + }, + "key_path": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,5:0:21-5:4:25", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,5:0:21-5:4:25", + "value": [ + { + "string": "task", + "raw_string": "task" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,5:0:21-7:1:34", + "key": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,5:0:21-5:4:25", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,5:0:21-5:4:25", + "value": [ + { + "string": "task", + "raw_string": "task" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,5:6:27-7:1:34", + "nodes": [ + { + "map_key": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,6:2:31-6:3:32", + "key": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,6:2:31-6:3:32", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,6:2:31-6:3:32", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + } + ] + }, + "primary": {}, + "value": {} + } + } + ] + } + } + } + } + }, + { + "string": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,9:0:36-9:4:40", + "value": [ + { + "string": "task", + "raw_string": "task" + } + ] + }, + "key_path": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,9:0:36-9:7:43", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,9:0:36-9:4:40", + "value": [ + { + "string": "task", + "raw_string": "task" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,9:5:41-9:7:43", + "value": [ + { + "string": "**", + "raw_string": "**" + } + ], + "pattern": [ + "*", + "", + "*" + ] + } + } + ] + }, + "context": { + "edge": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,9:0:36-9:15:51", + "src": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,9:0:36-9:7:43", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,9:0:36-9:4:40", + "value": [ + { + "string": "task", + "raw_string": "task" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,9:5:41-9:7:43", + "value": [ + { + "string": "**", + "raw_string": "**" + } + ], + "pattern": [ + "*", + "", + "*" + ] + } + } + ] + }, + "src_arrow": "", + "dst": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,9:11:47-9:15:51", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,9:11:47-9:15:51", + "value": [ + { + "string": "fast", + "raw_string": "fast" + } + ] + } + } + ] + }, + "dst_arrow": ">" + }, + "key": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,9:0:36-9:15:51", + "edges": [ + { + "range": "TestCompile/patterns/double-glob/edge/1.d2,9:0:36-9:15:51", + "src": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,9:0:36-9:7:43", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,9:0:36-9:4:40", + "value": [ + { + "string": "task", + "raw_string": "task" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,9:5:41-9:7:43", + "value": [ + { + "string": "**", + "raw_string": "**" + } + ], + "pattern": [ + "*", + "", + "*" + ] + } + } + ] + }, + "src_arrow": "", + "dst": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,9:11:47-9:15:51", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,9:11:47-9:15:51", + "value": [ + { + "string": "fast", + "raw_string": "fast" + } + ] + } + } + ] + }, + "dst_arrow": ">" + } + ], + "primary": {}, + "value": {} + } + } + } + ] + } + ], + "edges": [ + { + "edge_id": { + "src_path": [ + "task", + "a" + ], + "src_arrow": false, + "dst_path": [ + "fast" + ], + "dst_arrow": true, + "index": 0, + "glob": false + }, + "references": [ + { + "context": { + "edge": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,9:0:36-9:15:51", + "src": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,9:0:36-9:7:43", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,9:0:36-9:4:40", + "value": [ + { + "string": "task", + "raw_string": "task" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,9:5:41-9:7:43", + "value": [ + { + "string": "**", + "raw_string": "**" + } + ], + "pattern": [ + "*", + "", + "*" + ] + } + } + ] + }, + "src_arrow": "", + "dst": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,9:11:47-9:15:51", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,9:11:47-9:15:51", + "value": [ + { + "string": "fast", + "raw_string": "fast" + } + ] + } + } + ] + }, + "dst_arrow": ">" + }, + "key": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,9:0:36-9:15:51", + "edges": [ + { + "range": "TestCompile/patterns/double-glob/edge/1.d2,9:0:36-9:15:51", + "src": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,9:0:36-9:7:43", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,9:0:36-9:4:40", + "value": [ + { + "string": "task", + "raw_string": "task" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,9:5:41-9:7:43", + "value": [ + { + "string": "**", + "raw_string": "**" + } + ], + "pattern": [ + "*", + "", + "*" + ] + } + } + ] + }, + "src_arrow": "", + "dst": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,9:11:47-9:15:51", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/patterns/double-glob/edge/1.d2,9:11:47-9:15:51", + "value": [ + { + "string": "fast", + "raw_string": "fast" + } + ] + } + } + ] + }, + "dst_arrow": ">" + } + ], + "primary": {}, + "value": {} + } + } + } + ] + } + ] +} diff --git a/testdata/d2ir/TestCompile/patterns/double-glob/edge/2.exp.json b/testdata/d2ir/TestCompile/patterns/double-glob/edge/2.exp.json new file mode 100644 index 000000000..ec8c116c4 --- /dev/null +++ b/testdata/d2ir/TestCompile/patterns/double-glob/edge/2.exp.json @@ -0,0 +1,511 @@ +{ + "fields": [ + { + "name": "a", + "composite": { + "fields": [ + { + "name": "b", + "references": [ + { + "string": { + "range": "TestCompile/patterns/double-glob/edge/2.d2,2:3:6-2:4:7", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + }, + "key_path": { + "range": "TestCompile/patterns/double-glob/edge/2.d2,2:0:3-2:4:7", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/patterns/double-glob/edge/2.d2,2:0:3-2:2:5", + "value": [ + { + "string": "**", + "raw_string": "**" + } + ], + "pattern": [ + "*", + "", + "*" + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/patterns/double-glob/edge/2.d2,2:3:6-2:4:7", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + } + ] + }, + "context": { + "edge": { + "range": "TestCompile/patterns/double-glob/edge/2.d2,2:0:3-2:9:12", + "src": { + "range": "TestCompile/patterns/double-glob/edge/2.d2,2:0:3-2:4:7", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/patterns/double-glob/edge/2.d2,2:0:3-2:2:5", + "value": [ + { + "string": "**", + "raw_string": "**" + } + ], + "pattern": [ + "*", + "", + "*" + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/patterns/double-glob/edge/2.d2,2:3:6-2:4:7", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + } + ] + }, + "src_arrow": "", + "dst": { + "range": "TestCompile/patterns/double-glob/edge/2.d2,2:8:11-2:9:12", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/patterns/double-glob/edge/2.d2,2:8:11-2:9:12", + "value": [ + { + "string": "c", + "raw_string": "c" + } + ] + } + } + ] + }, + "dst_arrow": ">" + }, + "key": { + "range": "TestCompile/patterns/double-glob/edge/2.d2,2:0:3-2:9:12", + "edges": [ + { + "range": "TestCompile/patterns/double-glob/edge/2.d2,2:0:3-2:9:12", + "src": { + "range": "TestCompile/patterns/double-glob/edge/2.d2,2:0:3-2:4:7", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/patterns/double-glob/edge/2.d2,2:0:3-2:2:5", + "value": [ + { + "string": "**", + "raw_string": "**" + } + ], + "pattern": [ + "*", + "", + "*" + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/patterns/double-glob/edge/2.d2,2:3:6-2:4:7", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + } + ] + }, + "src_arrow": "", + "dst": { + "range": "TestCompile/patterns/double-glob/edge/2.d2,2:8:11-2:9:12", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/patterns/double-glob/edge/2.d2,2:8:11-2:9:12", + "value": [ + { + "string": "c", + "raw_string": "c" + } + ] + } + } + ] + }, + "dst_arrow": ">" + } + ], + "primary": {}, + "value": {} + } + } + } + ] + } + ], + "edges": null + }, + "references": [ + { + "string": { + "range": "TestCompile/patterns/double-glob/edge/2.d2,0:0:0-0:1:1", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + }, + "key_path": { + "range": "TestCompile/patterns/double-glob/edge/2.d2,0:0:0-0:1:1", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/patterns/double-glob/edge/2.d2,0:0:0-0:1:1", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/patterns/double-glob/edge/2.d2,0:0:0-0:1:1", + "key": { + "range": "TestCompile/patterns/double-glob/edge/2.d2,0:0:0-0:1:1", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/patterns/double-glob/edge/2.d2,0:0:0-0:1:1", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + } + ] + }, + "primary": {}, + "value": {} + } + } + } + ] + }, + { + "name": "c", + "references": [ + { + "string": { + "range": "TestCompile/patterns/double-glob/edge/2.d2,2:8:11-2:9:12", + "value": [ + { + "string": "c", + "raw_string": "c" + } + ] + }, + "key_path": { + "range": "TestCompile/patterns/double-glob/edge/2.d2,2:8:11-2:9:12", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/patterns/double-glob/edge/2.d2,2:8:11-2:9:12", + "value": [ + { + "string": "c", + "raw_string": "c" + } + ] + } + } + ] + }, + "context": { + "edge": { + "range": "TestCompile/patterns/double-glob/edge/2.d2,2:0:3-2:9:12", + "src": { + "range": "TestCompile/patterns/double-glob/edge/2.d2,2:0:3-2:4:7", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/patterns/double-glob/edge/2.d2,2:0:3-2:2:5", + "value": [ + { + "string": "**", + "raw_string": "**" + } + ], + "pattern": [ + "*", + "", + "*" + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/patterns/double-glob/edge/2.d2,2:3:6-2:4:7", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + } + ] + }, + "src_arrow": "", + "dst": { + "range": "TestCompile/patterns/double-glob/edge/2.d2,2:8:11-2:9:12", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/patterns/double-glob/edge/2.d2,2:8:11-2:9:12", + "value": [ + { + "string": "c", + "raw_string": "c" + } + ] + } + } + ] + }, + "dst_arrow": ">" + }, + "key": { + "range": "TestCompile/patterns/double-glob/edge/2.d2,2:0:3-2:9:12", + "edges": [ + { + "range": "TestCompile/patterns/double-glob/edge/2.d2,2:0:3-2:9:12", + "src": { + "range": "TestCompile/patterns/double-glob/edge/2.d2,2:0:3-2:4:7", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/patterns/double-glob/edge/2.d2,2:0:3-2:2:5", + "value": [ + { + "string": "**", + "raw_string": "**" + } + ], + "pattern": [ + "*", + "", + "*" + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/patterns/double-glob/edge/2.d2,2:3:6-2:4:7", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + } + ] + }, + "src_arrow": "", + "dst": { + "range": "TestCompile/patterns/double-glob/edge/2.d2,2:8:11-2:9:12", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/patterns/double-glob/edge/2.d2,2:8:11-2:9:12", + "value": [ + { + "string": "c", + "raw_string": "c" + } + ] + } + } + ] + }, + "dst_arrow": ">" + } + ], + "primary": {}, + "value": {} + } + } + } + ] + } + ], + "edges": [ + { + "edge_id": { + "src_path": [ + "a", + "b" + ], + "src_arrow": false, + "dst_path": [ + "c" + ], + "dst_arrow": true, + "index": 0, + "glob": false + }, + "references": [ + { + "context": { + "edge": { + "range": "TestCompile/patterns/double-glob/edge/2.d2,2:0:3-2:9:12", + "src": { + "range": "TestCompile/patterns/double-glob/edge/2.d2,2:0:3-2:4:7", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/patterns/double-glob/edge/2.d2,2:0:3-2:2:5", + "value": [ + { + "string": "**", + "raw_string": "**" + } + ], + "pattern": [ + "*", + "", + "*" + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/patterns/double-glob/edge/2.d2,2:3:6-2:4:7", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + } + ] + }, + "src_arrow": "", + "dst": { + "range": "TestCompile/patterns/double-glob/edge/2.d2,2:8:11-2:9:12", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/patterns/double-glob/edge/2.d2,2:8:11-2:9:12", + "value": [ + { + "string": "c", + "raw_string": "c" + } + ] + } + } + ] + }, + "dst_arrow": ">" + }, + "key": { + "range": "TestCompile/patterns/double-glob/edge/2.d2,2:0:3-2:9:12", + "edges": [ + { + "range": "TestCompile/patterns/double-glob/edge/2.d2,2:0:3-2:9:12", + "src": { + "range": "TestCompile/patterns/double-glob/edge/2.d2,2:0:3-2:4:7", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/patterns/double-glob/edge/2.d2,2:0:3-2:2:5", + "value": [ + { + "string": "**", + "raw_string": "**" + } + ], + "pattern": [ + "*", + "", + "*" + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/patterns/double-glob/edge/2.d2,2:3:6-2:4:7", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + } + ] + }, + "src_arrow": "", + "dst": { + "range": "TestCompile/patterns/double-glob/edge/2.d2,2:8:11-2:9:12", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/patterns/double-glob/edge/2.d2,2:8:11-2:9:12", + "value": [ + { + "string": "c", + "raw_string": "c" + } + ] + } + } + ] + }, + "dst_arrow": ">" + } + ], + "primary": {}, + "value": {} + } + } + } + ] + } + ] +}