d2ir: Fix and add test for glob-edge-glob-index
This commit is contained in:
parent
b119174a09
commit
95667750e0
7 changed files with 4766 additions and 25 deletions
|
|
@ -396,7 +396,7 @@ func (c *compiler) compileKey(refctx *RefContext) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *compiler) compileField(dst *Map, kp *d2ast.KeyPath, refctx *RefContext) {
|
func (c *compiler) compileField(dst *Map, kp *d2ast.KeyPath, refctx *RefContext) {
|
||||||
fa, err := dst.EnsureField(kp, refctx)
|
fa, err := dst.EnsureField(kp, refctx, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.err.Errors = append(c.err.Errors, err.(d2ast.Error))
|
c.err.Errors = append(c.err.Errors, err.(d2ast.Error))
|
||||||
return
|
return
|
||||||
|
|
@ -614,7 +614,7 @@ func (c *compiler) compileEdges(refctx *RefContext) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
fa, err := refctx.ScopeMap.EnsureField(refctx.Key.Key, refctx)
|
fa, err := refctx.ScopeMap.EnsureField(refctx.Key.Key, refctx, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.err.Errors = append(c.err.Errors, err.(d2ast.Error))
|
c.err.Errors = append(c.err.Errors, err.(d2ast.Error))
|
||||||
return
|
return
|
||||||
|
|
@ -648,7 +648,7 @@ func (c *compiler) _compileEdges(refctx *RefContext) {
|
||||||
|
|
||||||
var ea []*Edge
|
var ea []*Edge
|
||||||
if eid.Index != nil || eid.Glob {
|
if eid.Index != nil || eid.Glob {
|
||||||
ea = refctx.ScopeMap.GetEdges(eid)
|
ea = refctx.ScopeMap.GetEdges(eid, refctx)
|
||||||
if len(ea) == 0 {
|
if len(ea) == 0 {
|
||||||
c.errorf(refctx.Edge, "indexed edge does not exist")
|
c.errorf(refctx.Edge, "indexed edge does not exist")
|
||||||
continue
|
continue
|
||||||
|
|
@ -661,12 +661,12 @@ func (c *compiler) _compileEdges(refctx *RefContext) {
|
||||||
refctx.ScopeMap.appendFieldReferences(0, refctx.Edge.Dst, refctx)
|
refctx.ScopeMap.appendFieldReferences(0, refctx.Edge.Dst, refctx)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
_, err := refctx.ScopeMap.EnsureField(refctx.Edge.Src, refctx)
|
_, err := refctx.ScopeMap.EnsureField(refctx.Edge.Src, refctx, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.err.Errors = append(c.err.Errors, err.(d2ast.Error))
|
c.err.Errors = append(c.err.Errors, err.(d2ast.Error))
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
_, err = refctx.ScopeMap.EnsureField(refctx.Edge.Dst, refctx)
|
_, err = refctx.ScopeMap.EnsureField(refctx.Edge.Dst, refctx, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.err.Errors = append(c.err.Errors, err.(d2ast.Error))
|
c.err.Errors = append(c.err.Errors, err.(d2ast.Error))
|
||||||
continue
|
continue
|
||||||
|
|
|
||||||
136
d2ir/d2ir.go
136
d2ir/d2ir.go
|
|
@ -653,7 +653,7 @@ func (m *Map) getField(ida []string) *Field {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Map) EnsureField(kp *d2ast.KeyPath, refctx *RefContext) ([]*Field, error) {
|
func (m *Map) EnsureField(kp *d2ast.KeyPath, refctx *RefContext, create bool) ([]*Field, error) {
|
||||||
i := 0
|
i := 0
|
||||||
for kp.Path[i].Unbox().ScalarString() == "_" {
|
for kp.Path[i].Unbox().ScalarString() == "_" {
|
||||||
m = ParentMap(m)
|
m = ParentMap(m)
|
||||||
|
|
@ -667,11 +667,11 @@ func (m *Map) EnsureField(kp *d2ast.KeyPath, refctx *RefContext) ([]*Field, erro
|
||||||
}
|
}
|
||||||
|
|
||||||
var fa []*Field
|
var fa []*Field
|
||||||
err := m.ensureField(i, kp, refctx, &fa)
|
err := m.ensureField(i, kp, refctx, create, &fa)
|
||||||
return fa, err
|
return fa, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Map) ensureField(i int, kp *d2ast.KeyPath, refctx *RefContext, fa *[]*Field) error {
|
func (m *Map) ensureField(i int, kp *d2ast.KeyPath, refctx *RefContext, create bool, fa *[]*Field) error {
|
||||||
us, ok := kp.Path[i].Unbox().(*d2ast.UnquotedString)
|
us, ok := kp.Path[i].Unbox().(*d2ast.UnquotedString)
|
||||||
if ok && us.Pattern != nil {
|
if ok && us.Pattern != nil {
|
||||||
fa2, ok := m.doubleGlob(us.Pattern)
|
fa2, ok := m.doubleGlob(us.Pattern)
|
||||||
|
|
@ -685,7 +685,7 @@ func (m *Map) ensureField(i int, kp *d2ast.KeyPath, refctx *RefContext, fa *[]*F
|
||||||
parent: f,
|
parent: f,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
err := f.Map().ensureField(i+1, kp, refctx, fa)
|
err := f.Map().ensureField(i+1, kp, refctx, create, fa)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
@ -703,7 +703,7 @@ func (m *Map) ensureField(i int, kp *d2ast.KeyPath, refctx *RefContext, fa *[]*F
|
||||||
parent: f,
|
parent: f,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
err := f.Map().ensureField(i+1, kp, refctx, fa)
|
err := f.Map().ensureField(i+1, kp, refctx, create, fa)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
@ -760,9 +760,12 @@ func (m *Map) ensureField(i int, kp *d2ast.KeyPath, refctx *RefContext, fa *[]*F
|
||||||
parent: f,
|
parent: f,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return f.Map().ensureField(i+1, kp, refctx, fa)
|
return f.Map().ensureField(i+1, kp, refctx, create, fa)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !create {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
f := &Field{
|
f := &Field{
|
||||||
parent: m,
|
parent: m,
|
||||||
Name: head,
|
Name: head,
|
||||||
|
|
@ -783,7 +786,7 @@ func (m *Map) ensureField(i int, kp *d2ast.KeyPath, refctx *RefContext, fa *[]*F
|
||||||
f.Composite = &Map{
|
f.Composite = &Map{
|
||||||
parent: f,
|
parent: f,
|
||||||
}
|
}
|
||||||
return f.Map().ensureField(i+1, kp, refctx, fa)
|
return f.Map().ensureField(i+1, kp, refctx, create, fa)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Map) DeleteEdge(eid *EdgeID) *Edge {
|
func (m *Map) DeleteEdge(eid *EdgeID) *Edge {
|
||||||
|
|
@ -848,7 +851,13 @@ func (m *Map) DeleteField(ida ...string) *Field {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Map) GetEdges(eid *EdgeID) []*Edge {
|
func (m *Map) GetEdges(eid *EdgeID, refctx *RefContext) []*Edge {
|
||||||
|
if refctx != nil {
|
||||||
|
var ea []*Edge
|
||||||
|
m.getEdges(eid, refctx, &ea)
|
||||||
|
return ea
|
||||||
|
}
|
||||||
|
|
||||||
eid, m, common, err := eid.resolve(m)
|
eid, m, common, err := eid.resolve(m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil
|
return nil
|
||||||
|
|
@ -859,7 +868,7 @@ func (m *Map) GetEdges(eid *EdgeID) []*Edge {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if f.Map() != nil {
|
if f.Map() != nil {
|
||||||
return f.Map().GetEdges(eid)
|
return f.Map().GetEdges(eid, nil)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
@ -873,6 +882,90 @@ func (m *Map) GetEdges(eid *EdgeID) []*Edge {
|
||||||
return ea
|
return ea
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *Map) getEdges(eid *EdgeID, refctx *RefContext, ea *[]*Edge) error {
|
||||||
|
eid, m, common, err := eid.resolve(m)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(common) > 0 {
|
||||||
|
commonKP := d2ast.MakeKeyPath(common)
|
||||||
|
lastMatch := 0
|
||||||
|
for i, el := range commonKP.Path {
|
||||||
|
for j := lastMatch; j < len(refctx.Edge.Src.Path); j++ {
|
||||||
|
realEl := refctx.Edge.Src.Path[j]
|
||||||
|
if el.ScalarString() == realEl.ScalarString() {
|
||||||
|
commonKP.Path[i] = realEl
|
||||||
|
lastMatch += j + 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fa, err := m.EnsureField(commonKP, nil, false)
|
||||||
|
if err != nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
for _, f := range fa {
|
||||||
|
if _, ok := f.Composite.(*Array); ok {
|
||||||
|
return d2parser.Errorf(refctx.Edge.Src, "cannot index into array")
|
||||||
|
}
|
||||||
|
if f.Map() == nil {
|
||||||
|
f.Composite = &Map{
|
||||||
|
parent: f,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
err = f.Map().getEdges(eid, refctx, ea)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
dstFA, err := m.EnsureField(dstKP, nil, false)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, src := range srcFA {
|
||||||
|
for _, dst := range dstFA {
|
||||||
|
eid2 := eid.Copy()
|
||||||
|
eid2.SrcPath = RelIDA(m, src)
|
||||||
|
eid2.DstPath = RelIDA(m, dst)
|
||||||
|
|
||||||
|
ea2 := m.GetEdges(eid2, nil)
|
||||||
|
*ea = append(*ea, ea2...)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (m *Map) CreateEdge(eid *EdgeID, refctx *RefContext) ([]*Edge, error) {
|
func (m *Map) CreateEdge(eid *EdgeID, refctx *RefContext) ([]*Edge, error) {
|
||||||
var ea []*Edge
|
var ea []*Edge
|
||||||
return ea, m.createEdge(eid, refctx, &ea)
|
return ea, m.createEdge(eid, refctx, &ea)
|
||||||
|
|
@ -888,11 +981,18 @@ func (m *Map) createEdge(eid *EdgeID, refctx *RefContext, ea *[]*Edge) error {
|
||||||
return d2parser.Errorf(refctx.Edge, err.Error())
|
return d2parser.Errorf(refctx.Edge, err.Error())
|
||||||
}
|
}
|
||||||
if len(common) > 0 {
|
if len(common) > 0 {
|
||||||
commonEnd := len(refctx.Edge.Src.Path) - len(eid.SrcPath)
|
commonKP := d2ast.MakeKeyPath(common)
|
||||||
commonStart := commonEnd - len(common)
|
lastMatch := 0
|
||||||
commonKP := refctx.Edge.Src.Copy()
|
for i, el := range commonKP.Path {
|
||||||
commonKP.Path = commonKP.Path[commonStart:commonEnd]
|
for j := lastMatch; j < len(refctx.Edge.Src.Path); j++ {
|
||||||
fa, err := m.EnsureField(commonKP, nil)
|
realEl := refctx.Edge.Src.Path[j]
|
||||||
|
if el.ScalarString() == realEl.ScalarString() {
|
||||||
|
commonKP.Path[i] = realEl
|
||||||
|
lastMatch += j + 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fa, err := m.EnsureField(commonKP, nil, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
@ -954,11 +1054,11 @@ func (m *Map) createEdge(eid *EdgeID, refctx *RefContext, ea *[]*Edge) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
srcFA, err := m.EnsureField(srcKP, nil)
|
srcFA, err := m.EnsureField(srcKP, nil, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
dstFA, err := m.EnsureField(dstKP, nil)
|
dstFA, err := m.EnsureField(dstKP, nil, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
@ -990,9 +1090,11 @@ func (m *Map) createEdge2(eid *EdgeID, refctx *RefContext, src, dst *Field) (*Ed
|
||||||
}
|
}
|
||||||
|
|
||||||
eid.Index = nil
|
eid.Index = nil
|
||||||
ea := m.GetEdges(eid)
|
eid.Glob = true
|
||||||
|
ea := m.GetEdges(eid, refctx)
|
||||||
index := len(ea)
|
index := len(ea)
|
||||||
eid.Index = &index
|
eid.Index = &index
|
||||||
|
eid.Glob = false
|
||||||
e := &Edge{
|
e := &Edge{
|
||||||
parent: m,
|
parent: m,
|
||||||
ID: eid,
|
ID: eid,
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ func OverlayMap(base, overlay *Map) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, oe := range overlay.Edges {
|
for _, oe := range overlay.Edges {
|
||||||
bea := base.GetEdges(oe.ID)
|
bea := base.GetEdges(oe.ID, nil)
|
||||||
if len(bea) == 0 {
|
if len(bea) == 0 {
|
||||||
base.Edges = append(base.Edges, oe.Copy(base).(*Edge))
|
base.Edges = append(base.Edges, oe.Copy(base).(*Edge))
|
||||||
continue
|
continue
|
||||||
|
|
|
||||||
|
|
@ -148,6 +148,23 @@ a -> b
|
||||||
assertQuery(t, m, 0, 0, "red", "(a -> b)[2].style.fill")
|
assertQuery(t, m, 0, 0, "red", "(a -> b)[2].style.fill")
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "glob-edge-glob-index",
|
||||||
|
run: func(t testing.TB) {
|
||||||
|
m, err := compile(t, `a -> b
|
||||||
|
a -> b
|
||||||
|
a -> b
|
||||||
|
c -> b
|
||||||
|
(* -> b)[*].style.fill: red
|
||||||
|
`)
|
||||||
|
assert.Success(t, err)
|
||||||
|
assertQuery(t, m, 11, 4, nil, "")
|
||||||
|
assertQuery(t, m, 0, 0, "red", "(a -> b)[0].style.fill")
|
||||||
|
assertQuery(t, m, 0, 0, "red", "(a -> b)[1].style.fill")
|
||||||
|
assertQuery(t, m, 0, 0, "red", "(a -> b)[2].style.fill")
|
||||||
|
assertQuery(t, m, 0, 0, "red", "(c -> b)[0].style.fill")
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "double-glob/1",
|
name: "double-glob/1",
|
||||||
run: func(t testing.TB) {
|
run: func(t testing.TB) {
|
||||||
|
|
@ -169,7 +186,17 @@ shared.animal
|
||||||
runa(t, tca)
|
runa(t, tca)
|
||||||
|
|
||||||
t.Run("errors", func(t *testing.T) {
|
t.Run("errors", func(t *testing.T) {
|
||||||
tca := []testCase{}
|
tca := []testCase{
|
||||||
|
{
|
||||||
|
name: "glob-edge-glob-index",
|
||||||
|
run: func(t testing.TB) {
|
||||||
|
m, err := compile(t, `(* -> b)[*].style.fill: red
|
||||||
|
`)
|
||||||
|
assert.ErrorString(t, err, `TestCompile/patterns/errors/glob-edge-glob-index.d2:1:2: indexed edge does not exist`)
|
||||||
|
assertQuery(t, m, 0, 0, nil, "")
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
runa(t, tca)
|
runa(t, tca)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ func (m *Map) QueryAll(idStr string) (na []Node, _ error) {
|
||||||
|
|
||||||
eida := NewEdgeIDs(k)
|
eida := NewEdgeIDs(k)
|
||||||
for _, eid := range eida {
|
for _, eid := range eida {
|
||||||
ea := m.GetEdges(eid)
|
ea := m.GetEdges(eid, nil)
|
||||||
for _, e := range ea {
|
for _, e := range ea {
|
||||||
if k.EdgeKey == nil {
|
if k.EdgeKey == nil {
|
||||||
na = append(na, e)
|
na = append(na, e)
|
||||||
|
|
|
||||||
667
testdata/d2ir/TestCompile/patterns/errors/glob-edge-glob-index.exp.json
generated
vendored
Normal file
667
testdata/d2ir/TestCompile/patterns/errors/glob-edge-glob-index.exp.json
generated
vendored
Normal file
|
|
@ -0,0 +1,667 @@
|
||||||
|
{
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"name": "b",
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"string": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:6:6-0:7:7",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "b",
|
||||||
|
"raw_string": "b"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"key_path": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:6:6-0:7:7",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:6:6-0:7:7",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "b",
|
||||||
|
"raw_string": "b"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"context": {
|
||||||
|
"edge": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:1:1-0:7:7",
|
||||||
|
"src": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:1:1-0:2:2",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:1:1-0:2:2",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "*",
|
||||||
|
"raw_string": "*"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"pattern": [
|
||||||
|
"*"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"src_arrow": "",
|
||||||
|
"dst": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:6:6-0:7:7",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:6:6-0:7:7",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "b",
|
||||||
|
"raw_string": "b"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"dst_arrow": ">"
|
||||||
|
},
|
||||||
|
"key": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:0:0-0:24:24",
|
||||||
|
"edges": [
|
||||||
|
{
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:1:1-0:7:7",
|
||||||
|
"src": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:1:1-0:2:2",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:1:1-0:2:2",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "*",
|
||||||
|
"raw_string": "*"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"pattern": [
|
||||||
|
"*"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"src_arrow": "",
|
||||||
|
"dst": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:6:6-0:7:7",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:6:6-0:7:7",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "b",
|
||||||
|
"raw_string": "b"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"dst_arrow": ">"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"edge_key": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:9:9-0:19:19",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:9:9-0:14:14",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "style",
|
||||||
|
"raw_string": "style"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:15:15-0:19:19",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "fill",
|
||||||
|
"raw_string": "fill"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"primary": {},
|
||||||
|
"value": {
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:21:21-0:24:24",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "red",
|
||||||
|
"raw_string": "red"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"edges": [
|
||||||
|
{
|
||||||
|
"edge_id": {
|
||||||
|
"src_path": [
|
||||||
|
"b"
|
||||||
|
],
|
||||||
|
"src_arrow": false,
|
||||||
|
"dst_path": [
|
||||||
|
"b"
|
||||||
|
],
|
||||||
|
"dst_arrow": true,
|
||||||
|
"index": 0,
|
||||||
|
"glob": false
|
||||||
|
},
|
||||||
|
"map": {
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"name": "style",
|
||||||
|
"composite": {
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"name": "fill",
|
||||||
|
"primary": {
|
||||||
|
"value": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:21:21-0:24:24",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "red",
|
||||||
|
"raw_string": "red"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"string": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:15:15-0:19:19",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "fill",
|
||||||
|
"raw_string": "fill"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"key_path": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:9:9-0:19:19",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:9:9-0:14:14",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "style",
|
||||||
|
"raw_string": "style"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:15:15-0:19:19",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "fill",
|
||||||
|
"raw_string": "fill"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"context": {
|
||||||
|
"edge": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:1:1-0:7:7",
|
||||||
|
"src": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:1:1-0:2:2",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:1:1-0:2:2",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "*",
|
||||||
|
"raw_string": "*"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"pattern": [
|
||||||
|
"*"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"src_arrow": "",
|
||||||
|
"dst": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:6:6-0:7:7",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:6:6-0:7:7",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "b",
|
||||||
|
"raw_string": "b"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"dst_arrow": ">"
|
||||||
|
},
|
||||||
|
"key": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:0:0-0:24:24",
|
||||||
|
"edges": [
|
||||||
|
{
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:1:1-0:7:7",
|
||||||
|
"src": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:1:1-0:2:2",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:1:1-0:2:2",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "*",
|
||||||
|
"raw_string": "*"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"pattern": [
|
||||||
|
"*"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"src_arrow": "",
|
||||||
|
"dst": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:6:6-0:7:7",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:6:6-0:7:7",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "b",
|
||||||
|
"raw_string": "b"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"dst_arrow": ">"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"edge_key": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:9:9-0:19:19",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:9:9-0:14:14",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "style",
|
||||||
|
"raw_string": "style"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:15:15-0:19:19",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "fill",
|
||||||
|
"raw_string": "fill"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"primary": {},
|
||||||
|
"value": {
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:21:21-0:24:24",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "red",
|
||||||
|
"raw_string": "red"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"edges": null
|
||||||
|
},
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"string": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:9:9-0:14:14",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "style",
|
||||||
|
"raw_string": "style"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"key_path": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:9:9-0:19:19",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:9:9-0:14:14",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "style",
|
||||||
|
"raw_string": "style"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:15:15-0:19:19",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "fill",
|
||||||
|
"raw_string": "fill"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"context": {
|
||||||
|
"edge": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:1:1-0:7:7",
|
||||||
|
"src": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:1:1-0:2:2",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:1:1-0:2:2",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "*",
|
||||||
|
"raw_string": "*"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"pattern": [
|
||||||
|
"*"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"src_arrow": "",
|
||||||
|
"dst": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:6:6-0:7:7",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:6:6-0:7:7",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "b",
|
||||||
|
"raw_string": "b"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"dst_arrow": ">"
|
||||||
|
},
|
||||||
|
"key": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:0:0-0:24:24",
|
||||||
|
"edges": [
|
||||||
|
{
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:1:1-0:7:7",
|
||||||
|
"src": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:1:1-0:2:2",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:1:1-0:2:2",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "*",
|
||||||
|
"raw_string": "*"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"pattern": [
|
||||||
|
"*"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"src_arrow": "",
|
||||||
|
"dst": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:6:6-0:7:7",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:6:6-0:7:7",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "b",
|
||||||
|
"raw_string": "b"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"dst_arrow": ">"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"edge_key": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:9:9-0:19:19",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:9:9-0:14:14",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "style",
|
||||||
|
"raw_string": "style"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:15:15-0:19:19",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "fill",
|
||||||
|
"raw_string": "fill"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"primary": {},
|
||||||
|
"value": {
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:21:21-0:24:24",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "red",
|
||||||
|
"raw_string": "red"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"edges": null
|
||||||
|
},
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"context": {
|
||||||
|
"edge": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:1:1-0:7:7",
|
||||||
|
"src": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:1:1-0:2:2",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:1:1-0:2:2",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "*",
|
||||||
|
"raw_string": "*"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"pattern": [
|
||||||
|
"*"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"src_arrow": "",
|
||||||
|
"dst": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:6:6-0:7:7",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:6:6-0:7:7",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "b",
|
||||||
|
"raw_string": "b"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"dst_arrow": ">"
|
||||||
|
},
|
||||||
|
"key": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:0:0-0:24:24",
|
||||||
|
"edges": [
|
||||||
|
{
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:1:1-0:7:7",
|
||||||
|
"src": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:1:1-0:2:2",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:1:1-0:2:2",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "*",
|
||||||
|
"raw_string": "*"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"pattern": [
|
||||||
|
"*"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"src_arrow": "",
|
||||||
|
"dst": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:6:6-0:7:7",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:6:6-0:7:7",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "b",
|
||||||
|
"raw_string": "b"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"dst_arrow": ">"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"edge_key": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:9:9-0:19:19",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:9:9-0:14:14",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "style",
|
||||||
|
"raw_string": "style"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:15:15-0:19:19",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "fill",
|
||||||
|
"raw_string": "fill"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"primary": {},
|
||||||
|
"value": {
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/patterns/errors/glob-edge-glob-index.d2,0:21:21-0:24:24",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "red",
|
||||||
|
"raw_string": "red"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
3945
testdata/d2ir/TestCompile/patterns/glob-edge-glob-index.exp.json
generated
vendored
Normal file
3945
testdata/d2ir/TestCompile/patterns/glob-edge-glob-index.exp.json
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue