d2ir: Review fixes #714
This commit is contained in:
parent
dce4385644
commit
f056700152
17 changed files with 4279 additions and 1197 deletions
|
|
@ -9,6 +9,10 @@
|
||||||
- You can now use the reserved keywords `layers`/`scenarios`/`steps` to define diagrams
|
- You can now use the reserved keywords `layers`/`scenarios`/`steps` to define diagrams
|
||||||
with multiple levels of abstractions. [#714](https://github.com/terrastruct/d2/pull/714)
|
with multiple levels of abstractions. [#714](https://github.com/terrastruct/d2/pull/714)
|
||||||
Docs to come soon
|
Docs to come soon
|
||||||
|
- [#416](https://github.com/terrastruct/d2/issues/416) was also fixed so you can no
|
||||||
|
longer use keywords intended for use under `style` outside and vice versa. e.g.
|
||||||
|
`obj.style.shape` and `obj.double-border` are now illegal. The correct uses are
|
||||||
|
`obj.shape` and `obj.style.double-border`.
|
||||||
|
|
||||||
#### Improvements 🧹
|
#### Improvements 🧹
|
||||||
|
|
||||||
|
|
|
||||||
2
ci/sub
2
ci/sub
|
|
@ -1 +1 @@
|
||||||
Subproject commit 8ac704818b5d7ab519e4b87caf5eb79716493709
|
Subproject commit 2009cdd523e00cc2e9b8ba804095f71ca70d5671
|
||||||
|
|
@ -26,8 +26,6 @@ func Compile(path string, r io.RuneReader, opts *CompileOptions) (*d2graph.Graph
|
||||||
opts = &CompileOptions{}
|
opts = &CompileOptions{}
|
||||||
}
|
}
|
||||||
|
|
||||||
var pe d2parser.ParseError
|
|
||||||
|
|
||||||
ast, err := d2parser.Parse(path, r, &d2parser.ParseOptions{
|
ast, err := d2parser.Parse(path, r, &d2parser.ParseOptions{
|
||||||
UTF16: opts.UTF16,
|
UTF16: opts.UTF16,
|
||||||
})
|
})
|
||||||
|
|
@ -40,43 +38,39 @@ func Compile(path string, r io.RuneReader, opts *CompileOptions) (*d2graph.Graph
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
g, err := compileIR(pe, ir)
|
g, err := compileIR(ast, ir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
g.AST = ast
|
|
||||||
return g, err
|
return g, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func compileIR(pe d2parser.ParseError, m *d2ir.Map) (*d2graph.Graph, error) {
|
func compileIR(ast *d2ast.Map, m *d2ir.Map) (*d2graph.Graph, error) {
|
||||||
c := &compiler{
|
c := &compiler{}
|
||||||
err: pe,
|
|
||||||
}
|
|
||||||
|
|
||||||
g := c.compileLayer(m)
|
g := d2graph.NewGraph()
|
||||||
|
g.AST = ast
|
||||||
|
c.compileBoard(g, m)
|
||||||
if len(c.err.Errors) > 0 {
|
if len(c.err.Errors) > 0 {
|
||||||
return nil, c.err
|
return nil, c.err
|
||||||
}
|
}
|
||||||
return g, nil
|
return g, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *compiler) compileLayer(ir *d2ir.Map) *d2graph.Graph {
|
func (c *compiler) compileBoard(g *d2graph.Graph, ir *d2ir.Map) *d2graph.Graph {
|
||||||
g := d2graph.NewGraph()
|
c.compileMap(g.Root, ir)
|
||||||
|
|
||||||
m := ir.CopyRoot()
|
|
||||||
c.compileMap(g.Root, m)
|
|
||||||
if len(c.err.Errors) == 0 {
|
if len(c.err.Errors) == 0 {
|
||||||
c.validateKeys(g.Root, m)
|
c.validateKeys(g.Root, ir)
|
||||||
}
|
}
|
||||||
c.validateNear(g)
|
c.validateNear(g)
|
||||||
|
|
||||||
c.compileLayersField(g, ir, "layers")
|
c.compileBoardsField(g, ir, "layers")
|
||||||
c.compileLayersField(g, ir, "scenarios")
|
c.compileBoardsField(g, ir, "scenarios")
|
||||||
c.compileLayersField(g, ir, "steps")
|
c.compileBoardsField(g, ir, "steps")
|
||||||
return g
|
return g
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *compiler) compileLayersField(g *d2graph.Graph, ir *d2ir.Map, fieldName string) {
|
func (c *compiler) compileBoardsField(g *d2graph.Graph, ir *d2ir.Map, fieldName string) {
|
||||||
layers := ir.GetField(fieldName)
|
layers := ir.GetField(fieldName)
|
||||||
if layers.Map() == nil {
|
if layers.Map() == nil {
|
||||||
return
|
return
|
||||||
|
|
@ -85,11 +79,13 @@ func (c *compiler) compileLayersField(g *d2graph.Graph, ir *d2ir.Map, fieldName
|
||||||
if f.Map() == nil {
|
if f.Map() == nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if g.GetLayer(f.Name) != nil {
|
if g.GetBoard(f.Name) != nil {
|
||||||
c.errorf(f.References[0].AST(), "layer name %v already used by another layer", f.Name)
|
c.errorf(f.References[0].AST(), "board name %v already used by another board", f.Name)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
g2 := c.compileLayer(f.Map())
|
g2 := d2graph.NewGraph()
|
||||||
|
g2.AST = g.AST
|
||||||
|
c.compileBoard(g2, f.Map())
|
||||||
g2.Name = f.Name
|
g2.Name = f.Name
|
||||||
switch fieldName {
|
switch fieldName {
|
||||||
case "layers":
|
case "layers":
|
||||||
|
|
@ -119,6 +115,9 @@ func (c *compiler) compileMap(obj *d2graph.Object, m *d2ir.Map) {
|
||||||
if f.Name == "shape" {
|
if f.Name == "shape" {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
if _, ok := d2graph.BoardKeywords[f.Name]; ok {
|
||||||
|
continue
|
||||||
|
}
|
||||||
c.compileField(obj, f)
|
c.compileField(obj, f)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -538,6 +537,9 @@ func (c *compiler) compileSQLTable(obj *d2graph.Object) {
|
||||||
|
|
||||||
func (c *compiler) validateKeys(obj *d2graph.Object, m *d2ir.Map) {
|
func (c *compiler) validateKeys(obj *d2graph.Object, m *d2ir.Map) {
|
||||||
for _, f := range m.Fields {
|
for _, f := range m.Fields {
|
||||||
|
if _, ok := d2graph.BoardKeywords[f.Name]; ok {
|
||||||
|
continue
|
||||||
|
}
|
||||||
c.validateKey(obj, f)
|
c.validateKey(obj, f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1479,7 +1479,7 @@ d2/testdata/d2compiler/TestCompile/errors/reserved_icon_style.d2:2:9: near key "
|
||||||
text: `x: {style.opacity: 0.4}
|
text: `x: {style.opacity: 0.4}
|
||||||
y -> x.style
|
y -> x.style
|
||||||
`,
|
`,
|
||||||
expErr: `d2/testdata/d2compiler/TestCompile/edge_to_style.d2:2:1: cannot connect to reserved keyword`,
|
expErr: `d2/testdata/d2compiler/TestCompile/edge_to_style.d2:2:8: reserved keywords are prohibited in edges`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "escaped_id",
|
name: "escaped_id",
|
||||||
|
|
@ -1946,10 +1946,10 @@ Chinchillas_Collectibles.chinchilla -> Chinchillas.id`,
|
||||||
func TestCompile2(t *testing.T) {
|
func TestCompile2(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
t.Run("scenarios", testScenarios)
|
t.Run("boards", testBoards)
|
||||||
}
|
}
|
||||||
|
|
||||||
func testScenarios(t *testing.T) {
|
func testBoards(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
tca := []struct {
|
tca := []struct {
|
||||||
|
|
@ -2004,7 +2004,7 @@ layers: {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "recursive",
|
name: "errs/duplicate_board",
|
||||||
run: func(t *testing.T) {
|
run: func(t *testing.T) {
|
||||||
assertCompile(t, `base
|
assertCompile(t, `base
|
||||||
|
|
||||||
|
|
@ -2018,7 +2018,7 @@ steps: {
|
||||||
clause
|
clause
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`, `d2/testdata/d2compiler/TestCompile2/scenarios/recursive#01.d2:9:2: layer name one already used by another layer`)
|
`, `d2/testdata/d2compiler/TestCompile2/boards/errs/duplicate_board.d2:9:2: board name one already used by another board`)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -398,15 +398,14 @@ func (p *printer) edgeIndex(ei *d2ast.EdgeIndex) {
|
||||||
p.sb.WriteByte(']')
|
p.sb.WriteByte(']')
|
||||||
}
|
}
|
||||||
|
|
||||||
func KeyPath(kp *d2ast.KeyPath) []string {
|
func KeyPath(kp *d2ast.KeyPath) (ida []string) {
|
||||||
var ids []string
|
|
||||||
for _, s := range kp.Path {
|
for _, s := range kp.Path {
|
||||||
// We format each string of the key to ensure the resulting strings can be parsed
|
// We format each string of the key to ensure the resulting strings can be parsed
|
||||||
// correctly.
|
// correctly.
|
||||||
n := &d2ast.KeyPath{
|
n := &d2ast.KeyPath{
|
||||||
Path: []*d2ast.StringBox{d2ast.MakeValueBox(d2ast.RawString(s.Unbox().ScalarString(), true)).StringBox()},
|
Path: []*d2ast.StringBox{d2ast.MakeValueBox(d2ast.RawString(s.Unbox().ScalarString(), true)).StringBox()},
|
||||||
}
|
}
|
||||||
ids = append(ids, Format(n))
|
ida = append(ida, Format(n))
|
||||||
}
|
}
|
||||||
return ids
|
return ida
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ func (s Style) Copy() Style {
|
||||||
Italic: s.Italic.Copy(),
|
Italic: s.Italic.Copy(),
|
||||||
Underline: s.Underline.Copy(),
|
Underline: s.Underline.Copy(),
|
||||||
Filled: s.Filled.Copy(),
|
Filled: s.Filled.Copy(),
|
||||||
|
DoubleBorder: s.DoubleBorder.Copy(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -48,7 +49,8 @@ func (attrs *Attributes) Copy() *Attributes {
|
||||||
Language: attrs.Language,
|
Language: attrs.Language,
|
||||||
Shape: attrs.Shape,
|
Shape: attrs.Shape,
|
||||||
|
|
||||||
Direction: attrs.Shape,
|
Direction: attrs.Direction,
|
||||||
|
Constraint: attrs.Constraint,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -997,13 +997,13 @@ func (obj *Object) Connect(srcID, dstID []string, srcArrow, dstArrow bool, label
|
||||||
}
|
}
|
||||||
e.initIndex()
|
e.initIndex()
|
||||||
|
|
||||||
addSQLTableColumnIndexes(e, srcID, dstID, obj, src, dst)
|
addSQLTableColumnIndices(e, srcID, dstID, obj, src, dst)
|
||||||
|
|
||||||
obj.Graph.Edges = append(obj.Graph.Edges, e)
|
obj.Graph.Edges = append(obj.Graph.Edges, e)
|
||||||
return e, nil
|
return e, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func addSQLTableColumnIndexes(e *Edge, srcID, dstID []string, obj, src, dst *Object) {
|
func addSQLTableColumnIndices(e *Edge, srcID, dstID []string, obj, src, dst *Object) {
|
||||||
if src.Attributes.Shape.Value == d2target.ShapeSQLTable {
|
if src.Attributes.Shape.Value == d2target.ShapeSQLTable {
|
||||||
if src == dst {
|
if src == dst {
|
||||||
// Ignore edge to column inside table.
|
// Ignore edge to column inside table.
|
||||||
|
|
@ -1311,6 +1311,9 @@ func Key(k *d2ast.KeyPath) []string {
|
||||||
// All reserved keywords. See init below.
|
// All reserved keywords. See init below.
|
||||||
var ReservedKeywords map[string]struct{}
|
var ReservedKeywords map[string]struct{}
|
||||||
|
|
||||||
|
// All reserved keywords not including style keywords.
|
||||||
|
var ReservedKeywords2 map[string]struct{}
|
||||||
|
|
||||||
// Non Style/Holder keywords.
|
// Non Style/Holder keywords.
|
||||||
var SimpleReservedKeywords = map[string]struct{}{
|
var SimpleReservedKeywords = map[string]struct{}{
|
||||||
"label": {},
|
"label": {},
|
||||||
|
|
@ -1379,6 +1382,13 @@ var NearConstantsArray = []string{
|
||||||
}
|
}
|
||||||
var NearConstants map[string]struct{}
|
var NearConstants map[string]struct{}
|
||||||
|
|
||||||
|
// BoardKeywords contains the keywords that create new boards.
|
||||||
|
var BoardKeywords = map[string]struct{}{
|
||||||
|
"layers": {},
|
||||||
|
"scenarios": {},
|
||||||
|
"steps": {},
|
||||||
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
ReservedKeywords = make(map[string]struct{})
|
ReservedKeywords = make(map[string]struct{})
|
||||||
for k, v := range SimpleReservedKeywords {
|
for k, v := range SimpleReservedKeywords {
|
||||||
|
|
@ -1390,13 +1400,28 @@ func init() {
|
||||||
for k, v := range ReservedKeywordHolders {
|
for k, v := range ReservedKeywordHolders {
|
||||||
ReservedKeywords[k] = v
|
ReservedKeywords[k] = v
|
||||||
}
|
}
|
||||||
|
for k, v := range BoardKeywords {
|
||||||
|
ReservedKeywords[k] = v
|
||||||
|
}
|
||||||
|
|
||||||
|
ReservedKeywords2 = make(map[string]struct{})
|
||||||
|
for k, v := range SimpleReservedKeywords {
|
||||||
|
ReservedKeywords2[k] = v
|
||||||
|
}
|
||||||
|
for k, v := range ReservedKeywordHolders {
|
||||||
|
ReservedKeywords2[k] = v
|
||||||
|
}
|
||||||
|
for k, v := range BoardKeywords {
|
||||||
|
ReservedKeywords2[k] = v
|
||||||
|
}
|
||||||
|
|
||||||
NearConstants = make(map[string]struct{}, len(NearConstantsArray))
|
NearConstants = make(map[string]struct{}, len(NearConstantsArray))
|
||||||
for _, k := range NearConstantsArray {
|
for _, k := range NearConstantsArray {
|
||||||
NearConstants[k] = struct{}{}
|
NearConstants[k] = struct{}{}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *Graph) GetLayer(name string) *Graph {
|
func (g *Graph) GetBoard(name string) *Graph {
|
||||||
for _, l := range g.Layers {
|
for _, l := range g.Layers {
|
||||||
if l.Name == name {
|
if l.Name == name {
|
||||||
return l
|
return l
|
||||||
|
|
|
||||||
|
|
@ -313,24 +313,31 @@ layers: {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
tca := []testCase{
|
tca := []testCase{
|
||||||
{
|
{
|
||||||
name: "bad_edge/1",
|
name: "1/bad_edge",
|
||||||
run: func(t testing.TB) {
|
run: func(t testing.TB) {
|
||||||
_, err := compile(t, `layers.x -> layers.y`)
|
_, err := compile(t, `layers.x -> layers.y`)
|
||||||
assert.ErrorString(t, err, `TestCompile/layers/errs/bad_edge/1.d2:1:1: cannot create edges between layers, scenarios or steps`)
|
assert.ErrorString(t, err, `TestCompile/layers/errs/1/bad_edge.d2:1:1: cannot create edges between boards`)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "bad_edge/2",
|
name: "2/bad_edge",
|
||||||
run: func(t testing.TB) {
|
run: func(t testing.TB) {
|
||||||
_, err := compile(t, `layers -> scenarios`)
|
_, err := compile(t, `layers -> scenarios`)
|
||||||
assert.ErrorString(t, err, `TestCompile/layers/errs/bad_edge/2.d2:1:1: cannot create edges between layers, scenarios or steps`)
|
assert.ErrorString(t, err, `TestCompile/layers/errs/2/bad_edge.d2:1:1: edge with board keyword alone doesn't make sense`)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "bad_edge/3",
|
name: "3/bad_edge",
|
||||||
run: func(t testing.TB) {
|
run: func(t testing.TB) {
|
||||||
_, err := compile(t, `layers.x.y -> steps.z.p`)
|
_, err := compile(t, `layers.x.y -> steps.z.p`)
|
||||||
assert.ErrorString(t, err, `TestCompile/layers/errs/bad_edge/3.d2:1:1: cannot create edges between layers, scenarios or steps`)
|
assert.ErrorString(t, err, `TestCompile/layers/errs/3/bad_edge.d2:1:1: cannot create edges between boards`)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "4/good_edge",
|
||||||
|
run: func(t testing.TB) {
|
||||||
|
_, err := compile(t, `layers.x.y -> layers.x.y`)
|
||||||
|
assert.Success(t, err)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
100
d2ir/d2ir.go
100
d2ir/d2ir.go
|
|
@ -11,6 +11,7 @@ import (
|
||||||
|
|
||||||
"oss.terrastruct.com/d2/d2ast"
|
"oss.terrastruct.com/d2/d2ast"
|
||||||
"oss.terrastruct.com/d2/d2format"
|
"oss.terrastruct.com/d2/d2format"
|
||||||
|
"oss.terrastruct.com/d2/d2graph"
|
||||||
"oss.terrastruct.com/d2/d2parser"
|
"oss.terrastruct.com/d2/d2parser"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -199,13 +200,6 @@ func (m *Map) CopyBase(newParent Node) *Map {
|
||||||
return m2
|
return m2
|
||||||
}
|
}
|
||||||
|
|
||||||
// CopyRoot copies the map such that it is now the root of a diagram.
|
|
||||||
func (m *Map) CopyRoot() *Map {
|
|
||||||
m = m.CopyBase(nil)
|
|
||||||
m.initRoot()
|
|
||||||
return m
|
|
||||||
}
|
|
||||||
|
|
||||||
// Root reports whether the Map is the root of the D2 tree.
|
// Root reports whether the Map is the root of the D2 tree.
|
||||||
func (m *Map) Root() bool {
|
func (m *Map) Root() bool {
|
||||||
// m.parent exists even on the root map as we store the root AST in
|
// m.parent exists even on the root map as we store the root AST in
|
||||||
|
|
@ -222,28 +216,28 @@ func (f *Field) Root() bool {
|
||||||
return f.parent == nil
|
return f.parent == nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type LayerKind string
|
type BoardKind string
|
||||||
|
|
||||||
const (
|
const (
|
||||||
LayerLayer LayerKind = "layer"
|
BoardLayer BoardKind = "layer"
|
||||||
LayerScenario LayerKind = "scenario"
|
BoardScenario BoardKind = "scenario"
|
||||||
LayerStep LayerKind = "step"
|
BoardStep BoardKind = "step"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NodeLayerKind reports whether n represents the root of a layer.
|
// NodeBoardKind reports whether n represents the root of a board.
|
||||||
// n should be *Field or *Map
|
// n should be *Field or *Map
|
||||||
func NodeLayerKind(n Node) LayerKind {
|
func NodeBoardKind(n Node) BoardKind {
|
||||||
var f *Field
|
var f *Field
|
||||||
switch n := n.(type) {
|
switch n := n.(type) {
|
||||||
case *Field:
|
case *Field:
|
||||||
if n.Name == "" {
|
if n.Name == "" {
|
||||||
return LayerLayer
|
return BoardLayer
|
||||||
}
|
}
|
||||||
f = ParentField(n)
|
f = ParentField(n)
|
||||||
case *Map:
|
case *Map:
|
||||||
f = ParentField(n)
|
f = ParentField(n)
|
||||||
if f.Root() {
|
if f.Root() {
|
||||||
return LayerLayer
|
return BoardLayer
|
||||||
}
|
}
|
||||||
f = ParentField(f)
|
f = ParentField(f)
|
||||||
}
|
}
|
||||||
|
|
@ -252,11 +246,11 @@ func NodeLayerKind(n Node) LayerKind {
|
||||||
}
|
}
|
||||||
switch f.Name {
|
switch f.Name {
|
||||||
case "layers":
|
case "layers":
|
||||||
return LayerLayer
|
return BoardLayer
|
||||||
case "scenarios":
|
case "scenarios":
|
||||||
return LayerScenario
|
return BoardScenario
|
||||||
case "steps":
|
case "steps":
|
||||||
return LayerStep
|
return BoardStep
|
||||||
default:
|
default:
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
@ -657,8 +651,8 @@ func (m *Map) ensureField(i int, kp *d2ast.KeyPath, refctx *RefContext) (*Field,
|
||||||
return nil, d2parser.Errorf(kp.Path[i].Unbox(), `parent "_" can only be used in the beginning of paths, e.g. "_.x"`)
|
return nil, d2parser.Errorf(kp.Path[i].Unbox(), `parent "_" can only be used in the beginning of paths, e.g. "_.x"`)
|
||||||
}
|
}
|
||||||
|
|
||||||
if hasLayerKeywords(head) != -1 && NodeLayerKind(m) == "" {
|
if findBoardKeyword(head) != -1 && NodeBoardKind(m) == "" {
|
||||||
return nil, d2parser.Errorf(kp.Path[i].Unbox(), "%s is only allowed at a layer root", head)
|
return nil, d2parser.Errorf(kp.Path[i].Unbox(), "%s is only allowed at a board root", head)
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, f := range m.Fields {
|
for _, f := range m.Fields {
|
||||||
|
|
@ -789,25 +783,34 @@ func (m *Map) CreateEdge(eid *EdgeID, refctx *RefContext) (*Edge, error) {
|
||||||
return f.Map().CreateEdge(eid, refctx)
|
return f.Map().CreateEdge(eid, refctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
ij := hasLayerKeywords(eid.SrcPath...)
|
ij := findProhibitedEdgeKeyword(eid.SrcPath...)
|
||||||
if ij != -1 {
|
if ij != -1 {
|
||||||
return nil, d2parser.Errorf(refctx.Edge.Src.Path[ij].Unbox(), "cannot create edges between layers, scenarios or steps")
|
return nil, d2parser.Errorf(refctx.Edge.Src.Path[ij].Unbox(), "reserved keywords are prohibited in edges")
|
||||||
|
}
|
||||||
|
ij = findBoardKeyword(eid.SrcPath...)
|
||||||
|
if ij == len(eid.SrcPath)-1 {
|
||||||
|
return nil, d2parser.Errorf(refctx.Edge.Src.Path[ij].Unbox(), "edge with board keyword alone doesn't make sense")
|
||||||
}
|
}
|
||||||
src := m.GetField(eid.SrcPath...)
|
src := m.GetField(eid.SrcPath...)
|
||||||
if NodeLayerKind(src) != "" {
|
if NodeBoardKind(src) != "" {
|
||||||
return nil, d2parser.Errorf(refctx.Edge.Src, "cannot create edges between layers, scenarios or steps")
|
return nil, d2parser.Errorf(refctx.Edge.Src, "cannot create edges between boards")
|
||||||
}
|
|
||||||
ij = hasLayerKeywords(eid.DstPath...)
|
|
||||||
if ij != -1 {
|
|
||||||
return nil, d2parser.Errorf(refctx.Edge.Dst.Path[ij].Unbox(), "cannot create edges between layers, scenarios or steps")
|
|
||||||
}
|
|
||||||
dst := m.GetField(eid.DstPath...)
|
|
||||||
if NodeLayerKind(dst) != "" {
|
|
||||||
return nil, d2parser.Errorf(refctx.Edge.Dst, "cannot create edges between layers, scenarios or steps")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ParentLayer(src) != ParentLayer(dst) {
|
ij = findProhibitedEdgeKeyword(eid.DstPath...)
|
||||||
return nil, d2parser.Errorf(refctx.Edge, "cannot create edges between layers, scenarios or steps")
|
if ij != -1 {
|
||||||
|
return nil, d2parser.Errorf(refctx.Edge.Dst.Path[ij].Unbox(), "reserved keywords are prohibited in edges")
|
||||||
|
}
|
||||||
|
ij = findBoardKeyword(eid.DstPath...)
|
||||||
|
if ij == len(eid.DstPath)-1 {
|
||||||
|
return nil, d2parser.Errorf(refctx.Edge.Dst.Path[ij].Unbox(), "edge with board keyword alone doesn't make sense")
|
||||||
|
}
|
||||||
|
dst := m.GetField(eid.DstPath...)
|
||||||
|
if NodeBoardKind(dst) != "" {
|
||||||
|
return nil, d2parser.Errorf(refctx.Edge.Dst, "cannot create edges between boards")
|
||||||
|
}
|
||||||
|
|
||||||
|
if ParentBoard(src) != ParentBoard(dst) {
|
||||||
|
return nil, d2parser.Errorf(refctx.Edge, "cannot create edges between boards")
|
||||||
}
|
}
|
||||||
|
|
||||||
eid.Index = nil
|
eid.Index = nil
|
||||||
|
|
@ -949,13 +952,13 @@ func ParentField(n Node) *Field {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func ParentLayer(n Node) Node {
|
func ParentBoard(n Node) Node {
|
||||||
for {
|
for {
|
||||||
n = n.Parent()
|
n = n.Parent()
|
||||||
if n == nil {
|
if n == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if NodeLayerKind(n) != "" {
|
if NodeBoardKind(n) != "" {
|
||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -974,20 +977,29 @@ func ParentEdge(n Node) *Edge {
|
||||||
}
|
}
|
||||||
|
|
||||||
func countUnderscores(p []string) int {
|
func countUnderscores(p []string) int {
|
||||||
var count int
|
for i, el := range p {
|
||||||
for _, el := range p {
|
|
||||||
if el != "_" {
|
if el != "_" {
|
||||||
break
|
return i
|
||||||
}
|
}
|
||||||
count++
|
|
||||||
}
|
}
|
||||||
return count
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func hasLayerKeywords(ida ...string) int {
|
func findBoardKeyword(ida ...string) int {
|
||||||
for i := range ida {
|
for i := range ida {
|
||||||
switch ida[i] {
|
if _, ok := d2graph.BoardKeywords[ida[i]]; ok {
|
||||||
case "layers", "scenarios", "steps":
|
return i
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1
|
||||||
|
}
|
||||||
|
|
||||||
|
func findProhibitedEdgeKeyword(ida ...string) int {
|
||||||
|
for i := range ida {
|
||||||
|
if _, ok := d2graph.SimpleReservedKeywords[ida[i]]; ok {
|
||||||
|
return i
|
||||||
|
}
|
||||||
|
if _, ok := d2graph.ReservedKeywordHolders[ida[i]]; ok {
|
||||||
return i
|
return i
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
4
testdata/d2compiler/TestCompile/edge_to_style.exp.json
generated
vendored
4
testdata/d2compiler/TestCompile/edge_to_style.exp.json
generated
vendored
|
|
@ -4,8 +4,8 @@
|
||||||
"ioerr": null,
|
"ioerr": null,
|
||||||
"errs": [
|
"errs": [
|
||||||
{
|
{
|
||||||
"range": "d2/testdata/d2compiler/TestCompile/edge_to_style.d2,1:0:24-1:12:36",
|
"range": "d2/testdata/d2compiler/TestCompile/edge_to_style.d2,1:7:31-1:12:36",
|
||||||
"errmsg": "d2/testdata/d2compiler/TestCompile/edge_to_style.d2:2:1: cannot connect to reserved keyword"
|
"errmsg": "d2/testdata/d2compiler/TestCompile/edge_to_style.d2:2:8: reserved keywords are prohibited in edges"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
12
testdata/d2compiler/TestCompile2/boards/errs/duplicate_board.exp.json
generated
vendored
Normal file
12
testdata/d2compiler/TestCompile2/boards/errs/duplicate_board.exp.json
generated
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
"graph": null,
|
||||||
|
"err": {
|
||||||
|
"ioerr": null,
|
||||||
|
"errs": [
|
||||||
|
{
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/errs/duplicate_board.d2,8:1:51-8:4:54",
|
||||||
|
"errmsg": "d2/testdata/d2compiler/TestCompile2/boards/errs/duplicate_board.d2:9:2: board name one already used by another board"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
1867
testdata/d2compiler/TestCompile2/boards/recursive.exp.json
generated
vendored
Normal file
1867
testdata/d2compiler/TestCompile2/boards/recursive.exp.json
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
722
testdata/d2compiler/TestCompile2/boards/root.exp.json
generated
vendored
Normal file
722
testdata/d2compiler/TestCompile2/boards/root.exp.json
generated
vendored
Normal file
|
|
@ -0,0 +1,722 @@
|
||||||
|
{
|
||||||
|
"graph": {
|
||||||
|
"name": "",
|
||||||
|
"ast": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,0:0:0-10:0:65",
|
||||||
|
"nodes": [
|
||||||
|
{
|
||||||
|
"map_key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,0:0:0-0:4:4",
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,0:0:0-0:4:4",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,0:0:0-0:4:4",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "base",
|
||||||
|
"raw_string": "base"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"primary": {},
|
||||||
|
"value": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"map_key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,2:0:6-9:1:64",
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,2:0:6-2:6:12",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,2:0:6-2:6:12",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "layers",
|
||||||
|
"raw_string": "layers"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"primary": {},
|
||||||
|
"value": {
|
||||||
|
"map": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,2:8:14-9:0:63",
|
||||||
|
"nodes": [
|
||||||
|
{
|
||||||
|
"map_key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,3:2:18-5:3:38",
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,3:2:18-3:5:21",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,3:2:18-3:5:21",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "one",
|
||||||
|
"raw_string": "one"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"primary": {},
|
||||||
|
"value": {
|
||||||
|
"map": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,3:7:23-5:2:37",
|
||||||
|
"nodes": [
|
||||||
|
{
|
||||||
|
"map_key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,4:4:29-4:9:34",
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,4:4:29-4:9:34",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,4:4:29-4:9:34",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "santa",
|
||||||
|
"raw_string": "santa"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"primary": {},
|
||||||
|
"value": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"map_key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,6:2:41-8:3:62",
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,6:2:41-6:5:44",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,6:2:41-6:5:44",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "two",
|
||||||
|
"raw_string": "two"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"primary": {},
|
||||||
|
"value": {
|
||||||
|
"map": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,6:7:46-8:2:61",
|
||||||
|
"nodes": [
|
||||||
|
{
|
||||||
|
"map_key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,7:4:52-7:10:58",
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,7:4:52-7:10:58",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,7:4:52-7:10:58",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "clause",
|
||||||
|
"raw_string": "clause"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"primary": {},
|
||||||
|
"value": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"id": "",
|
||||||
|
"id_val": "",
|
||||||
|
"label_dimensions": {
|
||||||
|
"width": 0,
|
||||||
|
"height": 0
|
||||||
|
},
|
||||||
|
"attributes": {
|
||||||
|
"label": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"style": {},
|
||||||
|
"near_key": null,
|
||||||
|
"shape": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"direction": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"constraint": {
|
||||||
|
"value": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"zIndex": 0
|
||||||
|
},
|
||||||
|
"edges": null,
|
||||||
|
"objects": [
|
||||||
|
{
|
||||||
|
"id": "base",
|
||||||
|
"id_val": "base",
|
||||||
|
"label_dimensions": {
|
||||||
|
"width": 0,
|
||||||
|
"height": 0
|
||||||
|
},
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,0:0:0-0:4:4",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,0:0:0-0:4:4",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "base",
|
||||||
|
"raw_string": "base"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"key_path_index": 0,
|
||||||
|
"map_key_edge_index": -1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"attributes": {
|
||||||
|
"label": {
|
||||||
|
"value": "base"
|
||||||
|
},
|
||||||
|
"style": {},
|
||||||
|
"near_key": null,
|
||||||
|
"shape": {
|
||||||
|
"value": "rectangle"
|
||||||
|
},
|
||||||
|
"direction": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"constraint": {
|
||||||
|
"value": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"zIndex": 0
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"layers": [
|
||||||
|
{
|
||||||
|
"name": "one",
|
||||||
|
"ast": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,0:0:0-10:0:65",
|
||||||
|
"nodes": [
|
||||||
|
{
|
||||||
|
"map_key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,0:0:0-0:4:4",
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,0:0:0-0:4:4",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,0:0:0-0:4:4",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "base",
|
||||||
|
"raw_string": "base"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"primary": {},
|
||||||
|
"value": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"map_key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,2:0:6-9:1:64",
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,2:0:6-2:6:12",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,2:0:6-2:6:12",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "layers",
|
||||||
|
"raw_string": "layers"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"primary": {},
|
||||||
|
"value": {
|
||||||
|
"map": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,2:8:14-9:0:63",
|
||||||
|
"nodes": [
|
||||||
|
{
|
||||||
|
"map_key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,3:2:18-5:3:38",
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,3:2:18-3:5:21",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,3:2:18-3:5:21",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "one",
|
||||||
|
"raw_string": "one"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"primary": {},
|
||||||
|
"value": {
|
||||||
|
"map": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,3:7:23-5:2:37",
|
||||||
|
"nodes": [
|
||||||
|
{
|
||||||
|
"map_key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,4:4:29-4:9:34",
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,4:4:29-4:9:34",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,4:4:29-4:9:34",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "santa",
|
||||||
|
"raw_string": "santa"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"primary": {},
|
||||||
|
"value": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"map_key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,6:2:41-8:3:62",
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,6:2:41-6:5:44",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,6:2:41-6:5:44",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "two",
|
||||||
|
"raw_string": "two"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"primary": {},
|
||||||
|
"value": {
|
||||||
|
"map": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,6:7:46-8:2:61",
|
||||||
|
"nodes": [
|
||||||
|
{
|
||||||
|
"map_key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,7:4:52-7:10:58",
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,7:4:52-7:10:58",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,7:4:52-7:10:58",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "clause",
|
||||||
|
"raw_string": "clause"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"primary": {},
|
||||||
|
"value": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"id": "",
|
||||||
|
"id_val": "",
|
||||||
|
"label_dimensions": {
|
||||||
|
"width": 0,
|
||||||
|
"height": 0
|
||||||
|
},
|
||||||
|
"attributes": {
|
||||||
|
"label": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"style": {},
|
||||||
|
"near_key": null,
|
||||||
|
"shape": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"direction": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"constraint": {
|
||||||
|
"value": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"zIndex": 0
|
||||||
|
},
|
||||||
|
"edges": null,
|
||||||
|
"objects": [
|
||||||
|
{
|
||||||
|
"id": "santa",
|
||||||
|
"id_val": "santa",
|
||||||
|
"label_dimensions": {
|
||||||
|
"width": 0,
|
||||||
|
"height": 0
|
||||||
|
},
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,4:4:29-4:9:34",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,4:4:29-4:9:34",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "santa",
|
||||||
|
"raw_string": "santa"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"key_path_index": 0,
|
||||||
|
"map_key_edge_index": -1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"attributes": {
|
||||||
|
"label": {
|
||||||
|
"value": "santa"
|
||||||
|
},
|
||||||
|
"style": {},
|
||||||
|
"near_key": null,
|
||||||
|
"shape": {
|
||||||
|
"value": "rectangle"
|
||||||
|
},
|
||||||
|
"direction": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"constraint": {
|
||||||
|
"value": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"zIndex": 0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "two",
|
||||||
|
"ast": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,0:0:0-10:0:65",
|
||||||
|
"nodes": [
|
||||||
|
{
|
||||||
|
"map_key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,0:0:0-0:4:4",
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,0:0:0-0:4:4",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,0:0:0-0:4:4",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "base",
|
||||||
|
"raw_string": "base"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"primary": {},
|
||||||
|
"value": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"map_key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,2:0:6-9:1:64",
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,2:0:6-2:6:12",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,2:0:6-2:6:12",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "layers",
|
||||||
|
"raw_string": "layers"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"primary": {},
|
||||||
|
"value": {
|
||||||
|
"map": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,2:8:14-9:0:63",
|
||||||
|
"nodes": [
|
||||||
|
{
|
||||||
|
"map_key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,3:2:18-5:3:38",
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,3:2:18-3:5:21",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,3:2:18-3:5:21",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "one",
|
||||||
|
"raw_string": "one"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"primary": {},
|
||||||
|
"value": {
|
||||||
|
"map": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,3:7:23-5:2:37",
|
||||||
|
"nodes": [
|
||||||
|
{
|
||||||
|
"map_key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,4:4:29-4:9:34",
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,4:4:29-4:9:34",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,4:4:29-4:9:34",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "santa",
|
||||||
|
"raw_string": "santa"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"primary": {},
|
||||||
|
"value": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"map_key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,6:2:41-8:3:62",
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,6:2:41-6:5:44",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,6:2:41-6:5:44",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "two",
|
||||||
|
"raw_string": "two"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"primary": {},
|
||||||
|
"value": {
|
||||||
|
"map": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,6:7:46-8:2:61",
|
||||||
|
"nodes": [
|
||||||
|
{
|
||||||
|
"map_key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,7:4:52-7:10:58",
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,7:4:52-7:10:58",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,7:4:52-7:10:58",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "clause",
|
||||||
|
"raw_string": "clause"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"primary": {},
|
||||||
|
"value": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"id": "",
|
||||||
|
"id_val": "",
|
||||||
|
"label_dimensions": {
|
||||||
|
"width": 0,
|
||||||
|
"height": 0
|
||||||
|
},
|
||||||
|
"attributes": {
|
||||||
|
"label": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"style": {},
|
||||||
|
"near_key": null,
|
||||||
|
"shape": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"direction": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"constraint": {
|
||||||
|
"value": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"zIndex": 0
|
||||||
|
},
|
||||||
|
"edges": null,
|
||||||
|
"objects": [
|
||||||
|
{
|
||||||
|
"id": "clause",
|
||||||
|
"id_val": "clause",
|
||||||
|
"label_dimensions": {
|
||||||
|
"width": 0,
|
||||||
|
"height": 0
|
||||||
|
},
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,7:4:52-7:10:58",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/root.d2,7:4:52-7:10:58",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "clause",
|
||||||
|
"raw_string": "clause"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"key_path_index": 0,
|
||||||
|
"map_key_edge_index": -1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"attributes": {
|
||||||
|
"label": {
|
||||||
|
"value": "clause"
|
||||||
|
},
|
||||||
|
"style": {},
|
||||||
|
"near_key": null,
|
||||||
|
"shape": {
|
||||||
|
"value": "rectangle"
|
||||||
|
},
|
||||||
|
"direction": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"constraint": {
|
||||||
|
"value": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"zIndex": 0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"err": null
|
||||||
|
}
|
||||||
12
testdata/d2compiler/TestCompile2/scenarios/recursive#01.exp.json
generated
vendored
12
testdata/d2compiler/TestCompile2/scenarios/recursive#01.exp.json
generated
vendored
|
|
@ -1,12 +0,0 @@
|
||||||
{
|
|
||||||
"graph": null,
|
|
||||||
"err": {
|
|
||||||
"ioerr": null,
|
|
||||||
"errs": [
|
|
||||||
{
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/recursive#01.d2,8:1:51-8:4:54",
|
|
||||||
"errmsg": "d2/testdata/d2compiler/TestCompile2/scenarios/recursive#01.d2:9:2: layer name one already used by another layer"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
695
testdata/d2compiler/TestCompile2/scenarios/recursive.exp.json
generated
vendored
695
testdata/d2compiler/TestCompile2/scenarios/recursive.exp.json
generated
vendored
|
|
@ -1,695 +0,0 @@
|
||||||
{
|
|
||||||
"graph": {
|
|
||||||
"name": "",
|
|
||||||
"ast": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/recursive.d2,0:0:0-18:0:145",
|
|
||||||
"nodes": [
|
|
||||||
{
|
|
||||||
"map_key": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/recursive.d2,0:0:0-0:4:4",
|
|
||||||
"key": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/recursive.d2,0:0:0-0:4:4",
|
|
||||||
"path": [
|
|
||||||
{
|
|
||||||
"unquoted_string": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/recursive.d2,0:0:0-0:4:4",
|
|
||||||
"value": [
|
|
||||||
{
|
|
||||||
"string": "base",
|
|
||||||
"raw_string": "base"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"primary": {},
|
|
||||||
"value": {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"map_key": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/recursive.d2,2:0:6-17:1:144",
|
|
||||||
"key": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/recursive.d2,2:0:6-2:6:12",
|
|
||||||
"path": [
|
|
||||||
{
|
|
||||||
"unquoted_string": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/recursive.d2,2:0:6-2:6:12",
|
|
||||||
"value": [
|
|
||||||
{
|
|
||||||
"string": "layers",
|
|
||||||
"raw_string": "layers"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"primary": {},
|
|
||||||
"value": {
|
|
||||||
"map": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/recursive.d2,2:8:14-17:0:143",
|
|
||||||
"nodes": [
|
|
||||||
{
|
|
||||||
"map_key": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/recursive.d2,3:2:18-5:3:38",
|
|
||||||
"key": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/recursive.d2,3:2:18-3:5:21",
|
|
||||||
"path": [
|
|
||||||
{
|
|
||||||
"unquoted_string": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/recursive.d2,3:2:18-3:5:21",
|
|
||||||
"value": [
|
|
||||||
{
|
|
||||||
"string": "one",
|
|
||||||
"raw_string": "one"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"primary": {},
|
|
||||||
"value": {
|
|
||||||
"map": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/recursive.d2,3:7:23-5:2:37",
|
|
||||||
"nodes": [
|
|
||||||
{
|
|
||||||
"map_key": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/recursive.d2,4:4:29-4:9:34",
|
|
||||||
"key": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/recursive.d2,4:4:29-4:9:34",
|
|
||||||
"path": [
|
|
||||||
{
|
|
||||||
"unquoted_string": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/recursive.d2,4:4:29-4:9:34",
|
|
||||||
"value": [
|
|
||||||
{
|
|
||||||
"string": "santa",
|
|
||||||
"raw_string": "santa"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"primary": {},
|
|
||||||
"value": {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"map_key": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/recursive.d2,6:2:41-16:3:142",
|
|
||||||
"key": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/recursive.d2,6:2:41-6:5:44",
|
|
||||||
"path": [
|
|
||||||
{
|
|
||||||
"unquoted_string": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/recursive.d2,6:2:41-6:5:44",
|
|
||||||
"value": [
|
|
||||||
{
|
|
||||||
"string": "two",
|
|
||||||
"raw_string": "two"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"primary": {},
|
|
||||||
"value": {
|
|
||||||
"map": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/recursive.d2,6:7:46-16:2:141",
|
|
||||||
"nodes": [
|
|
||||||
{
|
|
||||||
"map_key": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/recursive.d2,7:4:52-7:10:58",
|
|
||||||
"key": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/recursive.d2,7:4:52-7:10:58",
|
|
||||||
"path": [
|
|
||||||
{
|
|
||||||
"unquoted_string": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/recursive.d2,7:4:52-7:10:58",
|
|
||||||
"value": [
|
|
||||||
{
|
|
||||||
"string": "clause",
|
|
||||||
"raw_string": "clause"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"primary": {},
|
|
||||||
"value": {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"map_key": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/recursive.d2,8:2:61-15:3:138",
|
|
||||||
"key": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/recursive.d2,8:2:61-8:7:66",
|
|
||||||
"path": [
|
|
||||||
{
|
|
||||||
"unquoted_string": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/recursive.d2,8:2:61-8:7:66",
|
|
||||||
"value": [
|
|
||||||
{
|
|
||||||
"string": "steps",
|
|
||||||
"raw_string": "steps"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"primary": {},
|
|
||||||
"value": {
|
|
||||||
"map": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/recursive.d2,8:9:68-15:2:137",
|
|
||||||
"nodes": [
|
|
||||||
{
|
|
||||||
"map_key": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/recursive.d2,9:3:73-11:4:102",
|
|
||||||
"key": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/recursive.d2,9:3:73-9:11:81",
|
|
||||||
"path": [
|
|
||||||
{
|
|
||||||
"unquoted_string": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/recursive.d2,9:3:73-9:11:81",
|
|
||||||
"value": [
|
|
||||||
{
|
|
||||||
"string": "seinfeld",
|
|
||||||
"raw_string": "seinfeld"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"primary": {},
|
|
||||||
"value": {
|
|
||||||
"map": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/recursive.d2,9:13:83-11:3:101",
|
|
||||||
"nodes": [
|
|
||||||
{
|
|
||||||
"map_key": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/recursive.d2,10:4:89-10:12:97",
|
|
||||||
"key": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/recursive.d2,10:4:89-10:12:97",
|
|
||||||
"path": [
|
|
||||||
{
|
|
||||||
"unquoted_string": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/recursive.d2,10:4:89-10:12:97",
|
|
||||||
"value": [
|
|
||||||
{
|
|
||||||
"string": "reindeer",
|
|
||||||
"raw_string": "reindeer"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"primary": {},
|
|
||||||
"value": {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"map_key": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/recursive.d2,12:3:106-14:4:134",
|
|
||||||
"key": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/recursive.d2,12:3:106-12:11:114",
|
|
||||||
"path": [
|
|
||||||
{
|
|
||||||
"unquoted_string": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/recursive.d2,12:3:106-12:11:114",
|
|
||||||
"value": [
|
|
||||||
{
|
|
||||||
"string": "missoula",
|
|
||||||
"raw_string": "missoula"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"primary": {},
|
|
||||||
"value": {
|
|
||||||
"map": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/recursive.d2,12:13:116-14:3:133",
|
|
||||||
"nodes": [
|
|
||||||
{
|
|
||||||
"map_key": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/recursive.d2,13:4:122-13:11:129",
|
|
||||||
"key": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/recursive.d2,13:4:122-13:11:129",
|
|
||||||
"path": [
|
|
||||||
{
|
|
||||||
"unquoted_string": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/recursive.d2,13:4:122-13:11:129",
|
|
||||||
"value": [
|
|
||||||
{
|
|
||||||
"string": "montana",
|
|
||||||
"raw_string": "montana"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"primary": {},
|
|
||||||
"value": {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"root": {
|
|
||||||
"id": "",
|
|
||||||
"id_val": "",
|
|
||||||
"label_dimensions": {
|
|
||||||
"width": 0,
|
|
||||||
"height": 0
|
|
||||||
},
|
|
||||||
"attributes": {
|
|
||||||
"label": {
|
|
||||||
"value": ""
|
|
||||||
},
|
|
||||||
"style": {},
|
|
||||||
"near_key": null,
|
|
||||||
"shape": {
|
|
||||||
"value": ""
|
|
||||||
},
|
|
||||||
"direction": {
|
|
||||||
"value": ""
|
|
||||||
},
|
|
||||||
"constraint": {
|
|
||||||
"value": ""
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"zIndex": 0
|
|
||||||
},
|
|
||||||
"edges": null,
|
|
||||||
"objects": [
|
|
||||||
{
|
|
||||||
"id": "base",
|
|
||||||
"id_val": "base",
|
|
||||||
"label_dimensions": {
|
|
||||||
"width": 0,
|
|
||||||
"height": 0
|
|
||||||
},
|
|
||||||
"references": [
|
|
||||||
{
|
|
||||||
"key": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/recursive.d2,0:0:0-0:4:4",
|
|
||||||
"path": [
|
|
||||||
{
|
|
||||||
"unquoted_string": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/recursive.d2,0:0:0-0:4:4",
|
|
||||||
"value": [
|
|
||||||
{
|
|
||||||
"string": "base",
|
|
||||||
"raw_string": "base"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"key_path_index": 0,
|
|
||||||
"map_key_edge_index": -1
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"attributes": {
|
|
||||||
"label": {
|
|
||||||
"value": "base"
|
|
||||||
},
|
|
||||||
"style": {},
|
|
||||||
"near_key": null,
|
|
||||||
"shape": {
|
|
||||||
"value": "rectangle"
|
|
||||||
},
|
|
||||||
"direction": {
|
|
||||||
"value": ""
|
|
||||||
},
|
|
||||||
"constraint": {
|
|
||||||
"value": ""
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"zIndex": 0
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"layers": [
|
|
||||||
{
|
|
||||||
"name": "one",
|
|
||||||
"ast": null,
|
|
||||||
"root": {
|
|
||||||
"id": "",
|
|
||||||
"id_val": "",
|
|
||||||
"label_dimensions": {
|
|
||||||
"width": 0,
|
|
||||||
"height": 0
|
|
||||||
},
|
|
||||||
"attributes": {
|
|
||||||
"label": {
|
|
||||||
"value": ""
|
|
||||||
},
|
|
||||||
"style": {},
|
|
||||||
"near_key": null,
|
|
||||||
"shape": {
|
|
||||||
"value": ""
|
|
||||||
},
|
|
||||||
"direction": {
|
|
||||||
"value": ""
|
|
||||||
},
|
|
||||||
"constraint": {
|
|
||||||
"value": ""
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"zIndex": 0
|
|
||||||
},
|
|
||||||
"edges": null,
|
|
||||||
"objects": [
|
|
||||||
{
|
|
||||||
"id": "santa",
|
|
||||||
"id_val": "santa",
|
|
||||||
"label_dimensions": {
|
|
||||||
"width": 0,
|
|
||||||
"height": 0
|
|
||||||
},
|
|
||||||
"references": [
|
|
||||||
{
|
|
||||||
"key": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/recursive.d2,4:4:29-4:9:34",
|
|
||||||
"path": [
|
|
||||||
{
|
|
||||||
"unquoted_string": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/recursive.d2,4:4:29-4:9:34",
|
|
||||||
"value": [
|
|
||||||
{
|
|
||||||
"string": "santa",
|
|
||||||
"raw_string": "santa"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"key_path_index": 0,
|
|
||||||
"map_key_edge_index": -1
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"attributes": {
|
|
||||||
"label": {
|
|
||||||
"value": "santa"
|
|
||||||
},
|
|
||||||
"style": {},
|
|
||||||
"near_key": null,
|
|
||||||
"shape": {
|
|
||||||
"value": "rectangle"
|
|
||||||
},
|
|
||||||
"direction": {
|
|
||||||
"value": ""
|
|
||||||
},
|
|
||||||
"constraint": {
|
|
||||||
"value": ""
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"zIndex": 0
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "two",
|
|
||||||
"ast": null,
|
|
||||||
"root": {
|
|
||||||
"id": "",
|
|
||||||
"id_val": "",
|
|
||||||
"label_dimensions": {
|
|
||||||
"width": 0,
|
|
||||||
"height": 0
|
|
||||||
},
|
|
||||||
"attributes": {
|
|
||||||
"label": {
|
|
||||||
"value": ""
|
|
||||||
},
|
|
||||||
"style": {},
|
|
||||||
"near_key": null,
|
|
||||||
"shape": {
|
|
||||||
"value": ""
|
|
||||||
},
|
|
||||||
"direction": {
|
|
||||||
"value": ""
|
|
||||||
},
|
|
||||||
"constraint": {
|
|
||||||
"value": ""
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"zIndex": 0
|
|
||||||
},
|
|
||||||
"edges": null,
|
|
||||||
"objects": [
|
|
||||||
{
|
|
||||||
"id": "clause",
|
|
||||||
"id_val": "clause",
|
|
||||||
"label_dimensions": {
|
|
||||||
"width": 0,
|
|
||||||
"height": 0
|
|
||||||
},
|
|
||||||
"references": [
|
|
||||||
{
|
|
||||||
"key": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/recursive.d2,7:4:52-7:10:58",
|
|
||||||
"path": [
|
|
||||||
{
|
|
||||||
"unquoted_string": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/recursive.d2,7:4:52-7:10:58",
|
|
||||||
"value": [
|
|
||||||
{
|
|
||||||
"string": "clause",
|
|
||||||
"raw_string": "clause"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"key_path_index": 0,
|
|
||||||
"map_key_edge_index": -1
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"attributes": {
|
|
||||||
"label": {
|
|
||||||
"value": "clause"
|
|
||||||
},
|
|
||||||
"style": {},
|
|
||||||
"near_key": null,
|
|
||||||
"shape": {
|
|
||||||
"value": "rectangle"
|
|
||||||
},
|
|
||||||
"direction": {
|
|
||||||
"value": ""
|
|
||||||
},
|
|
||||||
"constraint": {
|
|
||||||
"value": ""
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"zIndex": 0
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"steps": [
|
|
||||||
{
|
|
||||||
"name": "seinfeld",
|
|
||||||
"ast": null,
|
|
||||||
"root": {
|
|
||||||
"id": "",
|
|
||||||
"id_val": "",
|
|
||||||
"label_dimensions": {
|
|
||||||
"width": 0,
|
|
||||||
"height": 0
|
|
||||||
},
|
|
||||||
"attributes": {
|
|
||||||
"label": {
|
|
||||||
"value": ""
|
|
||||||
},
|
|
||||||
"style": {},
|
|
||||||
"near_key": null,
|
|
||||||
"shape": {
|
|
||||||
"value": ""
|
|
||||||
},
|
|
||||||
"direction": {
|
|
||||||
"value": ""
|
|
||||||
},
|
|
||||||
"constraint": {
|
|
||||||
"value": ""
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"zIndex": 0
|
|
||||||
},
|
|
||||||
"edges": null,
|
|
||||||
"objects": [
|
|
||||||
{
|
|
||||||
"id": "reindeer",
|
|
||||||
"id_val": "reindeer",
|
|
||||||
"label_dimensions": {
|
|
||||||
"width": 0,
|
|
||||||
"height": 0
|
|
||||||
},
|
|
||||||
"references": [
|
|
||||||
{
|
|
||||||
"key": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/recursive.d2,10:4:89-10:12:97",
|
|
||||||
"path": [
|
|
||||||
{
|
|
||||||
"unquoted_string": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/recursive.d2,10:4:89-10:12:97",
|
|
||||||
"value": [
|
|
||||||
{
|
|
||||||
"string": "reindeer",
|
|
||||||
"raw_string": "reindeer"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"key_path_index": 0,
|
|
||||||
"map_key_edge_index": -1
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"attributes": {
|
|
||||||
"label": {
|
|
||||||
"value": "reindeer"
|
|
||||||
},
|
|
||||||
"style": {},
|
|
||||||
"near_key": null,
|
|
||||||
"shape": {
|
|
||||||
"value": "rectangle"
|
|
||||||
},
|
|
||||||
"direction": {
|
|
||||||
"value": ""
|
|
||||||
},
|
|
||||||
"constraint": {
|
|
||||||
"value": ""
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"zIndex": 0
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "missoula",
|
|
||||||
"ast": null,
|
|
||||||
"root": {
|
|
||||||
"id": "",
|
|
||||||
"id_val": "",
|
|
||||||
"label_dimensions": {
|
|
||||||
"width": 0,
|
|
||||||
"height": 0
|
|
||||||
},
|
|
||||||
"attributes": {
|
|
||||||
"label": {
|
|
||||||
"value": ""
|
|
||||||
},
|
|
||||||
"style": {},
|
|
||||||
"near_key": null,
|
|
||||||
"shape": {
|
|
||||||
"value": ""
|
|
||||||
},
|
|
||||||
"direction": {
|
|
||||||
"value": ""
|
|
||||||
},
|
|
||||||
"constraint": {
|
|
||||||
"value": ""
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"zIndex": 0
|
|
||||||
},
|
|
||||||
"edges": null,
|
|
||||||
"objects": [
|
|
||||||
{
|
|
||||||
"id": "montana",
|
|
||||||
"id_val": "montana",
|
|
||||||
"label_dimensions": {
|
|
||||||
"width": 0,
|
|
||||||
"height": 0
|
|
||||||
},
|
|
||||||
"references": [
|
|
||||||
{
|
|
||||||
"key": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/recursive.d2,13:4:122-13:11:129",
|
|
||||||
"path": [
|
|
||||||
{
|
|
||||||
"unquoted_string": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/recursive.d2,13:4:122-13:11:129",
|
|
||||||
"value": [
|
|
||||||
{
|
|
||||||
"string": "montana",
|
|
||||||
"raw_string": "montana"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"key_path_index": 0,
|
|
||||||
"map_key_edge_index": -1
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"attributes": {
|
|
||||||
"label": {
|
|
||||||
"value": "montana"
|
|
||||||
},
|
|
||||||
"style": {},
|
|
||||||
"near_key": null,
|
|
||||||
"shape": {
|
|
||||||
"value": "rectangle"
|
|
||||||
},
|
|
||||||
"direction": {
|
|
||||||
"value": ""
|
|
||||||
},
|
|
||||||
"constraint": {
|
|
||||||
"value": ""
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"zIndex": 0
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"err": null
|
|
||||||
}
|
|
||||||
402
testdata/d2compiler/TestCompile2/scenarios/root.exp.json
generated
vendored
402
testdata/d2compiler/TestCompile2/scenarios/root.exp.json
generated
vendored
|
|
@ -1,402 +0,0 @@
|
||||||
{
|
|
||||||
"graph": {
|
|
||||||
"name": "",
|
|
||||||
"ast": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/root.d2,0:0:0-10:0:65",
|
|
||||||
"nodes": [
|
|
||||||
{
|
|
||||||
"map_key": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/root.d2,0:0:0-0:4:4",
|
|
||||||
"key": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/root.d2,0:0:0-0:4:4",
|
|
||||||
"path": [
|
|
||||||
{
|
|
||||||
"unquoted_string": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/root.d2,0:0:0-0:4:4",
|
|
||||||
"value": [
|
|
||||||
{
|
|
||||||
"string": "base",
|
|
||||||
"raw_string": "base"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"primary": {},
|
|
||||||
"value": {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"map_key": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/root.d2,2:0:6-9:1:64",
|
|
||||||
"key": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/root.d2,2:0:6-2:6:12",
|
|
||||||
"path": [
|
|
||||||
{
|
|
||||||
"unquoted_string": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/root.d2,2:0:6-2:6:12",
|
|
||||||
"value": [
|
|
||||||
{
|
|
||||||
"string": "layers",
|
|
||||||
"raw_string": "layers"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"primary": {},
|
|
||||||
"value": {
|
|
||||||
"map": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/root.d2,2:8:14-9:0:63",
|
|
||||||
"nodes": [
|
|
||||||
{
|
|
||||||
"map_key": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/root.d2,3:2:18-5:3:38",
|
|
||||||
"key": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/root.d2,3:2:18-3:5:21",
|
|
||||||
"path": [
|
|
||||||
{
|
|
||||||
"unquoted_string": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/root.d2,3:2:18-3:5:21",
|
|
||||||
"value": [
|
|
||||||
{
|
|
||||||
"string": "one",
|
|
||||||
"raw_string": "one"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"primary": {},
|
|
||||||
"value": {
|
|
||||||
"map": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/root.d2,3:7:23-5:2:37",
|
|
||||||
"nodes": [
|
|
||||||
{
|
|
||||||
"map_key": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/root.d2,4:4:29-4:9:34",
|
|
||||||
"key": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/root.d2,4:4:29-4:9:34",
|
|
||||||
"path": [
|
|
||||||
{
|
|
||||||
"unquoted_string": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/root.d2,4:4:29-4:9:34",
|
|
||||||
"value": [
|
|
||||||
{
|
|
||||||
"string": "santa",
|
|
||||||
"raw_string": "santa"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"primary": {},
|
|
||||||
"value": {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"map_key": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/root.d2,6:2:41-8:3:62",
|
|
||||||
"key": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/root.d2,6:2:41-6:5:44",
|
|
||||||
"path": [
|
|
||||||
{
|
|
||||||
"unquoted_string": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/root.d2,6:2:41-6:5:44",
|
|
||||||
"value": [
|
|
||||||
{
|
|
||||||
"string": "two",
|
|
||||||
"raw_string": "two"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"primary": {},
|
|
||||||
"value": {
|
|
||||||
"map": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/root.d2,6:7:46-8:2:61",
|
|
||||||
"nodes": [
|
|
||||||
{
|
|
||||||
"map_key": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/root.d2,7:4:52-7:10:58",
|
|
||||||
"key": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/root.d2,7:4:52-7:10:58",
|
|
||||||
"path": [
|
|
||||||
{
|
|
||||||
"unquoted_string": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/root.d2,7:4:52-7:10:58",
|
|
||||||
"value": [
|
|
||||||
{
|
|
||||||
"string": "clause",
|
|
||||||
"raw_string": "clause"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"primary": {},
|
|
||||||
"value": {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"root": {
|
|
||||||
"id": "",
|
|
||||||
"id_val": "",
|
|
||||||
"label_dimensions": {
|
|
||||||
"width": 0,
|
|
||||||
"height": 0
|
|
||||||
},
|
|
||||||
"attributes": {
|
|
||||||
"label": {
|
|
||||||
"value": ""
|
|
||||||
},
|
|
||||||
"style": {},
|
|
||||||
"near_key": null,
|
|
||||||
"shape": {
|
|
||||||
"value": ""
|
|
||||||
},
|
|
||||||
"direction": {
|
|
||||||
"value": ""
|
|
||||||
},
|
|
||||||
"constraint": {
|
|
||||||
"value": ""
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"zIndex": 0
|
|
||||||
},
|
|
||||||
"edges": null,
|
|
||||||
"objects": [
|
|
||||||
{
|
|
||||||
"id": "base",
|
|
||||||
"id_val": "base",
|
|
||||||
"label_dimensions": {
|
|
||||||
"width": 0,
|
|
||||||
"height": 0
|
|
||||||
},
|
|
||||||
"references": [
|
|
||||||
{
|
|
||||||
"key": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/root.d2,0:0:0-0:4:4",
|
|
||||||
"path": [
|
|
||||||
{
|
|
||||||
"unquoted_string": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/root.d2,0:0:0-0:4:4",
|
|
||||||
"value": [
|
|
||||||
{
|
|
||||||
"string": "base",
|
|
||||||
"raw_string": "base"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"key_path_index": 0,
|
|
||||||
"map_key_edge_index": -1
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"attributes": {
|
|
||||||
"label": {
|
|
||||||
"value": "base"
|
|
||||||
},
|
|
||||||
"style": {},
|
|
||||||
"near_key": null,
|
|
||||||
"shape": {
|
|
||||||
"value": "rectangle"
|
|
||||||
},
|
|
||||||
"direction": {
|
|
||||||
"value": ""
|
|
||||||
},
|
|
||||||
"constraint": {
|
|
||||||
"value": ""
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"zIndex": 0
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"layers": [
|
|
||||||
{
|
|
||||||
"name": "one",
|
|
||||||
"ast": null,
|
|
||||||
"root": {
|
|
||||||
"id": "",
|
|
||||||
"id_val": "",
|
|
||||||
"label_dimensions": {
|
|
||||||
"width": 0,
|
|
||||||
"height": 0
|
|
||||||
},
|
|
||||||
"attributes": {
|
|
||||||
"label": {
|
|
||||||
"value": ""
|
|
||||||
},
|
|
||||||
"style": {},
|
|
||||||
"near_key": null,
|
|
||||||
"shape": {
|
|
||||||
"value": ""
|
|
||||||
},
|
|
||||||
"direction": {
|
|
||||||
"value": ""
|
|
||||||
},
|
|
||||||
"constraint": {
|
|
||||||
"value": ""
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"zIndex": 0
|
|
||||||
},
|
|
||||||
"edges": null,
|
|
||||||
"objects": [
|
|
||||||
{
|
|
||||||
"id": "santa",
|
|
||||||
"id_val": "santa",
|
|
||||||
"label_dimensions": {
|
|
||||||
"width": 0,
|
|
||||||
"height": 0
|
|
||||||
},
|
|
||||||
"references": [
|
|
||||||
{
|
|
||||||
"key": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/root.d2,4:4:29-4:9:34",
|
|
||||||
"path": [
|
|
||||||
{
|
|
||||||
"unquoted_string": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/root.d2,4:4:29-4:9:34",
|
|
||||||
"value": [
|
|
||||||
{
|
|
||||||
"string": "santa",
|
|
||||||
"raw_string": "santa"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"key_path_index": 0,
|
|
||||||
"map_key_edge_index": -1
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"attributes": {
|
|
||||||
"label": {
|
|
||||||
"value": "santa"
|
|
||||||
},
|
|
||||||
"style": {},
|
|
||||||
"near_key": null,
|
|
||||||
"shape": {
|
|
||||||
"value": "rectangle"
|
|
||||||
},
|
|
||||||
"direction": {
|
|
||||||
"value": ""
|
|
||||||
},
|
|
||||||
"constraint": {
|
|
||||||
"value": ""
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"zIndex": 0
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "two",
|
|
||||||
"ast": null,
|
|
||||||
"root": {
|
|
||||||
"id": "",
|
|
||||||
"id_val": "",
|
|
||||||
"label_dimensions": {
|
|
||||||
"width": 0,
|
|
||||||
"height": 0
|
|
||||||
},
|
|
||||||
"attributes": {
|
|
||||||
"label": {
|
|
||||||
"value": ""
|
|
||||||
},
|
|
||||||
"style": {},
|
|
||||||
"near_key": null,
|
|
||||||
"shape": {
|
|
||||||
"value": ""
|
|
||||||
},
|
|
||||||
"direction": {
|
|
||||||
"value": ""
|
|
||||||
},
|
|
||||||
"constraint": {
|
|
||||||
"value": ""
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"zIndex": 0
|
|
||||||
},
|
|
||||||
"edges": null,
|
|
||||||
"objects": [
|
|
||||||
{
|
|
||||||
"id": "clause",
|
|
||||||
"id_val": "clause",
|
|
||||||
"label_dimensions": {
|
|
||||||
"width": 0,
|
|
||||||
"height": 0
|
|
||||||
},
|
|
||||||
"references": [
|
|
||||||
{
|
|
||||||
"key": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/root.d2,7:4:52-7:10:58",
|
|
||||||
"path": [
|
|
||||||
{
|
|
||||||
"unquoted_string": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/scenarios/root.d2,7:4:52-7:10:58",
|
|
||||||
"value": [
|
|
||||||
{
|
|
||||||
"string": "clause",
|
|
||||||
"raw_string": "clause"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"key_path_index": 0,
|
|
||||||
"map_key_edge_index": -1
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"attributes": {
|
|
||||||
"label": {
|
|
||||||
"value": "clause"
|
|
||||||
},
|
|
||||||
"style": {},
|
|
||||||
"near_key": null,
|
|
||||||
"shape": {
|
|
||||||
"value": "rectangle"
|
|
||||||
},
|
|
||||||
"direction": {
|
|
||||||
"value": ""
|
|
||||||
},
|
|
||||||
"constraint": {
|
|
||||||
"value": ""
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"zIndex": 0
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"err": null
|
|
||||||
}
|
|
||||||
1539
testdata/d2ir/TestCompile/layers/errs/4/good_edge.exp.json
generated
vendored
Normal file
1539
testdata/d2ir/TestCompile/layers/errs/4/good_edge.exp.json
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue