fix underscore again
This commit is contained in:
parent
fe8efdf09e
commit
877ff5d9f2
4 changed files with 1269 additions and 25 deletions
117
d2oracle/edit.go
117
d2oracle/edit.go
|
|
@ -205,18 +205,9 @@ func ReconnectEdge(g *d2graph.Graph, edgeKey string, srcKey, dstKey *string) (_
|
|||
return recompile(g)
|
||||
}
|
||||
|
||||
func pathFromScope(g *d2graph.Graph, key *d2ast.Key, fromScope *d2graph.Object) ([]*d2ast.StringBox, error) {
|
||||
func pathFromScopeKey(g *d2graph.Graph, key *d2ast.Key, scopeak []string) ([]*d2ast.StringBox, error) {
|
||||
ak2 := d2graph.Key(key.Key)
|
||||
|
||||
// We don't want this to be underscore-resolved scope. We want to ignore underscores
|
||||
var scopeak []string
|
||||
if fromScope != g.Root {
|
||||
scopek, err := d2parser.ParseKey(fromScope.AbsID())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
scopeak = d2graph.Key(scopek)
|
||||
}
|
||||
commonPath := getCommonPath(scopeak, ak2)
|
||||
|
||||
var newPath []*d2ast.StringBox
|
||||
|
|
@ -230,6 +221,19 @@ func pathFromScope(g *d2graph.Graph, key *d2ast.Key, fromScope *d2graph.Object)
|
|||
return newPath, nil
|
||||
}
|
||||
|
||||
func pathFromScope(g *d2graph.Graph, key *d2ast.Key, fromScope *d2graph.Object) ([]*d2ast.StringBox, error) {
|
||||
// We don't want this to be underscore-resolved scope. We want to ignore underscores
|
||||
var scopeak []string
|
||||
if fromScope != g.Root {
|
||||
scopek, err := d2parser.ParseKey(fromScope.AbsID())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
scopeak = d2graph.Key(scopek)
|
||||
}
|
||||
return pathFromScopeKey(g, key, scopeak)
|
||||
}
|
||||
|
||||
func recompile(g *d2graph.Graph) (*d2graph.Graph, error) {
|
||||
s := d2format.Format(g.AST)
|
||||
g, err := d2compiler.Compile(g.AST.Range.Path, strings.NewReader(s), nil)
|
||||
|
|
@ -1591,26 +1595,89 @@ func move(g *d2graph.Graph, key, newKey string, includeDescendants bool) (*d2gra
|
|||
return x.Unbox().ScalarString() != "_"
|
||||
})
|
||||
detachedMK.Value = ref.MapKey.Value
|
||||
if ref.MapKey != nil && ref.MapKey.Value.Map != nil && !includeDescendants {
|
||||
detachedMK.Value.Map = &d2ast.Map{
|
||||
Range: ref.MapKey.Value.Map.Range,
|
||||
}
|
||||
for _, n := range ref.MapKey.Value.Map.Nodes {
|
||||
if n.MapKey == nil {
|
||||
continue
|
||||
if ref.MapKey != nil && ref.MapKey.Value.Map != nil {
|
||||
// Without including descendants, just copy over the reserved
|
||||
if !includeDescendants {
|
||||
detachedMK.Value.Map = &d2ast.Map{
|
||||
Range: ref.MapKey.Value.Map.Range,
|
||||
}
|
||||
if n.MapKey.Key != nil {
|
||||
_, ok := d2graph.ReservedKeywords[n.MapKey.Key.Path[0].Unbox().ScalarString()]
|
||||
if ok {
|
||||
detachedMK.Value.Map.Nodes = append(detachedMK.Value.Map.Nodes, n)
|
||||
for _, n := range ref.MapKey.Value.Map.Nodes {
|
||||
if n.MapKey == nil {
|
||||
continue
|
||||
}
|
||||
if n.MapKey.Key != nil {
|
||||
_, ok := d2graph.ReservedKeywords[n.MapKey.Key.Path[0].Unbox().ScalarString()]
|
||||
if ok {
|
||||
detachedMK.Value.Map.Nodes = append(detachedMK.Value.Map.Nodes, n)
|
||||
}
|
||||
}
|
||||
}
|
||||
if len(detachedMK.Value.Map.Nodes) == 0 {
|
||||
detachedMK.Value.Map = nil
|
||||
}
|
||||
} else {
|
||||
// Usually copy everything as is when including descendants
|
||||
// The exception is underscored keys, which need to be updated
|
||||
for _, n := range ref.MapKey.Value.Map.Nodes {
|
||||
if n.MapKey == nil {
|
||||
continue
|
||||
}
|
||||
if n.MapKey.Key != nil {
|
||||
if n.MapKey.Key.Path[0].Unbox().ScalarString() == "_" {
|
||||
resolvedParent, resolvedScopeKey, err := d2graph.ResolveUnderscoreKey(d2graph.Key(n.MapKey.Key), obj)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
resolvedObj, ok := resolvedParent.HasChild(resolvedScopeKey)
|
||||
if !ok {
|
||||
return nil, errors.New("underscore key does not exist")
|
||||
}
|
||||
|
||||
newPath, err := pathFromScopeKey(g, &d2ast.Key{Key: d2ast.MakeKeyPath(resolvedObj.AbsIDArray())}, ak2)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
n.MapKey.Key.Path = newPath
|
||||
}
|
||||
}
|
||||
for _, e := range n.MapKey.Edges {
|
||||
if e.Src.Path[0].Unbox().ScalarString() == "_" {
|
||||
resolvedParent, resolvedScopeKey, err := d2graph.ResolveUnderscoreKey(d2graph.Key(e.Src), obj)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
resolvedObj, ok := resolvedParent.HasChild(resolvedScopeKey)
|
||||
if !ok {
|
||||
return nil, errors.New("underscore key does not exist")
|
||||
}
|
||||
newPath, err := pathFromScopeKey(g, &d2ast.Key{Key: d2ast.MakeKeyPath(resolvedObj.AbsIDArray())}, ak2)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
e.Src.Path = newPath
|
||||
}
|
||||
if e.Dst.Path[0].Unbox().ScalarString() == "_" {
|
||||
resolvedParent, resolvedScopeKey, err := d2graph.ResolveUnderscoreKey(d2graph.Key(e.Dst), obj)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
resolvedObj, ok := resolvedParent.HasChild(resolvedScopeKey)
|
||||
if !ok {
|
||||
return nil, errors.New("underscore key does not exist")
|
||||
}
|
||||
newPath, err := pathFromScopeKey(g, &d2ast.Key{Key: d2ast.MakeKeyPath(resolvedObj.AbsIDArray())}, ak2)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
e.Dst.Path = newPath
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if len(detachedMK.Value.Map.Nodes) == 0 {
|
||||
detachedMK.Value.Map = nil
|
||||
}
|
||||
}
|
||||
|
||||
appendUniqueMapKey(toScope, detachedMK)
|
||||
} else if len(ida) > 1 && (endsWithReserved || !isExplicit || go2.Contains(mostNestedRefs, ref)) {
|
||||
// 2. Split
|
||||
|
|
|
|||
|
|
@ -4197,6 +4197,44 @@ github: {
|
|||
_.aws
|
||||
workflows
|
||||
}
|
||||
`,
|
||||
},
|
||||
{
|
||||
name: "include_descendants_underscore_2",
|
||||
text: `a: {
|
||||
b: {
|
||||
_.c
|
||||
}
|
||||
}
|
||||
`,
|
||||
key: `a.b`,
|
||||
newKey: `b`,
|
||||
includeDescendants: true,
|
||||
|
||||
exp: `a
|
||||
b: {
|
||||
_.a.c
|
||||
}
|
||||
`,
|
||||
},
|
||||
{
|
||||
name: "include_descendants_underscore_3",
|
||||
text: `a: {
|
||||
b: {
|
||||
_.c -> d
|
||||
_.c -> _.d
|
||||
}
|
||||
}
|
||||
`,
|
||||
key: `a.b`,
|
||||
newKey: `b`,
|
||||
includeDescendants: true,
|
||||
|
||||
exp: `a
|
||||
b: {
|
||||
_.a.c -> d
|
||||
_.a.c -> _.a.d
|
||||
}
|
||||
`,
|
||||
},
|
||||
{
|
||||
|
|
@ -6698,6 +6736,41 @@ b
|
|||
"(x -> y.z.a)[0]": "(x -> b.z.a)[0]",
|
||||
"y.z": "b.z",
|
||||
"y.z.a": "b.z.a"
|
||||
}`,
|
||||
},
|
||||
{
|
||||
name: "include_descendants_underscore_2",
|
||||
text: `a: {
|
||||
b: {
|
||||
_.c
|
||||
}
|
||||
}
|
||||
`,
|
||||
key: `a.b`,
|
||||
newKey: `b`,
|
||||
includeDescendants: true,
|
||||
|
||||
exp: `{
|
||||
"a.b": "b"
|
||||
}`,
|
||||
},
|
||||
{
|
||||
name: "include_descendants_underscore_3",
|
||||
text: `a: {
|
||||
b: {
|
||||
_.c -> d
|
||||
_.c -> _.d
|
||||
}
|
||||
}
|
||||
`,
|
||||
key: `a.b`,
|
||||
newKey: `b`,
|
||||
includeDescendants: true,
|
||||
|
||||
exp: `{
|
||||
"a.(c -> b.d)[0]": "(a.c -> b.d)[0]",
|
||||
"a.b": "b",
|
||||
"a.b.d": "b.d"
|
||||
}`,
|
||||
},
|
||||
{
|
||||
|
|
|
|||
342
testdata/d2oracle/TestMove/include_descendants_underscore_2.exp.json
generated
vendored
Normal file
342
testdata/d2oracle/TestMove/include_descendants_underscore_2.exp.json
generated
vendored
Normal file
|
|
@ -0,0 +1,342 @@
|
|||
{
|
||||
"graph": {
|
||||
"name": "",
|
||||
"isFolderOnly": false,
|
||||
"ast": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_2.d2,0:0:0-4:0:17",
|
||||
"nodes": [
|
||||
{
|
||||
"map_key": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_2.d2,0:0:0-0:1:1",
|
||||
"key": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_2.d2,0:0:0-0:1:1",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_2.d2,0:0:0-0:1:1",
|
||||
"value": [
|
||||
{
|
||||
"string": "a",
|
||||
"raw_string": "a"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"primary": {},
|
||||
"value": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"map_key": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_2.d2,1:0:2-3:1:16",
|
||||
"key": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_2.d2,1:0:2-1:1:3",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_2.d2,1:0:2-1:1:3",
|
||||
"value": [
|
||||
{
|
||||
"string": "b",
|
||||
"raw_string": "b"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"primary": {},
|
||||
"value": {
|
||||
"map": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_2.d2,1:3:5-3:0:15",
|
||||
"nodes": [
|
||||
{
|
||||
"map_key": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_2.d2,2:2:9-2:7:14",
|
||||
"key": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_2.d2,2:2:9-2:7:14",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_2.d2,2:2:9-2:3:10",
|
||||
"value": [
|
||||
{
|
||||
"string": "_",
|
||||
"raw_string": "_"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_2.d2,2:4:11-2:5:12",
|
||||
"value": [
|
||||
{
|
||||
"string": "a",
|
||||
"raw_string": "a"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_2.d2,2:6:13-2:7:14",
|
||||
"value": [
|
||||
{
|
||||
"string": "c",
|
||||
"raw_string": "c"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"primary": {},
|
||||
"value": {}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"root": {
|
||||
"id": "",
|
||||
"id_val": "",
|
||||
"attributes": {
|
||||
"label": {
|
||||
"value": ""
|
||||
},
|
||||
"labelDimensions": {
|
||||
"width": 0,
|
||||
"height": 0
|
||||
},
|
||||
"style": {},
|
||||
"near_key": null,
|
||||
"shape": {
|
||||
"value": ""
|
||||
},
|
||||
"direction": {
|
||||
"value": ""
|
||||
},
|
||||
"constraint": {
|
||||
"value": ""
|
||||
}
|
||||
},
|
||||
"zIndex": 0
|
||||
},
|
||||
"edges": null,
|
||||
"objects": [
|
||||
{
|
||||
"id": "a",
|
||||
"id_val": "a",
|
||||
"references": [
|
||||
{
|
||||
"key": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_2.d2,0:0:0-0:1:1",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_2.d2,0:0:0-0:1:1",
|
||||
"value": [
|
||||
{
|
||||
"string": "a",
|
||||
"raw_string": "a"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"key_path_index": 0,
|
||||
"map_key_edge_index": -1
|
||||
},
|
||||
{
|
||||
"key": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_2.d2,2:2:9-2:7:14",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_2.d2,2:2:9-2:3:10",
|
||||
"value": [
|
||||
{
|
||||
"string": "_",
|
||||
"raw_string": "_"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_2.d2,2:4:11-2:5:12",
|
||||
"value": [
|
||||
{
|
||||
"string": "a",
|
||||
"raw_string": "a"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_2.d2,2:6:13-2:7:14",
|
||||
"value": [
|
||||
{
|
||||
"string": "c",
|
||||
"raw_string": "c"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"key_path_index": 1,
|
||||
"map_key_edge_index": -1
|
||||
}
|
||||
],
|
||||
"attributes": {
|
||||
"label": {
|
||||
"value": "a"
|
||||
},
|
||||
"labelDimensions": {
|
||||
"width": 0,
|
||||
"height": 0
|
||||
},
|
||||
"style": {},
|
||||
"near_key": null,
|
||||
"shape": {
|
||||
"value": "rectangle"
|
||||
},
|
||||
"direction": {
|
||||
"value": ""
|
||||
},
|
||||
"constraint": {
|
||||
"value": ""
|
||||
}
|
||||
},
|
||||
"zIndex": 0
|
||||
},
|
||||
{
|
||||
"id": "b",
|
||||
"id_val": "b",
|
||||
"references": [
|
||||
{
|
||||
"key": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_2.d2,1:0:2-1:1:3",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_2.d2,1:0:2-1:1:3",
|
||||
"value": [
|
||||
{
|
||||
"string": "b",
|
||||
"raw_string": "b"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"key_path_index": 0,
|
||||
"map_key_edge_index": -1
|
||||
}
|
||||
],
|
||||
"attributes": {
|
||||
"label": {
|
||||
"value": "b"
|
||||
},
|
||||
"labelDimensions": {
|
||||
"width": 0,
|
||||
"height": 0
|
||||
},
|
||||
"style": {},
|
||||
"near_key": null,
|
||||
"shape": {
|
||||
"value": "rectangle"
|
||||
},
|
||||
"direction": {
|
||||
"value": ""
|
||||
},
|
||||
"constraint": {
|
||||
"value": ""
|
||||
}
|
||||
},
|
||||
"zIndex": 0
|
||||
},
|
||||
{
|
||||
"id": "c",
|
||||
"id_val": "c",
|
||||
"references": [
|
||||
{
|
||||
"key": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_2.d2,2:2:9-2:7:14",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_2.d2,2:2:9-2:3:10",
|
||||
"value": [
|
||||
{
|
||||
"string": "_",
|
||||
"raw_string": "_"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_2.d2,2:4:11-2:5:12",
|
||||
"value": [
|
||||
{
|
||||
"string": "a",
|
||||
"raw_string": "a"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_2.d2,2:6:13-2:7:14",
|
||||
"value": [
|
||||
{
|
||||
"string": "c",
|
||||
"raw_string": "c"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"key_path_index": 2,
|
||||
"map_key_edge_index": -1
|
||||
}
|
||||
],
|
||||
"attributes": {
|
||||
"label": {
|
||||
"value": "c"
|
||||
},
|
||||
"labelDimensions": {
|
||||
"width": 0,
|
||||
"height": 0
|
||||
},
|
||||
"style": {},
|
||||
"near_key": null,
|
||||
"shape": {
|
||||
"value": "rectangle"
|
||||
},
|
||||
"direction": {
|
||||
"value": ""
|
||||
},
|
||||
"constraint": {
|
||||
"value": ""
|
||||
}
|
||||
},
|
||||
"zIndex": 0
|
||||
}
|
||||
]
|
||||
},
|
||||
"err": "<nil>"
|
||||
}
|
||||
762
testdata/d2oracle/TestMove/include_descendants_underscore_3.exp.json
generated
vendored
Normal file
762
testdata/d2oracle/TestMove/include_descendants_underscore_3.exp.json
generated
vendored
Normal file
|
|
@ -0,0 +1,762 @@
|
|||
{
|
||||
"graph": {
|
||||
"name": "",
|
||||
"isFolderOnly": false,
|
||||
"ast": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_3.d2,0:0:0-5:0:39",
|
||||
"nodes": [
|
||||
{
|
||||
"map_key": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_3.d2,0:0:0-0:1:1",
|
||||
"key": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_3.d2,0:0:0-0:1:1",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_3.d2,0:0:0-0:1:1",
|
||||
"value": [
|
||||
{
|
||||
"string": "a",
|
||||
"raw_string": "a"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"primary": {},
|
||||
"value": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"map_key": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_3.d2,1:0:2-4:1:38",
|
||||
"key": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_3.d2,1:0:2-1:1:3",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_3.d2,1:0:2-1:1:3",
|
||||
"value": [
|
||||
{
|
||||
"string": "b",
|
||||
"raw_string": "b"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"primary": {},
|
||||
"value": {
|
||||
"map": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_3.d2,1:3:5-4:0:37",
|
||||
"nodes": [
|
||||
{
|
||||
"map_key": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_3.d2,2:2:9-2:12:19",
|
||||
"edges": [
|
||||
{
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_3.d2,2:2:9-2:12:19",
|
||||
"src": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_3.d2,2:2:9-2:7:14",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_3.d2,2:2:9-2:3:10",
|
||||
"value": [
|
||||
{
|
||||
"string": "_",
|
||||
"raw_string": "_"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_3.d2,2:4:11-2:5:12",
|
||||
"value": [
|
||||
{
|
||||
"string": "a",
|
||||
"raw_string": "a"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_3.d2,2:6:13-2:7:14",
|
||||
"value": [
|
||||
{
|
||||
"string": "c",
|
||||
"raw_string": "c"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"src_arrow": "",
|
||||
"dst": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_3.d2,2:11:18-2:12:19",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_3.d2,2:11:18-2:12:19",
|
||||
"value": [
|
||||
{
|
||||
"string": "d",
|
||||
"raw_string": "d"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"dst_arrow": ">"
|
||||
}
|
||||
],
|
||||
"primary": {},
|
||||
"value": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"map_key": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_3.d2,3:2:22-3:16:36",
|
||||
"edges": [
|
||||
{
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_3.d2,3:2:22-3:16:36",
|
||||
"src": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_3.d2,3:2:22-3:7:27",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_3.d2,3:2:22-3:3:23",
|
||||
"value": [
|
||||
{
|
||||
"string": "_",
|
||||
"raw_string": "_"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_3.d2,3:4:24-3:5:25",
|
||||
"value": [
|
||||
{
|
||||
"string": "a",
|
||||
"raw_string": "a"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_3.d2,3:6:26-3:7:27",
|
||||
"value": [
|
||||
{
|
||||
"string": "c",
|
||||
"raw_string": "c"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"src_arrow": "",
|
||||
"dst": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_3.d2,3:11:31-3:16:36",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_3.d2,3:11:31-3:12:32",
|
||||
"value": [
|
||||
{
|
||||
"string": "_",
|
||||
"raw_string": "_"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_3.d2,3:13:33-3:14:34",
|
||||
"value": [
|
||||
{
|
||||
"string": "a",
|
||||
"raw_string": "a"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_3.d2,3:15:35-3:16:36",
|
||||
"value": [
|
||||
{
|
||||
"string": "d",
|
||||
"raw_string": "d"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"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": {
|
||||
"value": ""
|
||||
}
|
||||
},
|
||||
"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": {
|
||||
"value": ""
|
||||
}
|
||||
},
|
||||
"zIndex": 0
|
||||
},
|
||||
{
|
||||
"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": {
|
||||
"value": ""
|
||||
}
|
||||
},
|
||||
"zIndex": 0
|
||||
}
|
||||
],
|
||||
"objects": [
|
||||
{
|
||||
"id": "a",
|
||||
"id_val": "a",
|
||||
"references": [
|
||||
{
|
||||
"key": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_3.d2,0:0:0-0:1:1",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_3.d2,0:0:0-0:1:1",
|
||||
"value": [
|
||||
{
|
||||
"string": "a",
|
||||
"raw_string": "a"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"key_path_index": 0,
|
||||
"map_key_edge_index": -1
|
||||
},
|
||||
{
|
||||
"key": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_3.d2,2:2:9-2:7:14",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_3.d2,2:2:9-2:3:10",
|
||||
"value": [
|
||||
{
|
||||
"string": "_",
|
||||
"raw_string": "_"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_3.d2,2:4:11-2:5:12",
|
||||
"value": [
|
||||
{
|
||||
"string": "a",
|
||||
"raw_string": "a"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_3.d2,2:6:13-2:7:14",
|
||||
"value": [
|
||||
{
|
||||
"string": "c",
|
||||
"raw_string": "c"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"key_path_index": 1,
|
||||
"map_key_edge_index": 0
|
||||
},
|
||||
{
|
||||
"key": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_3.d2,3:2:22-3:7:27",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_3.d2,3:2:22-3:3:23",
|
||||
"value": [
|
||||
{
|
||||
"string": "_",
|
||||
"raw_string": "_"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_3.d2,3:4:24-3:5:25",
|
||||
"value": [
|
||||
{
|
||||
"string": "a",
|
||||
"raw_string": "a"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_3.d2,3:6:26-3:7:27",
|
||||
"value": [
|
||||
{
|
||||
"string": "c",
|
||||
"raw_string": "c"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"key_path_index": 1,
|
||||
"map_key_edge_index": 0
|
||||
},
|
||||
{
|
||||
"key": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_3.d2,3:11:31-3:16:36",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_3.d2,3:11:31-3:12:32",
|
||||
"value": [
|
||||
{
|
||||
"string": "_",
|
||||
"raw_string": "_"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_3.d2,3:13:33-3:14:34",
|
||||
"value": [
|
||||
{
|
||||
"string": "a",
|
||||
"raw_string": "a"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_3.d2,3:15:35-3:16:36",
|
||||
"value": [
|
||||
{
|
||||
"string": "d",
|
||||
"raw_string": "d"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"key_path_index": 1,
|
||||
"map_key_edge_index": 0
|
||||
}
|
||||
],
|
||||
"attributes": {
|
||||
"label": {
|
||||
"value": "a"
|
||||
},
|
||||
"labelDimensions": {
|
||||
"width": 0,
|
||||
"height": 0
|
||||
},
|
||||
"style": {},
|
||||
"near_key": null,
|
||||
"shape": {
|
||||
"value": "rectangle"
|
||||
},
|
||||
"direction": {
|
||||
"value": ""
|
||||
},
|
||||
"constraint": {
|
||||
"value": ""
|
||||
}
|
||||
},
|
||||
"zIndex": 0
|
||||
},
|
||||
{
|
||||
"id": "b",
|
||||
"id_val": "b",
|
||||
"references": [
|
||||
{
|
||||
"key": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_3.d2,1:0:2-1:1:3",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_3.d2,1:0:2-1:1:3",
|
||||
"value": [
|
||||
{
|
||||
"string": "b",
|
||||
"raw_string": "b"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"key_path_index": 0,
|
||||
"map_key_edge_index": -1
|
||||
}
|
||||
],
|
||||
"attributes": {
|
||||
"label": {
|
||||
"value": "b"
|
||||
},
|
||||
"labelDimensions": {
|
||||
"width": 0,
|
||||
"height": 0
|
||||
},
|
||||
"style": {},
|
||||
"near_key": null,
|
||||
"shape": {
|
||||
"value": "rectangle"
|
||||
},
|
||||
"direction": {
|
||||
"value": ""
|
||||
},
|
||||
"constraint": {
|
||||
"value": ""
|
||||
}
|
||||
},
|
||||
"zIndex": 0
|
||||
},
|
||||
{
|
||||
"id": "c",
|
||||
"id_val": "c",
|
||||
"references": [
|
||||
{
|
||||
"key": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_3.d2,2:2:9-2:7:14",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_3.d2,2:2:9-2:3:10",
|
||||
"value": [
|
||||
{
|
||||
"string": "_",
|
||||
"raw_string": "_"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_3.d2,2:4:11-2:5:12",
|
||||
"value": [
|
||||
{
|
||||
"string": "a",
|
||||
"raw_string": "a"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_3.d2,2:6:13-2:7:14",
|
||||
"value": [
|
||||
{
|
||||
"string": "c",
|
||||
"raw_string": "c"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"key_path_index": 2,
|
||||
"map_key_edge_index": 0
|
||||
},
|
||||
{
|
||||
"key": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_3.d2,3:2:22-3:7:27",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_3.d2,3:2:22-3:3:23",
|
||||
"value": [
|
||||
{
|
||||
"string": "_",
|
||||
"raw_string": "_"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_3.d2,3:4:24-3:5:25",
|
||||
"value": [
|
||||
{
|
||||
"string": "a",
|
||||
"raw_string": "a"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_3.d2,3:6:26-3:7:27",
|
||||
"value": [
|
||||
{
|
||||
"string": "c",
|
||||
"raw_string": "c"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"key_path_index": 2,
|
||||
"map_key_edge_index": 0
|
||||
}
|
||||
],
|
||||
"attributes": {
|
||||
"label": {
|
||||
"value": "c"
|
||||
},
|
||||
"labelDimensions": {
|
||||
"width": 0,
|
||||
"height": 0
|
||||
},
|
||||
"style": {},
|
||||
"near_key": null,
|
||||
"shape": {
|
||||
"value": "rectangle"
|
||||
},
|
||||
"direction": {
|
||||
"value": ""
|
||||
},
|
||||
"constraint": {
|
||||
"value": ""
|
||||
}
|
||||
},
|
||||
"zIndex": 0
|
||||
},
|
||||
{
|
||||
"id": "d",
|
||||
"id_val": "d",
|
||||
"references": [
|
||||
{
|
||||
"key": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_3.d2,2:11:18-2:12:19",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_3.d2,2:11:18-2:12:19",
|
||||
"value": [
|
||||
{
|
||||
"string": "d",
|
||||
"raw_string": "d"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"key_path_index": 0,
|
||||
"map_key_edge_index": 0
|
||||
}
|
||||
],
|
||||
"attributes": {
|
||||
"label": {
|
||||
"value": "d"
|
||||
},
|
||||
"labelDimensions": {
|
||||
"width": 0,
|
||||
"height": 0
|
||||
},
|
||||
"style": {},
|
||||
"near_key": null,
|
||||
"shape": {
|
||||
"value": "rectangle"
|
||||
},
|
||||
"direction": {
|
||||
"value": ""
|
||||
},
|
||||
"constraint": {
|
||||
"value": ""
|
||||
}
|
||||
},
|
||||
"zIndex": 0
|
||||
},
|
||||
{
|
||||
"id": "d",
|
||||
"id_val": "d",
|
||||
"references": [
|
||||
{
|
||||
"key": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_3.d2,3:11:31-3:16:36",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_3.d2,3:11:31-3:12:32",
|
||||
"value": [
|
||||
{
|
||||
"string": "_",
|
||||
"raw_string": "_"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_3.d2,3:13:33-3:14:34",
|
||||
"value": [
|
||||
{
|
||||
"string": "a",
|
||||
"raw_string": "a"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "d2/testdata/d2oracle/TestMove/include_descendants_underscore_3.d2,3:15:35-3:16:36",
|
||||
"value": [
|
||||
{
|
||||
"string": "d",
|
||||
"raw_string": "d"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"key_path_index": 2,
|
||||
"map_key_edge_index": 0
|
||||
}
|
||||
],
|
||||
"attributes": {
|
||||
"label": {
|
||||
"value": "d"
|
||||
},
|
||||
"labelDimensions": {
|
||||
"width": 0,
|
||||
"height": 0
|
||||
},
|
||||
"style": {},
|
||||
"near_key": null,
|
||||
"shape": {
|
||||
"value": "rectangle"
|
||||
},
|
||||
"direction": {
|
||||
"value": ""
|
||||
},
|
||||
"constraint": {
|
||||
"value": ""
|
||||
}
|
||||
},
|
||||
"zIndex": 0
|
||||
}
|
||||
]
|
||||
},
|
||||
"err": "<nil>"
|
||||
}
|
||||
Loading…
Reference in a new issue