From 2fcc9ed14077245519356fc2c396bd97fb5b0269 Mon Sep 17 00:00:00 2001 From: Anmol Sethi Date: Sun, 4 Jun 2023 15:39:00 -0700 Subject: [PATCH] d2ir: Compile imports Works as so: index.d2: ```d2 x: @x ``` x.d2: ```d2 label: meow shape: circle ``` TODO: - [ ] Correctly import into fields by handling the scenarios/steps overlay. - And links. - [ ] Test every kind of import. --- d2ast/d2ast.go | 22 +- d2compiler/compile.go | 19 +- d2ir/compile.go | 89 ++++++- d2ir/compile_test.go | 16 +- d2ir/import.go | 98 +++++++ d2ir/import_test.go | 81 ++++++ d2oracle/edit.go | 2 +- d2parser/parse.go | 3 + go.mod | 2 +- go.sum | 4 + .../d2compiler/TestCompile/3d_oval.exp.json | 1 - .../TestCompile/bad-style-nesting.exp.json | 1 - .../TestCompile/blank_underscore.exp.json | 1 - .../border-radius-negative.exp.json | 1 - .../classes-internal-edge.exp.json | 1 - .../TestCompile/classes-unreserved.exp.json | 1 - .../TestCompile/edge_in_column.exp.json | 1 - .../TestCompile/edge_invalid_style.exp.json | 1 - .../edge_map_non_reserved.exp.json | 1 - .../TestCompile/edge_to_style.exp.json | 1 - .../TestCompile/edge_unquoted_hex.exp.json | 1 - .../equal_dimensions_on_circle.exp.json | 1 - .../errors/missing_shape_icon.exp.json | 1 - .../errors/reserved_icon_style.exp.json | 1 - .../d2compiler/TestCompile/grid_edge.exp.json | 1 - .../TestCompile/grid_gap_negative.exp.json | 1 - .../TestCompile/grid_negative.exp.json | 1 - .../TestCompile/illegal-stroke-width.exp.json | 1 - .../TestCompile/image_children_Steps.exp.json | 1 - .../TestCompile/image_non_style.exp.json | 1 - .../TestCompile/improper-class-ref.exp.json | 1 - .../TestCompile/invalid-fill-pattern.exp.json | 1 - .../TestCompile/invalid_direction.exp.json | 1 - .../TestCompile/leaky_sequence.exp.json | 1 - .../TestCompile/link-board-not-board.exp.json | 1 - .../TestCompile/link-board-not-found.exp.json | 1 - .../link-board-underscore-not-found.exp.json | 1 - .../TestCompile/md_block_string_err.exp.json | 1 - .../TestCompile/near-invalid.exp.json | 1 - .../TestCompile/near_bad_connected.exp.json | 1 - .../TestCompile/near_bad_constant.exp.json | 1 - ...ear_descendant_connect_to_outside.exp.json | 1 - .../TestCompile/near_near_const.exp.json | 1 - .../TestCompile/near_sequence.exp.json | 1 - .../TestCompile/nested_edge.exp.json | 1 - .../TestCompile/nested_near_constant.exp.json | 1 - .../no-class-inside-classes.exp.json | 1 - .../TestCompile/no-class-primary.exp.json | 1 - .../no-nested-columns-class.exp.json | 1 - .../no-nested-columns-sql-2.exp.json | 1 - .../no-nested-columns-sql.exp.json | 1 - ...link_and_url_tooltip_concurrently.exp.json | 1 - .../TestCompile/obj_invalid_style.exp.json | 1 - .../object_arrowhead_shape.exp.json | 1 - .../TestCompile/positions_negative.exp.json | 1 - .../TestCompile/shape_edge_style.exp.json | 1 - .../TestCompile/shape_unquoted_hex.exp.json | 1 - .../d2compiler/TestCompile/sql-panic.exp.json | 1 - .../TestCompile/tail-style-map.exp.json | 1 - .../TestCompile/tail-style.exp.json | 1 - .../underscore_parent_middle_path.exp.json | 1 - .../underscore_parent_root.exp.json | 1 - .../underscore_parent_sandwich_path.exp.json | 1 - .../TestCompile/unsemantic_markdown.exp.json | 1 - .../unsemantic_markdown_2.exp.json | 1 - .../boards/errs/duplicate_board.exp.json | 1 - .../d2ir/TestCompile/imports/#00.exp.json | 82 ++++++ .../d2ir/TestCompile/imports/nested.exp.json | 249 ++++++++++++++++++ .../d2ir/TestCompile/imports/spread.exp.json | 82 ++++++ .../d2ir/TestCompile/imports/value.exp.json | 238 +++++++++++++++++ 70 files changed, 975 insertions(+), 68 deletions(-) create mode 100644 d2ir/import.go create mode 100644 d2ir/import_test.go create mode 100644 testdata/d2ir/TestCompile/imports/#00.exp.json create mode 100644 testdata/d2ir/TestCompile/imports/nested.exp.json create mode 100644 testdata/d2ir/TestCompile/imports/spread.exp.json create mode 100644 testdata/d2ir/TestCompile/imports/value.exp.json diff --git a/d2ast/d2ast.go b/d2ast/d2ast.go index 3d42c372f..40979145e 100644 --- a/d2ast/d2ast.go +++ b/d2ast/d2ast.go @@ -1021,8 +1021,8 @@ type InterpolationBox struct { // & is only special if it begins a key. // - is only special if followed by another - in a key. // ' " and | are only special if they begin an unquoted key or value. -var UnquotedKeySpecials = string([]rune{'#', ';', '\n', '\\', '{', '}', '[', ']', '\'', '"', '|', ':', '.', '-', '<', '>', '*', '&', '(', ')'}) -var UnquotedValueSpecials = string([]rune{'#', ';', '\n', '\\', '{', '}', '[', ']', '\'', '"', '|', '$'}) +var UnquotedKeySpecials = string([]rune{'#', ';', '\n', '\\', '{', '}', '[', ']', '\'', '"', '|', ':', '.', '-', '<', '>', '*', '&', '(', ')', '@'}) +var UnquotedValueSpecials = string([]rune{'#', ';', '\n', '\\', '{', '}', '[', ']', '\'', '"', '|', '$', '@'}) // RawString returns s in a AST String node that can format s in the most aesthetically // pleasing way. @@ -1071,8 +1071,26 @@ func RawString(s string, inKey bool) String { return FlatUnquotedString(s) } +func RawStringBox(s string, inKey bool) *StringBox { + return MakeValueBox(RawString(s, inKey)).StringBox() +} + func hasSurroundingWhitespace(s string) bool { r, _ := utf8.DecodeRuneInString(s) r2, _ := utf8.DecodeLastRuneInString(s) return unicode.IsSpace(r) || unicode.IsSpace(r2) } + +func (s *Substitution) IDA() (ida []string) { + for _, el := range s.Path { + ida = append(ida, el.Unbox().ScalarString()) + } + return ida +} + +func (i *Import) IDA() (ida []string) { + for _, el := range i.Path[1:] { + ida = append(ida, el.Unbox().ScalarString()) + } + return ida +} diff --git a/d2compiler/compile.go b/d2compiler/compile.go index 4c39c7084..90555380d 100644 --- a/d2compiler/compile.go +++ b/d2compiler/compile.go @@ -4,7 +4,9 @@ import ( "encoding/xml" "fmt" "io" + "io/fs" "net/url" + "os" "strconv" "strings" @@ -21,12 +23,18 @@ import ( type CompileOptions struct { UTF16 bool + // FS is the file system used for resolving imports in the d2 text. + // It should correspond to the root path. + FS fs.FS } func Compile(path string, r io.RuneReader, opts *CompileOptions) (*d2graph.Graph, error) { if opts == nil { opts = &CompileOptions{} } + if opts.FS == nil { + opts.FS = os.DirFS("/") + } ast, err := d2parser.Parse(path, r, &d2parser.ParseOptions{ UTF16: opts.UTF16, @@ -35,7 +43,10 @@ func Compile(path string, r io.RuneReader, opts *CompileOptions) (*d2graph.Graph return nil, err } - ir, err := d2ir.Compile(ast) + ir, err := d2ir.Compile(ast, &d2ir.CompileOptions{ + UTF16: opts.UTF16, + FS: opts.FS, + }) if err != nil { return nil, err } @@ -50,7 +61,9 @@ func Compile(path string, r io.RuneReader, opts *CompileOptions) (*d2graph.Graph } func compileIR(ast *d2ast.Map, m *d2ir.Map) (*d2graph.Graph, error) { - c := &compiler{} + c := &compiler{ + err: &d2parser.ParseError{}, + } g := d2graph.NewGraph() g.AST = ast @@ -116,7 +129,7 @@ func (c *compiler) compileBoardsField(g *d2graph.Graph, ir *d2ir.Map, fieldName } type compiler struct { - err d2parser.ParseError + err *d2parser.ParseError } func (c *compiler) errorf(n d2ast.Node, f string, v ...interface{}) { diff --git a/d2ir/compile.go b/d2ir/compile.go index a1723464b..2d2c93721 100644 --- a/d2ir/compile.go +++ b/d2ir/compile.go @@ -1,6 +1,7 @@ package d2ir import ( + "io/fs" "strings" "oss.terrastruct.com/d2/d2ast" @@ -9,18 +10,46 @@ import ( ) type compiler struct { - err d2parser.ParseError + err *d2parser.ParseError + + fs fs.FS + // importStack is used to detect cyclic imports. + importStack []string + // importCache enables reuse of files imported multiple times. + importCache map[string]*Map + utf16 bool +} + +type CompileOptions struct { + UTF16 bool + // Pass nil to disable imports. + FS fs.FS } func (c *compiler) errorf(n d2ast.Node, f string, v ...interface{}) { c.err.Errors = append(c.err.Errors, d2parser.Errorf(n, f, v...).(d2ast.Error)) } -func Compile(ast *d2ast.Map) (*Map, error) { - c := &compiler{} +func Compile(ast *d2ast.Map, opts *CompileOptions) (*Map, error) { + if opts == nil { + opts = &CompileOptions{} + } + c := &compiler{ + err: &d2parser.ParseError{}, + fs: opts.FS, + + importCache: make(map[string]*Map), + utf16: opts.UTF16, + } m := &Map{} m.initRoot() m.parent.(*Field).References[0].Context.Scope = ast + + c.pushImportStack(&d2ast.Import{ + Path: []*d2ast.StringBox{d2ast.RawStringBox(ast.GetRange().Path, true)}, + }) + defer c.popImportStack() + c.compileMap(m, ast) c.compileClasses(m) if !c.err.Empty() { @@ -85,6 +114,16 @@ func (c *compiler) compileMap(dst *Map, ast *d2ast.Map) { Scope: ast, ScopeMap: dst, }) + case n.Import != nil: + impn, ok := c._import(n.Import) + if !ok { + continue + } + if impn.Map() == nil { + c.errorf(n.Import, "cannot spread import non map into map") + continue + } + OverlayMap(dst, impn.Map()) case n.Substitution != nil: panic("TODO") } @@ -145,6 +184,22 @@ func (c *compiler) compileField(dst *Map, kp *d2ast.KeyPath, refctx *RefContext) case BoardScenario, BoardStep: c.compileClasses(f.Map()) } + } else if refctx.Key.Value.Import != nil { + n, ok := c._import(refctx.Key.Value.Import) + if !ok { + return + } + switch n := n.(type) { + case *Field: + if n.Primary_ != nil { + f.Primary_ = n.Primary_.Copy(f).(*Scalar) + } + if n.Composite != nil { + f.Composite = n.Composite.Copy(f).(Composite) + } + case *Map: + f.Composite = n.Copy(f).(Composite) + } } else if refctx.Key.Value.ScalarBox().Unbox() != nil { // If the link is a board, we need to transform it into an absolute path. if f.Name == "link" { @@ -330,6 +385,34 @@ func (c *compiler) compileArray(dst *Array, a *d2ast.Array) { parent: dst, Value: v, } + case *d2ast.Import: + n, ok := c._import(v) + if !ok { + continue + } + switch n := n.(type) { + case *Field: + if v.Spread { + a, ok := n.Composite.(*Array) + if !ok { + c.errorf(v, "can only spread import array into array") + continue + } + dst.Values = append(dst.Values, a.Values...) + continue + } + if n.Composite != nil { + irv = n.Composite + } else { + irv = n.Primary_ + } + case *Map: + if v.Spread { + c.errorf(v, "cannot spread import map into array") + continue + } + irv = n + } case *d2ast.Substitution: // panic("TODO") } diff --git a/d2ir/compile_test.go b/d2ir/compile_test.go index b9fc2250d..2435d3d5f 100644 --- a/d2ir/compile_test.go +++ b/d2ir/compile_test.go @@ -9,6 +9,7 @@ import ( "oss.terrastruct.com/util-go/assert" "oss.terrastruct.com/util-go/diff" + "oss.terrastruct.com/util-go/mapfs" "oss.terrastruct.com/d2/d2ast" "oss.terrastruct.com/d2/d2ir" @@ -24,6 +25,7 @@ func TestCompile(t *testing.T) { t.Run("layers", testCompileLayers) t.Run("scenarios", testCompileScenarios) t.Run("steps", testCompileSteps) + t.Run("imports", testCompileImports) } type testCase struct { @@ -45,10 +47,20 @@ func compile(t testing.TB, text string) (*d2ir.Map, error) { t.Helper() d2Path := fmt.Sprintf("%v.d2", t.Name()) - ast, err := d2parser.Parse(d2Path, strings.NewReader(text), nil) + return compileFS(t, d2Path, map[string]string{d2Path: text}) +} + +func compileFS(t testing.TB, path string, mfs map[string]string) (*d2ir.Map, error) { + t.Helper() + + ast, err := d2parser.Parse(path, strings.NewReader(mfs[path]), nil) assert.Success(t, err) - m, err := d2ir.Compile(ast) + fs, err := mapfs.New(mfs) + assert.Success(t, err) + m, err := d2ir.Compile(ast, &d2ir.CompileOptions{ + FS: fs, + }) if err != nil { return nil, err } diff --git a/d2ir/import.go b/d2ir/import.go new file mode 100644 index 000000000..800d5322e --- /dev/null +++ b/d2ir/import.go @@ -0,0 +1,98 @@ +package d2ir + +import ( + "bufio" + "path" + + "oss.terrastruct.com/d2/d2ast" + "oss.terrastruct.com/d2/d2parser" +) + +func (c *compiler) pushImportStack(imp *d2ast.Import) bool { + if len(imp.Path) == 0 { + c.errorf(imp, "imports must specify a path to import") + return false + } + + newPath := imp.Path[0].Unbox().ScalarString() + for _, p := range c.importStack { + if newPath == p { + c.errorf(imp, "detected cyclic import of %q", newPath) + return false + } + } + + c.importStack = append(c.importStack, newPath) + return true +} + +func (c *compiler) popImportStack() { + c.importStack = c.importStack[:len(c.importStack)-1] +} + +// Returns either *Map or *Field. +func (c *compiler) _import(imp *d2ast.Import) (Node, bool) { + ir, ok := c.__import(imp) + if !ok { + return nil, false + } + if len(imp.IDA()) > 0 { + f := ir.GetField(imp.IDA()...) + if f == nil { + c.errorf(imp, "import key %q doesn't exist inside import", imp.IDA()) + return nil, false + } + return f, true + } + return ir, true +} + +func (c *compiler) __import(imp *d2ast.Import) (*Map, bool) { + impPath := imp.Path[0].Unbox().ScalarString() + if path.IsAbs(impPath) { + c.errorf(imp, "import paths must be relative") + return nil, false + } + + if path.Ext(impPath) != ".d2" { + impPath += ".d2" + } + + // Imports are always relative to the importing file. + impPath = path.Join(path.Dir(c.importStack[len(c.importStack)-1]), impPath) + + if !c.pushImportStack(imp) { + return nil, false + } + defer c.popImportStack() + + ir, ok := c.importCache[impPath] + if ok { + return ir, true + } + + f, err := c.fs.Open(impPath) + if err != nil { + c.errorf(imp, "failed to import %q: %v", impPath, err) + return nil, false + } + defer f.Close() + + ast, err := d2parser.Parse(impPath, bufio.NewReader(f), &d2parser.ParseOptions{ + UTF16: c.utf16, + ParseError: c.err, + }) + if err != nil { + return nil, false + } + + ir = &Map{} + ir.initRoot() + ir.parent.(*Field).References[0].Context.Scope = ast + + c.compileMap(ir, ast) + + c.importCache[impPath] = ir + + return ir, true +} diff --git a/d2ir/import_test.go b/d2ir/import_test.go new file mode 100644 index 000000000..05c95aafb --- /dev/null +++ b/d2ir/import_test.go @@ -0,0 +1,81 @@ +package d2ir_test + +import ( + "testing" + + "oss.terrastruct.com/util-go/assert" +) + +func testCompileImports(t *testing.T) { + t.Parallel() + + tca := []testCase{ + { + name: "value", + run: func(t testing.TB) { + m, err := compileFS(t, "index.d2", map[string]string{ + "index.d2": "x: @x.d2", + "x.d2": `shape: circle +label: meow`, + }) + assert.Success(t, err) + assertQuery(t, m, 3, 0, nil, "") + assertQuery(t, m, 2, 0, nil, "x") + assertQuery(t, m, 0, 0, "circle", "x.shape") + assertQuery(t, m, 0, 0, "meow", "x.label") + }, + }, + { + name: "nested", + run: func(t testing.TB) { + m, err := compileFS(t, "index.d2", map[string]string{ + "index.d2": "x: @x.y", + "x.d2": `y: { + shape: circle + label: meow +}`, + }) + assert.Success(t, err) + assertQuery(t, m, 3, 0, nil, "") + assertQuery(t, m, 2, 0, nil, "x") + assertQuery(t, m, 0, 0, "circle", "x.shape") + assertQuery(t, m, 0, 0, "meow", "x.label") + }, + }, + { + name: "spread", + run: func(t testing.TB) { + m, err := compileFS(t, "index.d2", map[string]string{ + "index.d2": "...@x.d2", + "x.d2": "x: wowa", + }) + assert.Success(t, err) + assertQuery(t, m, 1, 0, nil, "") + assertQuery(t, m, 0, 0, "wowa", "x") + }, + }, + } + + runa(t, tca) + + t.Run("errors", func(t *testing.T) { + tca := []testCase{ + { + name: "parse_error", + run: func(t testing.TB) { + _, err := compileFS(t, "index.d2", map[string]string{ + "index.d2": "...@x.d2", + "x.d2": "x<><><<>q", + }) + assert.ErrorString(t, err, `x.d2:1:1: connection missing destination +x.d2:1:4: connection missing source +x.d2:1:4: connection missing destination +x.d2:1:6: connection missing source +x.d2:1:6: connection missing destination +x.d2:1:7: connection missing source`) + }, + }, + } + runa(t, tca) + }) +} diff --git a/d2oracle/edit.go b/d2oracle/edit.go index 1fbf2caf2..9549c65b2 100644 --- a/d2oracle/edit.go +++ b/d2oracle/edit.go @@ -347,7 +347,7 @@ func _set(g *d2graph.Graph, key string, tag, value *string) error { } } - ir, err := d2ir.Compile(g.AST) + ir, err := d2ir.Compile(g.AST, nil) if err != nil { return err } diff --git a/d2parser/parse.go b/d2parser/parse.go index d4156871d..b13d1609f 100644 --- a/d2parser/parse.go +++ b/d2parser/parse.go @@ -59,6 +59,7 @@ func Parse(path string, r io.RuneReader, opts *ParseOptions) (*d2ast.Map, error) func ParseKey(key string) (*d2ast.KeyPath, error) { p := &parser{ reader: strings.NewReader(key), + err: &ParseError{}, } k := p.parseKey() @@ -74,6 +75,7 @@ func ParseKey(key string) (*d2ast.KeyPath, error) { func ParseMapKey(mapKey string) (*d2ast.Key, error) { p := &parser{ reader: strings.NewReader(mapKey), + err: &ParseError{}, } mk := p.parseMapKey() @@ -89,6 +91,7 @@ func ParseMapKey(mapKey string) (*d2ast.Key, error) { func ParseValue(value string) (d2ast.Value, error) { p := &parser{ reader: strings.NewReader(value), + err: &ParseError{}, } v := p.parseValue() diff --git a/go.mod b/go.mod index ce86dfc85..92b1ac752 100644 --- a/go.mod +++ b/go.mod @@ -27,7 +27,7 @@ require ( golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 gonum.org/v1/plot v0.12.0 nhooyr.io/websocket v1.8.7 - oss.terrastruct.com/util-go v0.0.0-20230320053557-dcb5aac7d972 + oss.terrastruct.com/util-go v0.0.0-20230604222829-11c3c60fec14 ) require ( diff --git a/go.sum b/go.sum index 900e291b9..83097b0cd 100644 --- a/go.sum +++ b/go.sum @@ -331,4 +331,8 @@ nhooyr.io/websocket v1.8.7 h1:usjR2uOr/zjjkVMy0lW+PPohFok7PCow5sDjLgX4P4g= nhooyr.io/websocket v1.8.7/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0= oss.terrastruct.com/util-go v0.0.0-20230320053557-dcb5aac7d972 h1:HS7fg2GzGsqRLApsoh7ztaLMvXzxSln/Hfz4wy4tIDA= oss.terrastruct.com/util-go v0.0.0-20230320053557-dcb5aac7d972/go.mod h1:eMWv0sOtD9T2RUl90DLWfuShZCYp4NrsqNpI8eqO6U4= +oss.terrastruct.com/util-go v0.0.0-20230604220107-5ffc52e2e534 h1:6RWrCAg2bzrmGCXd063nkqaHYJHd3KiN3lVfchm4o5I= +oss.terrastruct.com/util-go v0.0.0-20230604220107-5ffc52e2e534/go.mod h1:eMWv0sOtD9T2RUl90DLWfuShZCYp4NrsqNpI8eqO6U4= +oss.terrastruct.com/util-go v0.0.0-20230604222829-11c3c60fec14 h1:oy5vtt6O2qYxeSpqWhyevrdUenFfuhphixozUlpL6qY= +oss.terrastruct.com/util-go v0.0.0-20230604222829-11c3c60fec14/go.mod h1:eMWv0sOtD9T2RUl90DLWfuShZCYp4NrsqNpI8eqO6U4= rsc.io/pdf v0.1.1 h1:k1MczvYDUvJBe93bYd7wrZLLUEcLZAuF824/I4e5Xr4= diff --git a/testdata/d2compiler/TestCompile/3d_oval.exp.json b/testdata/d2compiler/TestCompile/3d_oval.exp.json index 997f4d61c..abc612f0c 100644 --- a/testdata/d2compiler/TestCompile/3d_oval.exp.json +++ b/testdata/d2compiler/TestCompile/3d_oval.exp.json @@ -1,7 +1,6 @@ { "graph": null, "err": { - "ioerr": null, "errs": [ { "range": "d2/testdata/d2compiler/TestCompile/3d_oval.d2,1:0:17-1:19:36", diff --git a/testdata/d2compiler/TestCompile/bad-style-nesting.exp.json b/testdata/d2compiler/TestCompile/bad-style-nesting.exp.json index 4017433f8..51bcf33f8 100644 --- a/testdata/d2compiler/TestCompile/bad-style-nesting.exp.json +++ b/testdata/d2compiler/TestCompile/bad-style-nesting.exp.json @@ -1,7 +1,6 @@ { "graph": null, "err": { - "ioerr": null, "errs": [ { "range": "d2/testdata/d2compiler/TestCompile/bad-style-nesting.d2,0:12:12-0:17:17", diff --git a/testdata/d2compiler/TestCompile/blank_underscore.exp.json b/testdata/d2compiler/TestCompile/blank_underscore.exp.json index 01f1b3a53..2407686ee 100644 --- a/testdata/d2compiler/TestCompile/blank_underscore.exp.json +++ b/testdata/d2compiler/TestCompile/blank_underscore.exp.json @@ -1,7 +1,6 @@ { "graph": null, "err": { - "ioerr": null, "errs": [ { "range": "d2/testdata/d2compiler/TestCompile/blank_underscore.d2,2:2:11-2:3:12", diff --git a/testdata/d2compiler/TestCompile/border-radius-negative.exp.json b/testdata/d2compiler/TestCompile/border-radius-negative.exp.json index fe11d846b..c1c73b875 100644 --- a/testdata/d2compiler/TestCompile/border-radius-negative.exp.json +++ b/testdata/d2compiler/TestCompile/border-radius-negative.exp.json @@ -1,7 +1,6 @@ { "graph": null, "err": { - "ioerr": null, "errs": [ { "range": "d2/testdata/d2compiler/TestCompile/border-radius-negative.d2,2:23:30-2:25:32", diff --git a/testdata/d2compiler/TestCompile/classes-internal-edge.exp.json b/testdata/d2compiler/TestCompile/classes-internal-edge.exp.json index c3a2adf37..26af3fe34 100644 --- a/testdata/d2compiler/TestCompile/classes-internal-edge.exp.json +++ b/testdata/d2compiler/TestCompile/classes-internal-edge.exp.json @@ -1,7 +1,6 @@ { "graph": null, "err": { - "ioerr": null, "errs": [ { "range": "d2/testdata/d2compiler/TestCompile/classes-internal-edge.d2,7:2:72-7:16:86", diff --git a/testdata/d2compiler/TestCompile/classes-unreserved.exp.json b/testdata/d2compiler/TestCompile/classes-unreserved.exp.json index b33e928eb..ed16fbcd9 100644 --- a/testdata/d2compiler/TestCompile/classes-unreserved.exp.json +++ b/testdata/d2compiler/TestCompile/classes-unreserved.exp.json @@ -1,7 +1,6 @@ { "graph": null, "err": { - "ioerr": null, "errs": [ { "range": "d2/testdata/d2compiler/TestCompile/classes-unreserved.d2,2:4:26-2:8:30", diff --git a/testdata/d2compiler/TestCompile/edge_in_column.exp.json b/testdata/d2compiler/TestCompile/edge_in_column.exp.json index 4a390573c..7e501c52a 100644 --- a/testdata/d2compiler/TestCompile/edge_in_column.exp.json +++ b/testdata/d2compiler/TestCompile/edge_in_column.exp.json @@ -1,7 +1,6 @@ { "graph": null, "err": { - "ioerr": null, "errs": [ { "range": "d2/testdata/d2compiler/TestCompile/edge_in_column.d2,2:6:30-2:7:31", diff --git a/testdata/d2compiler/TestCompile/edge_invalid_style.exp.json b/testdata/d2compiler/TestCompile/edge_invalid_style.exp.json index ec8465277..673768d0d 100644 --- a/testdata/d2compiler/TestCompile/edge_invalid_style.exp.json +++ b/testdata/d2compiler/TestCompile/edge_invalid_style.exp.json @@ -1,7 +1,6 @@ { "graph": null, "err": { - "ioerr": null, "errs": [ { "range": "d2/testdata/d2compiler/TestCompile/edge_invalid_style.d2,1:2:12-1:9:19", diff --git a/testdata/d2compiler/TestCompile/edge_map_non_reserved.exp.json b/testdata/d2compiler/TestCompile/edge_map_non_reserved.exp.json index b33df932b..5c68aaac6 100644 --- a/testdata/d2compiler/TestCompile/edge_map_non_reserved.exp.json +++ b/testdata/d2compiler/TestCompile/edge_map_non_reserved.exp.json @@ -1,7 +1,6 @@ { "graph": null, "err": { - "ioerr": null, "errs": [ { "range": "d2/testdata/d2compiler/TestCompile/edge_map_non_reserved.d2,2:2:13-2:3:14", diff --git a/testdata/d2compiler/TestCompile/edge_to_style.exp.json b/testdata/d2compiler/TestCompile/edge_to_style.exp.json index 4b0ac711c..2651a89b4 100644 --- a/testdata/d2compiler/TestCompile/edge_to_style.exp.json +++ b/testdata/d2compiler/TestCompile/edge_to_style.exp.json @@ -1,7 +1,6 @@ { "graph": null, "err": { - "ioerr": null, "errs": [ { "range": "d2/testdata/d2compiler/TestCompile/edge_to_style.d2,1:7:31-1:12:36", diff --git a/testdata/d2compiler/TestCompile/edge_unquoted_hex.exp.json b/testdata/d2compiler/TestCompile/edge_unquoted_hex.exp.json index 153cd212a..1c33c9730 100644 --- a/testdata/d2compiler/TestCompile/edge_unquoted_hex.exp.json +++ b/testdata/d2compiler/TestCompile/edge_unquoted_hex.exp.json @@ -1,7 +1,6 @@ { "graph": null, "err": { - "ioerr": null, "errs": [ { "range": "d2/testdata/d2compiler/TestCompile/edge_unquoted_hex.d2,2:9:29-2:10:30", diff --git a/testdata/d2compiler/TestCompile/equal_dimensions_on_circle.exp.json b/testdata/d2compiler/TestCompile/equal_dimensions_on_circle.exp.json index dd0a210f2..210bf49c7 100644 --- a/testdata/d2compiler/TestCompile/equal_dimensions_on_circle.exp.json +++ b/testdata/d2compiler/TestCompile/equal_dimensions_on_circle.exp.json @@ -1,7 +1,6 @@ { "graph": null, "err": { - "ioerr": null, "errs": [ { "range": "d2/testdata/d2compiler/TestCompile/equal_dimensions_on_circle.d2,2:1:26-2:11:36", diff --git a/testdata/d2compiler/TestCompile/errors/missing_shape_icon.exp.json b/testdata/d2compiler/TestCompile/errors/missing_shape_icon.exp.json index e4b3afbd9..b73ef0eb3 100644 --- a/testdata/d2compiler/TestCompile/errors/missing_shape_icon.exp.json +++ b/testdata/d2compiler/TestCompile/errors/missing_shape_icon.exp.json @@ -1,7 +1,6 @@ { "graph": null, "err": { - "ioerr": null, "errs": [ { "range": "d2/testdata/d2compiler/TestCompile/errors/missing_shape_icon.d2,0:0:0-0:14:14", diff --git a/testdata/d2compiler/TestCompile/errors/reserved_icon_style.exp.json b/testdata/d2compiler/TestCompile/errors/reserved_icon_style.exp.json index 26dde5d47..1286cf4bf 100644 --- a/testdata/d2compiler/TestCompile/errors/reserved_icon_style.exp.json +++ b/testdata/d2compiler/TestCompile/errors/reserved_icon_style.exp.json @@ -1,7 +1,6 @@ { "graph": null, "err": { - "ioerr": null, "errs": [ { "range": "d2/testdata/d2compiler/TestCompile/errors/reserved_icon_style.d2,2:8:23-2:27:42", diff --git a/testdata/d2compiler/TestCompile/grid_edge.exp.json b/testdata/d2compiler/TestCompile/grid_edge.exp.json index 52a77accb..e1a46d1d8 100644 --- a/testdata/d2compiler/TestCompile/grid_edge.exp.json +++ b/testdata/d2compiler/TestCompile/grid_edge.exp.json @@ -1,7 +1,6 @@ { "graph": null, "err": { - "ioerr": null, "errs": [ { "range": "d2/testdata/d2compiler/TestCompile/grid_edge.d2,2:1:22-2:7:28", diff --git a/testdata/d2compiler/TestCompile/grid_gap_negative.exp.json b/testdata/d2compiler/TestCompile/grid_gap_negative.exp.json index 70f2a05d4..fdccd8642 100644 --- a/testdata/d2compiler/TestCompile/grid_gap_negative.exp.json +++ b/testdata/d2compiler/TestCompile/grid_gap_negative.exp.json @@ -1,7 +1,6 @@ { "graph": null, "err": { - "ioerr": null, "errs": [ { "range": "d2/testdata/d2compiler/TestCompile/grid_gap_negative.d2,1:17:24-1:21:28", diff --git a/testdata/d2compiler/TestCompile/grid_negative.exp.json b/testdata/d2compiler/TestCompile/grid_negative.exp.json index 7999bc2b6..dcc2302a6 100644 --- a/testdata/d2compiler/TestCompile/grid_negative.exp.json +++ b/testdata/d2compiler/TestCompile/grid_negative.exp.json @@ -1,7 +1,6 @@ { "graph": null, "err": { - "ioerr": null, "errs": [ { "range": "d2/testdata/d2compiler/TestCompile/grid_negative.d2,2:15:38-2:19:42", diff --git a/testdata/d2compiler/TestCompile/illegal-stroke-width.exp.json b/testdata/d2compiler/TestCompile/illegal-stroke-width.exp.json index 4bdd9802f..89001ac94 100644 --- a/testdata/d2compiler/TestCompile/illegal-stroke-width.exp.json +++ b/testdata/d2compiler/TestCompile/illegal-stroke-width.exp.json @@ -1,7 +1,6 @@ { "graph": null, "err": { - "ioerr": null, "errs": [ { "range": "d2/testdata/d2compiler/TestCompile/illegal-stroke-width.d2,1:22:28-1:24:30", diff --git a/testdata/d2compiler/TestCompile/image_children_Steps.exp.json b/testdata/d2compiler/TestCompile/image_children_Steps.exp.json index 7958d0e1b..b9b6f483f 100644 --- a/testdata/d2compiler/TestCompile/image_children_Steps.exp.json +++ b/testdata/d2compiler/TestCompile/image_children_Steps.exp.json @@ -1,7 +1,6 @@ { "graph": null, "err": { - "ioerr": null, "errs": [ { "range": "d2/testdata/d2compiler/TestCompile/image_children_Steps.d2,3:2:115-3:7:120", diff --git a/testdata/d2compiler/TestCompile/image_non_style.exp.json b/testdata/d2compiler/TestCompile/image_non_style.exp.json index 29ce4ba85..d111a25d3 100644 --- a/testdata/d2compiler/TestCompile/image_non_style.exp.json +++ b/testdata/d2compiler/TestCompile/image_non_style.exp.json @@ -1,7 +1,6 @@ { "graph": null, "err": { - "ioerr": null, "errs": [ { "range": "d2/testdata/d2compiler/TestCompile/image_non_style.d2,3:2:115-3:6:119", diff --git a/testdata/d2compiler/TestCompile/improper-class-ref.exp.json b/testdata/d2compiler/TestCompile/improper-class-ref.exp.json index 02fd3f333..faa6daf73 100644 --- a/testdata/d2compiler/TestCompile/improper-class-ref.exp.json +++ b/testdata/d2compiler/TestCompile/improper-class-ref.exp.json @@ -1,7 +1,6 @@ { "graph": null, "err": { - "ioerr": null, "errs": [ { "range": "d2/testdata/d2compiler/TestCompile/improper-class-ref.d2,0:6:6-0:11:11", diff --git a/testdata/d2compiler/TestCompile/invalid-fill-pattern.exp.json b/testdata/d2compiler/TestCompile/invalid-fill-pattern.exp.json index 8c1a03f92..3d31630e8 100644 --- a/testdata/d2compiler/TestCompile/invalid-fill-pattern.exp.json +++ b/testdata/d2compiler/TestCompile/invalid-fill-pattern.exp.json @@ -1,7 +1,6 @@ { "graph": null, "err": { - "ioerr": null, "errs": [ { "range": "d2/testdata/d2compiler/TestCompile/invalid-fill-pattern.d2,2:18:33-2:23:38", diff --git a/testdata/d2compiler/TestCompile/invalid_direction.exp.json b/testdata/d2compiler/TestCompile/invalid_direction.exp.json index d140cb2bf..f6d5ce213 100644 --- a/testdata/d2compiler/TestCompile/invalid_direction.exp.json +++ b/testdata/d2compiler/TestCompile/invalid_direction.exp.json @@ -1,7 +1,6 @@ { "graph": null, "err": { - "ioerr": null, "errs": [ { "range": "d2/testdata/d2compiler/TestCompile/invalid_direction.d2,1:13:18-1:21:26", diff --git a/testdata/d2compiler/TestCompile/leaky_sequence.exp.json b/testdata/d2compiler/TestCompile/leaky_sequence.exp.json index e0a147f90..0df098fef 100644 --- a/testdata/d2compiler/TestCompile/leaky_sequence.exp.json +++ b/testdata/d2compiler/TestCompile/leaky_sequence.exp.json @@ -1,7 +1,6 @@ { "graph": null, "err": { - "ioerr": null, "errs": [ { "range": "d2/testdata/d2compiler/TestCompile/leaky_sequence.d2,4:0:37-4:8:45", diff --git a/testdata/d2compiler/TestCompile/link-board-not-board.exp.json b/testdata/d2compiler/TestCompile/link-board-not-board.exp.json index d8f1db764..0cac84653 100644 --- a/testdata/d2compiler/TestCompile/link-board-not-board.exp.json +++ b/testdata/d2compiler/TestCompile/link-board-not-board.exp.json @@ -1,7 +1,6 @@ { "graph": null, "err": { - "ioerr": null, "errs": [ { "range": "d2/testdata/d2compiler/TestCompile/link-board-not-board.d2,1:0:4-1:18:22", diff --git a/testdata/d2compiler/TestCompile/link-board-not-found.exp.json b/testdata/d2compiler/TestCompile/link-board-not-found.exp.json index 29ff2fdde..f448bcd36 100644 --- a/testdata/d2compiler/TestCompile/link-board-not-found.exp.json +++ b/testdata/d2compiler/TestCompile/link-board-not-found.exp.json @@ -1,7 +1,6 @@ { "graph": null, "err": { - "ioerr": null, "errs": [ { "range": "d2/testdata/d2compiler/TestCompile/link-board-not-found.d2,0:0:0-0:16:16", diff --git a/testdata/d2compiler/TestCompile/link-board-underscore-not-found.exp.json b/testdata/d2compiler/TestCompile/link-board-underscore-not-found.exp.json index c5d2aaac6..378536db9 100644 --- a/testdata/d2compiler/TestCompile/link-board-underscore-not-found.exp.json +++ b/testdata/d2compiler/TestCompile/link-board-underscore-not-found.exp.json @@ -1,7 +1,6 @@ { "graph": null, "err": { - "ioerr": null, "errs": [ { "range": "d2/testdata/d2compiler/TestCompile/link-board-underscore-not-found.d2,6:8:59-6:18:69", diff --git a/testdata/d2compiler/TestCompile/md_block_string_err.exp.json b/testdata/d2compiler/TestCompile/md_block_string_err.exp.json index d5f3db2b7..499d56caf 100644 --- a/testdata/d2compiler/TestCompile/md_block_string_err.exp.json +++ b/testdata/d2compiler/TestCompile/md_block_string_err.exp.json @@ -1,7 +1,6 @@ { "graph": null, "err": { - "ioerr": null, "errs": [ { "range": "d2/testdata/d2compiler/TestCompile/md_block_string_err.d2,3:18:50-3:24:56", diff --git a/testdata/d2compiler/TestCompile/near-invalid.exp.json b/testdata/d2compiler/TestCompile/near-invalid.exp.json index f04575527..a65591ba6 100644 --- a/testdata/d2compiler/TestCompile/near-invalid.exp.json +++ b/testdata/d2compiler/TestCompile/near-invalid.exp.json @@ -1,7 +1,6 @@ { "graph": null, "err": { - "ioerr": null, "errs": [ { "range": "d2/testdata/d2compiler/TestCompile/near-invalid.d2,8:10:133-8:17:140", diff --git a/testdata/d2compiler/TestCompile/near_bad_connected.exp.json b/testdata/d2compiler/TestCompile/near_bad_connected.exp.json index b5ac2eb4a..e84042317 100644 --- a/testdata/d2compiler/TestCompile/near_bad_connected.exp.json +++ b/testdata/d2compiler/TestCompile/near_bad_connected.exp.json @@ -1,7 +1,6 @@ { "graph": null, "err": { - "ioerr": null, "errs": [ { "range": "d2/testdata/d2compiler/TestCompile/near_bad_connected.d2,4:4:42-4:10:48", diff --git a/testdata/d2compiler/TestCompile/near_bad_constant.exp.json b/testdata/d2compiler/TestCompile/near_bad_constant.exp.json index 8f045ca18..dce81d8ac 100644 --- a/testdata/d2compiler/TestCompile/near_bad_constant.exp.json +++ b/testdata/d2compiler/TestCompile/near_bad_constant.exp.json @@ -1,7 +1,6 @@ { "graph": null, "err": { - "ioerr": null, "errs": [ { "range": "d2/testdata/d2compiler/TestCompile/near_bad_constant.d2,0:8:8-0:19:19", diff --git a/testdata/d2compiler/TestCompile/near_descendant_connect_to_outside.exp.json b/testdata/d2compiler/TestCompile/near_descendant_connect_to_outside.exp.json index ca04fbf51..4aeaa944a 100644 --- a/testdata/d2compiler/TestCompile/near_descendant_connect_to_outside.exp.json +++ b/testdata/d2compiler/TestCompile/near_descendant_connect_to_outside.exp.json @@ -1,7 +1,6 @@ { "graph": null, "err": { - "ioerr": null, "errs": [ { "range": "d2/testdata/d2compiler/TestCompile/near_descendant_connect_to_outside.d2,5:4:47-5:12:55", diff --git a/testdata/d2compiler/TestCompile/near_near_const.exp.json b/testdata/d2compiler/TestCompile/near_near_const.exp.json index 7b5fe99af..cb7ca846c 100644 --- a/testdata/d2compiler/TestCompile/near_near_const.exp.json +++ b/testdata/d2compiler/TestCompile/near_near_const.exp.json @@ -1,7 +1,6 @@ { "graph": null, "err": { - "ioerr": null, "errs": [ { "range": "d2/testdata/d2compiler/TestCompile/near_near_const.d2,6:7:50-6:12:55", diff --git a/testdata/d2compiler/TestCompile/near_sequence.exp.json b/testdata/d2compiler/TestCompile/near_sequence.exp.json index dc86eb89c..20532dafe 100644 --- a/testdata/d2compiler/TestCompile/near_sequence.exp.json +++ b/testdata/d2compiler/TestCompile/near_sequence.exp.json @@ -1,7 +1,6 @@ { "graph": null, "err": { - "ioerr": null, "errs": [ { "range": "d2/testdata/d2compiler/TestCompile/near_sequence.d2,4:8:45-4:11:48", diff --git a/testdata/d2compiler/TestCompile/nested_edge.exp.json b/testdata/d2compiler/TestCompile/nested_edge.exp.json index 87eeebaf1..6f263f6d4 100644 --- a/testdata/d2compiler/TestCompile/nested_edge.exp.json +++ b/testdata/d2compiler/TestCompile/nested_edge.exp.json @@ -1,7 +1,6 @@ { "graph": null, "err": { - "ioerr": null, "errs": [ { "range": "d2/testdata/d2compiler/TestCompile/nested_edge.d2,1:2:23-1:16:37", diff --git a/testdata/d2compiler/TestCompile/nested_near_constant.exp.json b/testdata/d2compiler/TestCompile/nested_near_constant.exp.json index b088c5663..b11bb9e56 100644 --- a/testdata/d2compiler/TestCompile/nested_near_constant.exp.json +++ b/testdata/d2compiler/TestCompile/nested_near_constant.exp.json @@ -1,7 +1,6 @@ { "graph": null, "err": { - "ioerr": null, "errs": [ { "range": "d2/testdata/d2compiler/TestCompile/nested_near_constant.d2,0:10:10-0:20:20", diff --git a/testdata/d2compiler/TestCompile/no-class-inside-classes.exp.json b/testdata/d2compiler/TestCompile/no-class-inside-classes.exp.json index 99c67b8e6..d7e810d00 100644 --- a/testdata/d2compiler/TestCompile/no-class-inside-classes.exp.json +++ b/testdata/d2compiler/TestCompile/no-class-inside-classes.exp.json @@ -1,7 +1,6 @@ { "graph": null, "err": { - "ioerr": null, "errs": [ { "range": "d2/testdata/d2compiler/TestCompile/no-class-inside-classes.d2,2:4:22-2:9:27", diff --git a/testdata/d2compiler/TestCompile/no-class-primary.exp.json b/testdata/d2compiler/TestCompile/no-class-primary.exp.json index dafb78a69..f137a4b3e 100644 --- a/testdata/d2compiler/TestCompile/no-class-primary.exp.json +++ b/testdata/d2compiler/TestCompile/no-class-primary.exp.json @@ -1,7 +1,6 @@ { "graph": null, "err": { - "ioerr": null, "errs": [ { "range": "d2/testdata/d2compiler/TestCompile/no-class-primary.d2,0:2:2-0:7:7", diff --git a/testdata/d2compiler/TestCompile/no-nested-columns-class.exp.json b/testdata/d2compiler/TestCompile/no-nested-columns-class.exp.json index cc9546885..4fd0b95e2 100644 --- a/testdata/d2compiler/TestCompile/no-nested-columns-class.exp.json +++ b/testdata/d2compiler/TestCompile/no-nested-columns-class.exp.json @@ -1,7 +1,6 @@ { "graph": null, "err": { - "ioerr": null, "errs": [ { "range": "d2/testdata/d2compiler/TestCompile/no-nested-columns-class.d2,2:4:24-2:5:25", diff --git a/testdata/d2compiler/TestCompile/no-nested-columns-sql-2.exp.json b/testdata/d2compiler/TestCompile/no-nested-columns-sql-2.exp.json index 15bef32df..f09cc847a 100644 --- a/testdata/d2compiler/TestCompile/no-nested-columns-sql-2.exp.json +++ b/testdata/d2compiler/TestCompile/no-nested-columns-sql-2.exp.json @@ -1,7 +1,6 @@ { "graph": null, "err": { - "ioerr": null, "errs": [ { "range": "d2/testdata/d2compiler/TestCompile/no-nested-columns-sql-2.d2,4:4:34-4:5:35", diff --git a/testdata/d2compiler/TestCompile/no-nested-columns-sql.exp.json b/testdata/d2compiler/TestCompile/no-nested-columns-sql.exp.json index 782ccce94..c3b6f2e18 100644 --- a/testdata/d2compiler/TestCompile/no-nested-columns-sql.exp.json +++ b/testdata/d2compiler/TestCompile/no-nested-columns-sql.exp.json @@ -1,7 +1,6 @@ { "graph": null, "err": { - "ioerr": null, "errs": [ { "range": "d2/testdata/d2compiler/TestCompile/no-nested-columns-sql.d2,2:9:33-2:10:34", diff --git a/testdata/d2compiler/TestCompile/no_url_link_and_url_tooltip_concurrently.exp.json b/testdata/d2compiler/TestCompile/no_url_link_and_url_tooltip_concurrently.exp.json index 289bd8ec8..97b8088bb 100644 --- a/testdata/d2compiler/TestCompile/no_url_link_and_url_tooltip_concurrently.exp.json +++ b/testdata/d2compiler/TestCompile/no_url_link_and_url_tooltip_concurrently.exp.json @@ -1,7 +1,6 @@ { "graph": null, "err": { - "ioerr": null, "errs": [ { "range": "d2/testdata/d2compiler/TestCompile/no_url_link_and_url_tooltip_concurrently.d2,0:43:43-0:61:61", diff --git a/testdata/d2compiler/TestCompile/obj_invalid_style.exp.json b/testdata/d2compiler/TestCompile/obj_invalid_style.exp.json index 4f9d5590b..f91901c5e 100644 --- a/testdata/d2compiler/TestCompile/obj_invalid_style.exp.json +++ b/testdata/d2compiler/TestCompile/obj_invalid_style.exp.json @@ -1,7 +1,6 @@ { "graph": null, "err": { - "ioerr": null, "errs": [ { "range": "d2/testdata/d2compiler/TestCompile/obj_invalid_style.d2,1:2:7-1:9:14", diff --git a/testdata/d2compiler/TestCompile/object_arrowhead_shape.exp.json b/testdata/d2compiler/TestCompile/object_arrowhead_shape.exp.json index d1fef4a09..efd37e9f7 100644 --- a/testdata/d2compiler/TestCompile/object_arrowhead_shape.exp.json +++ b/testdata/d2compiler/TestCompile/object_arrowhead_shape.exp.json @@ -1,7 +1,6 @@ { "graph": null, "err": { - "ioerr": null, "errs": [ { "range": "d2/testdata/d2compiler/TestCompile/object_arrowhead_shape.d2,0:4:4-0:19:19", diff --git a/testdata/d2compiler/TestCompile/positions_negative.exp.json b/testdata/d2compiler/TestCompile/positions_negative.exp.json index 308bba5fe..a81756142 100644 --- a/testdata/d2compiler/TestCompile/positions_negative.exp.json +++ b/testdata/d2compiler/TestCompile/positions_negative.exp.json @@ -1,7 +1,6 @@ { "graph": null, "err": { - "ioerr": null, "errs": [ { "range": "d2/testdata/d2compiler/TestCompile/positions_negative.d2,2:7:24-2:11:28", diff --git a/testdata/d2compiler/TestCompile/shape_edge_style.exp.json b/testdata/d2compiler/TestCompile/shape_edge_style.exp.json index b475d3889..83e7f0642 100644 --- a/testdata/d2compiler/TestCompile/shape_edge_style.exp.json +++ b/testdata/d2compiler/TestCompile/shape_edge_style.exp.json @@ -1,7 +1,6 @@ { "graph": null, "err": { - "ioerr": null, "errs": [ { "range": "d2/testdata/d2compiler/TestCompile/shape_edge_style.d2,2:1:7-2:21:27", diff --git a/testdata/d2compiler/TestCompile/shape_unquoted_hex.exp.json b/testdata/d2compiler/TestCompile/shape_unquoted_hex.exp.json index 10960df9e..fe5b34bf5 100644 --- a/testdata/d2compiler/TestCompile/shape_unquoted_hex.exp.json +++ b/testdata/d2compiler/TestCompile/shape_unquoted_hex.exp.json @@ -1,7 +1,6 @@ { "graph": null, "err": { - "ioerr": null, "errs": [ { "range": "d2/testdata/d2compiler/TestCompile/shape_unquoted_hex.d2,2:9:24-2:10:25", diff --git a/testdata/d2compiler/TestCompile/sql-panic.exp.json b/testdata/d2compiler/TestCompile/sql-panic.exp.json index 251f47c7a..d45b7ba02 100644 --- a/testdata/d2compiler/TestCompile/sql-panic.exp.json +++ b/testdata/d2compiler/TestCompile/sql-panic.exp.json @@ -1,7 +1,6 @@ { "graph": null, "err": { - "ioerr": null, "errs": [ { "range": "d2/testdata/d2compiler/TestCompile/sql-panic.d2,2:26:54-2:64:92", diff --git a/testdata/d2compiler/TestCompile/tail-style-map.exp.json b/testdata/d2compiler/TestCompile/tail-style-map.exp.json index 96995af66..ded914368 100644 --- a/testdata/d2compiler/TestCompile/tail-style-map.exp.json +++ b/testdata/d2compiler/TestCompile/tail-style-map.exp.json @@ -1,7 +1,6 @@ { "graph": null, "err": { - "ioerr": null, "errs": [ { "range": "d2/testdata/d2compiler/TestCompile/tail-style-map.d2,0:6:6-0:11:11", diff --git a/testdata/d2compiler/TestCompile/tail-style.exp.json b/testdata/d2compiler/TestCompile/tail-style.exp.json index 3788c9e9f..e4991245e 100644 --- a/testdata/d2compiler/TestCompile/tail-style.exp.json +++ b/testdata/d2compiler/TestCompile/tail-style.exp.json @@ -1,7 +1,6 @@ { "graph": null, "err": { - "ioerr": null, "errs": [ { "range": "d2/testdata/d2compiler/TestCompile/tail-style.d2,0:6:6-0:11:11", diff --git a/testdata/d2compiler/TestCompile/underscore_parent_middle_path.exp.json b/testdata/d2compiler/TestCompile/underscore_parent_middle_path.exp.json index 31762bc1a..370b9f0c5 100644 --- a/testdata/d2compiler/TestCompile/underscore_parent_middle_path.exp.json +++ b/testdata/d2compiler/TestCompile/underscore_parent_middle_path.exp.json @@ -1,7 +1,6 @@ { "graph": null, "err": { - "ioerr": null, "errs": [ { "range": "d2/testdata/d2compiler/TestCompile/underscore_parent_middle_path.d2,2:4:10-2:5:11", diff --git a/testdata/d2compiler/TestCompile/underscore_parent_root.exp.json b/testdata/d2compiler/TestCompile/underscore_parent_root.exp.json index 204fefcb0..409e70f7f 100644 --- a/testdata/d2compiler/TestCompile/underscore_parent_root.exp.json +++ b/testdata/d2compiler/TestCompile/underscore_parent_root.exp.json @@ -1,7 +1,6 @@ { "graph": null, "err": { - "ioerr": null, "errs": [ { "range": "d2/testdata/d2compiler/TestCompile/underscore_parent_root.d2,1:0:1-1:1:2", diff --git a/testdata/d2compiler/TestCompile/underscore_parent_sandwich_path.exp.json b/testdata/d2compiler/TestCompile/underscore_parent_sandwich_path.exp.json index 923d3fd80..adb0687c9 100644 --- a/testdata/d2compiler/TestCompile/underscore_parent_sandwich_path.exp.json +++ b/testdata/d2compiler/TestCompile/underscore_parent_sandwich_path.exp.json @@ -1,7 +1,6 @@ { "graph": null, "err": { - "ioerr": null, "errs": [ { "range": "d2/testdata/d2compiler/TestCompile/underscore_parent_sandwich_path.d2,2:6:12-2:7:13", diff --git a/testdata/d2compiler/TestCompile/unsemantic_markdown.exp.json b/testdata/d2compiler/TestCompile/unsemantic_markdown.exp.json index b0dbf4465..3a4c3dcb4 100644 --- a/testdata/d2compiler/TestCompile/unsemantic_markdown.exp.json +++ b/testdata/d2compiler/TestCompile/unsemantic_markdown.exp.json @@ -1,7 +1,6 @@ { "graph": null, "err": { - "ioerr": null, "errs": [ { "range": "d2/testdata/d2compiler/TestCompile/unsemantic_markdown.d2,0:0:0-3:1:19", diff --git a/testdata/d2compiler/TestCompile/unsemantic_markdown_2.exp.json b/testdata/d2compiler/TestCompile/unsemantic_markdown_2.exp.json index adfb7f026..e8fa4b7ff 100644 --- a/testdata/d2compiler/TestCompile/unsemantic_markdown_2.exp.json +++ b/testdata/d2compiler/TestCompile/unsemantic_markdown_2.exp.json @@ -1,7 +1,6 @@ { "graph": null, "err": { - "ioerr": null, "errs": [ { "range": "d2/testdata/d2compiler/TestCompile/unsemantic_markdown_2.d2,0:0:0-3:1:20", diff --git a/testdata/d2compiler/TestCompile2/boards/errs/duplicate_board.exp.json b/testdata/d2compiler/TestCompile2/boards/errs/duplicate_board.exp.json index 663733cfe..2ee865e7d 100644 --- a/testdata/d2compiler/TestCompile2/boards/errs/duplicate_board.exp.json +++ b/testdata/d2compiler/TestCompile2/boards/errs/duplicate_board.exp.json @@ -1,7 +1,6 @@ { "graph": null, "err": { - "ioerr": null, "errs": [ { "range": "d2/testdata/d2compiler/TestCompile2/boards/errs/duplicate_board.d2,8:1:51-8:4:54", diff --git a/testdata/d2ir/TestCompile/imports/#00.exp.json b/testdata/d2ir/TestCompile/imports/#00.exp.json new file mode 100644 index 000000000..cc2a0a3e5 --- /dev/null +++ b/testdata/d2ir/TestCompile/imports/#00.exp.json @@ -0,0 +1,82 @@ +{ + "fields": [ + { + "name": "x", + "primary": { + "value": { + "range": "x.d2,0:3:3-0:7:7", + "value": [ + { + "string": "wowa", + "raw_string": "wowa" + } + ] + } + }, + "references": [ + { + "string": { + "range": "x.d2,0:0:0-0:1:1", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + }, + "key_path": { + "range": "x.d2,0:0:0-0:1:1", + "path": [ + { + "unquoted_string": { + "range": "x.d2,0:0:0-0:1:1", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "x.d2,0:0:0-0:7:7", + "key": { + "range": "x.d2,0:0:0-0:1:1", + "path": [ + { + "unquoted_string": { + "range": "x.d2,0:0:0-0:1:1", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "x.d2,0:3:3-0:7:7", + "value": [ + { + "string": "wowa", + "raw_string": "wowa" + } + ] + } + } + } + } + } + ] + } + ], + "edges": null +} diff --git a/testdata/d2ir/TestCompile/imports/nested.exp.json b/testdata/d2ir/TestCompile/imports/nested.exp.json new file mode 100644 index 000000000..d6a74f941 --- /dev/null +++ b/testdata/d2ir/TestCompile/imports/nested.exp.json @@ -0,0 +1,249 @@ +{ + "fields": [ + { + "name": "x", + "composite": { + "fields": [ + { + "name": "shape", + "primary": { + "value": { + "range": "x.d2,1:8:13-1:14:19", + "value": [ + { + "string": "circle", + "raw_string": "circle" + } + ] + } + }, + "references": [ + { + "string": { + "range": "x.d2,1:1:6-1:6:11", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + }, + "key_path": { + "range": "x.d2,1:1:6-1:6:11", + "path": [ + { + "unquoted_string": { + "range": "x.d2,1:1:6-1:6:11", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "x.d2,1:1:6-1:14:19", + "key": { + "range": "x.d2,1:1:6-1:6:11", + "path": [ + { + "unquoted_string": { + "range": "x.d2,1:1:6-1:6:11", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "x.d2,1:8:13-1:14:19", + "value": [ + { + "string": "circle", + "raw_string": "circle" + } + ] + } + } + } + } + } + ] + }, + { + "name": "label", + "primary": { + "value": { + "range": "x.d2,2:8:28-2:12:32", + "value": [ + { + "string": "meow", + "raw_string": "meow" + } + ] + } + }, + "references": [ + { + "string": { + "range": "x.d2,2:1:21-2:6:26", + "value": [ + { + "string": "label", + "raw_string": "label" + } + ] + }, + "key_path": { + "range": "x.d2,2:1:21-2:6:26", + "path": [ + { + "unquoted_string": { + "range": "x.d2,2:1:21-2:6:26", + "value": [ + { + "string": "label", + "raw_string": "label" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "x.d2,2:1:21-2:12:32", + "key": { + "range": "x.d2,2:1:21-2:6:26", + "path": [ + { + "unquoted_string": { + "range": "x.d2,2:1:21-2:6:26", + "value": [ + { + "string": "label", + "raw_string": "label" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "x.d2,2:8:28-2:12:32", + "value": [ + { + "string": "meow", + "raw_string": "meow" + } + ] + } + } + } + } + } + ] + } + ], + "edges": null + }, + "references": [ + { + "string": { + "range": "index.d2,0:0:0-0:1:1", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + }, + "key_path": { + "range": "index.d2,0:0:0-0:1:1", + "path": [ + { + "unquoted_string": { + "range": "index.d2,0:0:0-0:1:1", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "index.d2,0:0:0-0:7:7", + "key": { + "range": "index.d2,0:0:0-0:1:1", + "path": [ + { + "unquoted_string": { + "range": "index.d2,0:0:0-0:1:1", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "import": { + "range": "index.d2,0:3:3-0:7:7", + "spread": false, + "path": [ + { + "unquoted_string": { + "range": "index.d2,0:4:4-0:5:5", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + }, + { + "unquoted_string": { + "range": "index.d2,0:6:6-0:7:7", + "value": [ + { + "string": "y", + "raw_string": "y" + } + ] + } + } + ] + } + } + } + } + } + ] + } + ], + "edges": null +} diff --git a/testdata/d2ir/TestCompile/imports/spread.exp.json b/testdata/d2ir/TestCompile/imports/spread.exp.json new file mode 100644 index 000000000..cc2a0a3e5 --- /dev/null +++ b/testdata/d2ir/TestCompile/imports/spread.exp.json @@ -0,0 +1,82 @@ +{ + "fields": [ + { + "name": "x", + "primary": { + "value": { + "range": "x.d2,0:3:3-0:7:7", + "value": [ + { + "string": "wowa", + "raw_string": "wowa" + } + ] + } + }, + "references": [ + { + "string": { + "range": "x.d2,0:0:0-0:1:1", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + }, + "key_path": { + "range": "x.d2,0:0:0-0:1:1", + "path": [ + { + "unquoted_string": { + "range": "x.d2,0:0:0-0:1:1", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "x.d2,0:0:0-0:7:7", + "key": { + "range": "x.d2,0:0:0-0:1:1", + "path": [ + { + "unquoted_string": { + "range": "x.d2,0:0:0-0:1:1", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "x.d2,0:3:3-0:7:7", + "value": [ + { + "string": "wowa", + "raw_string": "wowa" + } + ] + } + } + } + } + } + ] + } + ], + "edges": null +} diff --git a/testdata/d2ir/TestCompile/imports/value.exp.json b/testdata/d2ir/TestCompile/imports/value.exp.json new file mode 100644 index 000000000..7fbd78c5c --- /dev/null +++ b/testdata/d2ir/TestCompile/imports/value.exp.json @@ -0,0 +1,238 @@ +{ + "fields": [ + { + "name": "x", + "composite": { + "fields": [ + { + "name": "shape", + "primary": { + "value": { + "range": "x.d2,0:7:7-0:13:13", + "value": [ + { + "string": "circle", + "raw_string": "circle" + } + ] + } + }, + "references": [ + { + "string": { + "range": "x.d2,0:0:0-0:5:5", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + }, + "key_path": { + "range": "x.d2,0:0:0-0:5:5", + "path": [ + { + "unquoted_string": { + "range": "x.d2,0:0:0-0:5:5", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "x.d2,0:0:0-0:13:13", + "key": { + "range": "x.d2,0:0:0-0:5:5", + "path": [ + { + "unquoted_string": { + "range": "x.d2,0:0:0-0:5:5", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "x.d2,0:7:7-0:13:13", + "value": [ + { + "string": "circle", + "raw_string": "circle" + } + ] + } + } + } + } + } + ] + }, + { + "name": "label", + "primary": { + "value": { + "range": "x.d2,1:7:21-1:11:25", + "value": [ + { + "string": "meow", + "raw_string": "meow" + } + ] + } + }, + "references": [ + { + "string": { + "range": "x.d2,1:0:14-1:5:19", + "value": [ + { + "string": "label", + "raw_string": "label" + } + ] + }, + "key_path": { + "range": "x.d2,1:0:14-1:5:19", + "path": [ + { + "unquoted_string": { + "range": "x.d2,1:0:14-1:5:19", + "value": [ + { + "string": "label", + "raw_string": "label" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "x.d2,1:0:14-1:11:25", + "key": { + "range": "x.d2,1:0:14-1:5:19", + "path": [ + { + "unquoted_string": { + "range": "x.d2,1:0:14-1:5:19", + "value": [ + { + "string": "label", + "raw_string": "label" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "x.d2,1:7:21-1:11:25", + "value": [ + { + "string": "meow", + "raw_string": "meow" + } + ] + } + } + } + } + } + ] + } + ], + "edges": null + }, + "references": [ + { + "string": { + "range": "index.d2,0:0:0-0:1:1", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + }, + "key_path": { + "range": "index.d2,0:0:0-0:1:1", + "path": [ + { + "unquoted_string": { + "range": "index.d2,0:0:0-0:1:1", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "index.d2,0:0:0-0:8:8", + "key": { + "range": "index.d2,0:0:0-0:1:1", + "path": [ + { + "unquoted_string": { + "range": "index.d2,0:0:0-0:1:1", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "import": { + "range": "index.d2,0:3:3-0:8:8", + "spread": false, + "path": [ + { + "unquoted_string": { + "range": "index.d2,0:4:4-0:5:5", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + } + } + } + } + } + ] + } + ], + "edges": null +}