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.
This commit is contained in:
parent
f61409cb79
commit
2fcc9ed140
70 changed files with 975 additions and 68 deletions
|
|
@ -1021,8 +1021,8 @@ type InterpolationBox struct {
|
||||||
// & is only special if it begins a key.
|
// & is only special if it begins a key.
|
||||||
// - is only special if followed by another - in a key.
|
// - is only special if followed by another - in a key.
|
||||||
// ' " and | are only special if they begin an unquoted key or value.
|
// ' " and | are only special if they begin an unquoted key or value.
|
||||||
var UnquotedKeySpecials = string([]rune{'#', ';', '\n', '\\', '{', '}', '[', ']', '\'', '"', '|', ':', '.', '-', '<', '>', '*', '&', '(', ')'})
|
var UnquotedKeySpecials = string([]rune{'#', ';', '\n', '\\', '{', '}', '[', ']', '\'', '"', '|', ':', '.', '-', '<', '>', '*', '&', '(', ')', '@'})
|
||||||
var UnquotedValueSpecials = string([]rune{'#', ';', '\n', '\\', '{', '}', '[', ']', '\'', '"', '|', '$'})
|
var UnquotedValueSpecials = string([]rune{'#', ';', '\n', '\\', '{', '}', '[', ']', '\'', '"', '|', '$', '@'})
|
||||||
|
|
||||||
// RawString returns s in a AST String node that can format s in the most aesthetically
|
// RawString returns s in a AST String node that can format s in the most aesthetically
|
||||||
// pleasing way.
|
// pleasing way.
|
||||||
|
|
@ -1071,8 +1071,26 @@ func RawString(s string, inKey bool) String {
|
||||||
return FlatUnquotedString(s)
|
return FlatUnquotedString(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func RawStringBox(s string, inKey bool) *StringBox {
|
||||||
|
return MakeValueBox(RawString(s, inKey)).StringBox()
|
||||||
|
}
|
||||||
|
|
||||||
func hasSurroundingWhitespace(s string) bool {
|
func hasSurroundingWhitespace(s string) bool {
|
||||||
r, _ := utf8.DecodeRuneInString(s)
|
r, _ := utf8.DecodeRuneInString(s)
|
||||||
r2, _ := utf8.DecodeLastRuneInString(s)
|
r2, _ := utf8.DecodeLastRuneInString(s)
|
||||||
return unicode.IsSpace(r) || unicode.IsSpace(r2)
|
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
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,9 @@ import (
|
||||||
"encoding/xml"
|
"encoding/xml"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
"io/fs"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
|
@ -21,12 +23,18 @@ import (
|
||||||
|
|
||||||
type CompileOptions struct {
|
type CompileOptions struct {
|
||||||
UTF16 bool
|
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) {
|
func Compile(path string, r io.RuneReader, opts *CompileOptions) (*d2graph.Graph, error) {
|
||||||
if opts == nil {
|
if opts == nil {
|
||||||
opts = &CompileOptions{}
|
opts = &CompileOptions{}
|
||||||
}
|
}
|
||||||
|
if opts.FS == nil {
|
||||||
|
opts.FS = os.DirFS("/")
|
||||||
|
}
|
||||||
|
|
||||||
ast, err := d2parser.Parse(path, r, &d2parser.ParseOptions{
|
ast, err := d2parser.Parse(path, r, &d2parser.ParseOptions{
|
||||||
UTF16: opts.UTF16,
|
UTF16: opts.UTF16,
|
||||||
|
|
@ -35,7 +43,10 @@ func Compile(path string, r io.RuneReader, opts *CompileOptions) (*d2graph.Graph
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
ir, err := d2ir.Compile(ast)
|
ir, err := d2ir.Compile(ast, &d2ir.CompileOptions{
|
||||||
|
UTF16: opts.UTF16,
|
||||||
|
FS: opts.FS,
|
||||||
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
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) {
|
func compileIR(ast *d2ast.Map, m *d2ir.Map) (*d2graph.Graph, error) {
|
||||||
c := &compiler{}
|
c := &compiler{
|
||||||
|
err: &d2parser.ParseError{},
|
||||||
|
}
|
||||||
|
|
||||||
g := d2graph.NewGraph()
|
g := d2graph.NewGraph()
|
||||||
g.AST = ast
|
g.AST = ast
|
||||||
|
|
@ -116,7 +129,7 @@ func (c *compiler) compileBoardsField(g *d2graph.Graph, ir *d2ir.Map, fieldName
|
||||||
}
|
}
|
||||||
|
|
||||||
type compiler struct {
|
type compiler struct {
|
||||||
err d2parser.ParseError
|
err *d2parser.ParseError
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *compiler) errorf(n d2ast.Node, f string, v ...interface{}) {
|
func (c *compiler) errorf(n d2ast.Node, f string, v ...interface{}) {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package d2ir
|
package d2ir
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"io/fs"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"oss.terrastruct.com/d2/d2ast"
|
"oss.terrastruct.com/d2/d2ast"
|
||||||
|
|
@ -9,18 +10,46 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type compiler struct {
|
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{}) {
|
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))
|
c.err.Errors = append(c.err.Errors, d2parser.Errorf(n, f, v...).(d2ast.Error))
|
||||||
}
|
}
|
||||||
|
|
||||||
func Compile(ast *d2ast.Map) (*Map, error) {
|
func Compile(ast *d2ast.Map, opts *CompileOptions) (*Map, error) {
|
||||||
c := &compiler{}
|
if opts == nil {
|
||||||
|
opts = &CompileOptions{}
|
||||||
|
}
|
||||||
|
c := &compiler{
|
||||||
|
err: &d2parser.ParseError{},
|
||||||
|
fs: opts.FS,
|
||||||
|
|
||||||
|
importCache: make(map[string]*Map),
|
||||||
|
utf16: opts.UTF16,
|
||||||
|
}
|
||||||
m := &Map{}
|
m := &Map{}
|
||||||
m.initRoot()
|
m.initRoot()
|
||||||
m.parent.(*Field).References[0].Context.Scope = ast
|
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.compileMap(m, ast)
|
||||||
c.compileClasses(m)
|
c.compileClasses(m)
|
||||||
if !c.err.Empty() {
|
if !c.err.Empty() {
|
||||||
|
|
@ -85,6 +114,16 @@ func (c *compiler) compileMap(dst *Map, ast *d2ast.Map) {
|
||||||
Scope: ast,
|
Scope: ast,
|
||||||
ScopeMap: dst,
|
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:
|
case n.Substitution != nil:
|
||||||
panic("TODO")
|
panic("TODO")
|
||||||
}
|
}
|
||||||
|
|
@ -145,6 +184,22 @@ func (c *compiler) compileField(dst *Map, kp *d2ast.KeyPath, refctx *RefContext)
|
||||||
case BoardScenario, BoardStep:
|
case BoardScenario, BoardStep:
|
||||||
c.compileClasses(f.Map())
|
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 {
|
} else if refctx.Key.Value.ScalarBox().Unbox() != nil {
|
||||||
// If the link is a board, we need to transform it into an absolute path.
|
// If the link is a board, we need to transform it into an absolute path.
|
||||||
if f.Name == "link" {
|
if f.Name == "link" {
|
||||||
|
|
@ -330,6 +385,34 @@ func (c *compiler) compileArray(dst *Array, a *d2ast.Array) {
|
||||||
parent: dst,
|
parent: dst,
|
||||||
Value: v,
|
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:
|
case *d2ast.Substitution:
|
||||||
// panic("TODO")
|
// panic("TODO")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ import (
|
||||||
|
|
||||||
"oss.terrastruct.com/util-go/assert"
|
"oss.terrastruct.com/util-go/assert"
|
||||||
"oss.terrastruct.com/util-go/diff"
|
"oss.terrastruct.com/util-go/diff"
|
||||||
|
"oss.terrastruct.com/util-go/mapfs"
|
||||||
|
|
||||||
"oss.terrastruct.com/d2/d2ast"
|
"oss.terrastruct.com/d2/d2ast"
|
||||||
"oss.terrastruct.com/d2/d2ir"
|
"oss.terrastruct.com/d2/d2ir"
|
||||||
|
|
@ -24,6 +25,7 @@ func TestCompile(t *testing.T) {
|
||||||
t.Run("layers", testCompileLayers)
|
t.Run("layers", testCompileLayers)
|
||||||
t.Run("scenarios", testCompileScenarios)
|
t.Run("scenarios", testCompileScenarios)
|
||||||
t.Run("steps", testCompileSteps)
|
t.Run("steps", testCompileSteps)
|
||||||
|
t.Run("imports", testCompileImports)
|
||||||
}
|
}
|
||||||
|
|
||||||
type testCase struct {
|
type testCase struct {
|
||||||
|
|
@ -45,10 +47,20 @@ func compile(t testing.TB, text string) (*d2ir.Map, error) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
|
|
||||||
d2Path := fmt.Sprintf("%v.d2", t.Name())
|
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)
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
98
d2ir/import.go
Normal file
98
d2ir/import.go
Normal file
|
|
@ -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
|
||||||
|
}
|
||||||
81
d2ir/import_test.go
Normal file
81
d2ir/import_test.go
Normal file
|
|
@ -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)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
@ -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 {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,7 @@ func Parse(path string, r io.RuneReader, opts *ParseOptions) (*d2ast.Map, error)
|
||||||
func ParseKey(key string) (*d2ast.KeyPath, error) {
|
func ParseKey(key string) (*d2ast.KeyPath, error) {
|
||||||
p := &parser{
|
p := &parser{
|
||||||
reader: strings.NewReader(key),
|
reader: strings.NewReader(key),
|
||||||
|
err: &ParseError{},
|
||||||
}
|
}
|
||||||
|
|
||||||
k := p.parseKey()
|
k := p.parseKey()
|
||||||
|
|
@ -74,6 +75,7 @@ func ParseKey(key string) (*d2ast.KeyPath, error) {
|
||||||
func ParseMapKey(mapKey string) (*d2ast.Key, error) {
|
func ParseMapKey(mapKey string) (*d2ast.Key, error) {
|
||||||
p := &parser{
|
p := &parser{
|
||||||
reader: strings.NewReader(mapKey),
|
reader: strings.NewReader(mapKey),
|
||||||
|
err: &ParseError{},
|
||||||
}
|
}
|
||||||
|
|
||||||
mk := p.parseMapKey()
|
mk := p.parseMapKey()
|
||||||
|
|
@ -89,6 +91,7 @@ func ParseMapKey(mapKey string) (*d2ast.Key, error) {
|
||||||
func ParseValue(value string) (d2ast.Value, error) {
|
func ParseValue(value string) (d2ast.Value, error) {
|
||||||
p := &parser{
|
p := &parser{
|
||||||
reader: strings.NewReader(value),
|
reader: strings.NewReader(value),
|
||||||
|
err: &ParseError{},
|
||||||
}
|
}
|
||||||
|
|
||||||
v := p.parseValue()
|
v := p.parseValue()
|
||||||
|
|
|
||||||
2
go.mod
generated
2
go.mod
generated
|
|
@ -27,7 +27,7 @@ require (
|
||||||
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2
|
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2
|
||||||
gonum.org/v1/plot v0.12.0
|
gonum.org/v1/plot v0.12.0
|
||||||
nhooyr.io/websocket v1.8.7
|
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 (
|
require (
|
||||||
|
|
|
||||||
4
go.sum
generated
4
go.sum
generated
|
|
@ -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=
|
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 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-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=
|
rsc.io/pdf v0.1.1 h1:k1MczvYDUvJBe93bYd7wrZLLUEcLZAuF824/I4e5Xr4=
|
||||||
|
|
|
||||||
1
testdata/d2compiler/TestCompile/3d_oval.exp.json
generated
vendored
1
testdata/d2compiler/TestCompile/3d_oval.exp.json
generated
vendored
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
"graph": null,
|
"graph": null,
|
||||||
"err": {
|
"err": {
|
||||||
"ioerr": null,
|
|
||||||
"errs": [
|
"errs": [
|
||||||
{
|
{
|
||||||
"range": "d2/testdata/d2compiler/TestCompile/3d_oval.d2,1:0:17-1:19:36",
|
"range": "d2/testdata/d2compiler/TestCompile/3d_oval.d2,1:0:17-1:19:36",
|
||||||
|
|
|
||||||
1
testdata/d2compiler/TestCompile/bad-style-nesting.exp.json
generated
vendored
1
testdata/d2compiler/TestCompile/bad-style-nesting.exp.json
generated
vendored
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
"graph": null,
|
"graph": null,
|
||||||
"err": {
|
"err": {
|
||||||
"ioerr": null,
|
|
||||||
"errs": [
|
"errs": [
|
||||||
{
|
{
|
||||||
"range": "d2/testdata/d2compiler/TestCompile/bad-style-nesting.d2,0:12:12-0:17:17",
|
"range": "d2/testdata/d2compiler/TestCompile/bad-style-nesting.d2,0:12:12-0:17:17",
|
||||||
|
|
|
||||||
1
testdata/d2compiler/TestCompile/blank_underscore.exp.json
generated
vendored
1
testdata/d2compiler/TestCompile/blank_underscore.exp.json
generated
vendored
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
"graph": null,
|
"graph": null,
|
||||||
"err": {
|
"err": {
|
||||||
"ioerr": null,
|
|
||||||
"errs": [
|
"errs": [
|
||||||
{
|
{
|
||||||
"range": "d2/testdata/d2compiler/TestCompile/blank_underscore.d2,2:2:11-2:3:12",
|
"range": "d2/testdata/d2compiler/TestCompile/blank_underscore.d2,2:2:11-2:3:12",
|
||||||
|
|
|
||||||
1
testdata/d2compiler/TestCompile/border-radius-negative.exp.json
generated
vendored
1
testdata/d2compiler/TestCompile/border-radius-negative.exp.json
generated
vendored
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
"graph": null,
|
"graph": null,
|
||||||
"err": {
|
"err": {
|
||||||
"ioerr": null,
|
|
||||||
"errs": [
|
"errs": [
|
||||||
{
|
{
|
||||||
"range": "d2/testdata/d2compiler/TestCompile/border-radius-negative.d2,2:23:30-2:25:32",
|
"range": "d2/testdata/d2compiler/TestCompile/border-radius-negative.d2,2:23:30-2:25:32",
|
||||||
|
|
|
||||||
1
testdata/d2compiler/TestCompile/classes-internal-edge.exp.json
generated
vendored
1
testdata/d2compiler/TestCompile/classes-internal-edge.exp.json
generated
vendored
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
"graph": null,
|
"graph": null,
|
||||||
"err": {
|
"err": {
|
||||||
"ioerr": null,
|
|
||||||
"errs": [
|
"errs": [
|
||||||
{
|
{
|
||||||
"range": "d2/testdata/d2compiler/TestCompile/classes-internal-edge.d2,7:2:72-7:16:86",
|
"range": "d2/testdata/d2compiler/TestCompile/classes-internal-edge.d2,7:2:72-7:16:86",
|
||||||
|
|
|
||||||
1
testdata/d2compiler/TestCompile/classes-unreserved.exp.json
generated
vendored
1
testdata/d2compiler/TestCompile/classes-unreserved.exp.json
generated
vendored
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
"graph": null,
|
"graph": null,
|
||||||
"err": {
|
"err": {
|
||||||
"ioerr": null,
|
|
||||||
"errs": [
|
"errs": [
|
||||||
{
|
{
|
||||||
"range": "d2/testdata/d2compiler/TestCompile/classes-unreserved.d2,2:4:26-2:8:30",
|
"range": "d2/testdata/d2compiler/TestCompile/classes-unreserved.d2,2:4:26-2:8:30",
|
||||||
|
|
|
||||||
1
testdata/d2compiler/TestCompile/edge_in_column.exp.json
generated
vendored
1
testdata/d2compiler/TestCompile/edge_in_column.exp.json
generated
vendored
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
"graph": null,
|
"graph": null,
|
||||||
"err": {
|
"err": {
|
||||||
"ioerr": null,
|
|
||||||
"errs": [
|
"errs": [
|
||||||
{
|
{
|
||||||
"range": "d2/testdata/d2compiler/TestCompile/edge_in_column.d2,2:6:30-2:7:31",
|
"range": "d2/testdata/d2compiler/TestCompile/edge_in_column.d2,2:6:30-2:7:31",
|
||||||
|
|
|
||||||
1
testdata/d2compiler/TestCompile/edge_invalid_style.exp.json
generated
vendored
1
testdata/d2compiler/TestCompile/edge_invalid_style.exp.json
generated
vendored
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
"graph": null,
|
"graph": null,
|
||||||
"err": {
|
"err": {
|
||||||
"ioerr": null,
|
|
||||||
"errs": [
|
"errs": [
|
||||||
{
|
{
|
||||||
"range": "d2/testdata/d2compiler/TestCompile/edge_invalid_style.d2,1:2:12-1:9:19",
|
"range": "d2/testdata/d2compiler/TestCompile/edge_invalid_style.d2,1:2:12-1:9:19",
|
||||||
|
|
|
||||||
1
testdata/d2compiler/TestCompile/edge_map_non_reserved.exp.json
generated
vendored
1
testdata/d2compiler/TestCompile/edge_map_non_reserved.exp.json
generated
vendored
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
"graph": null,
|
"graph": null,
|
||||||
"err": {
|
"err": {
|
||||||
"ioerr": null,
|
|
||||||
"errs": [
|
"errs": [
|
||||||
{
|
{
|
||||||
"range": "d2/testdata/d2compiler/TestCompile/edge_map_non_reserved.d2,2:2:13-2:3:14",
|
"range": "d2/testdata/d2compiler/TestCompile/edge_map_non_reserved.d2,2:2:13-2:3:14",
|
||||||
|
|
|
||||||
1
testdata/d2compiler/TestCompile/edge_to_style.exp.json
generated
vendored
1
testdata/d2compiler/TestCompile/edge_to_style.exp.json
generated
vendored
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
"graph": null,
|
"graph": null,
|
||||||
"err": {
|
"err": {
|
||||||
"ioerr": null,
|
|
||||||
"errs": [
|
"errs": [
|
||||||
{
|
{
|
||||||
"range": "d2/testdata/d2compiler/TestCompile/edge_to_style.d2,1:7:31-1:12:36",
|
"range": "d2/testdata/d2compiler/TestCompile/edge_to_style.d2,1:7:31-1:12:36",
|
||||||
|
|
|
||||||
1
testdata/d2compiler/TestCompile/edge_unquoted_hex.exp.json
generated
vendored
1
testdata/d2compiler/TestCompile/edge_unquoted_hex.exp.json
generated
vendored
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
"graph": null,
|
"graph": null,
|
||||||
"err": {
|
"err": {
|
||||||
"ioerr": null,
|
|
||||||
"errs": [
|
"errs": [
|
||||||
{
|
{
|
||||||
"range": "d2/testdata/d2compiler/TestCompile/edge_unquoted_hex.d2,2:9:29-2:10:30",
|
"range": "d2/testdata/d2compiler/TestCompile/edge_unquoted_hex.d2,2:9:29-2:10:30",
|
||||||
|
|
|
||||||
1
testdata/d2compiler/TestCompile/equal_dimensions_on_circle.exp.json
generated
vendored
1
testdata/d2compiler/TestCompile/equal_dimensions_on_circle.exp.json
generated
vendored
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
"graph": null,
|
"graph": null,
|
||||||
"err": {
|
"err": {
|
||||||
"ioerr": null,
|
|
||||||
"errs": [
|
"errs": [
|
||||||
{
|
{
|
||||||
"range": "d2/testdata/d2compiler/TestCompile/equal_dimensions_on_circle.d2,2:1:26-2:11:36",
|
"range": "d2/testdata/d2compiler/TestCompile/equal_dimensions_on_circle.d2,2:1:26-2:11:36",
|
||||||
|
|
|
||||||
1
testdata/d2compiler/TestCompile/errors/missing_shape_icon.exp.json
generated
vendored
1
testdata/d2compiler/TestCompile/errors/missing_shape_icon.exp.json
generated
vendored
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
"graph": null,
|
"graph": null,
|
||||||
"err": {
|
"err": {
|
||||||
"ioerr": null,
|
|
||||||
"errs": [
|
"errs": [
|
||||||
{
|
{
|
||||||
"range": "d2/testdata/d2compiler/TestCompile/errors/missing_shape_icon.d2,0:0:0-0:14:14",
|
"range": "d2/testdata/d2compiler/TestCompile/errors/missing_shape_icon.d2,0:0:0-0:14:14",
|
||||||
|
|
|
||||||
1
testdata/d2compiler/TestCompile/errors/reserved_icon_style.exp.json
generated
vendored
1
testdata/d2compiler/TestCompile/errors/reserved_icon_style.exp.json
generated
vendored
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
"graph": null,
|
"graph": null,
|
||||||
"err": {
|
"err": {
|
||||||
"ioerr": null,
|
|
||||||
"errs": [
|
"errs": [
|
||||||
{
|
{
|
||||||
"range": "d2/testdata/d2compiler/TestCompile/errors/reserved_icon_style.d2,2:8:23-2:27:42",
|
"range": "d2/testdata/d2compiler/TestCompile/errors/reserved_icon_style.d2,2:8:23-2:27:42",
|
||||||
|
|
|
||||||
1
testdata/d2compiler/TestCompile/grid_edge.exp.json
generated
vendored
1
testdata/d2compiler/TestCompile/grid_edge.exp.json
generated
vendored
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
"graph": null,
|
"graph": null,
|
||||||
"err": {
|
"err": {
|
||||||
"ioerr": null,
|
|
||||||
"errs": [
|
"errs": [
|
||||||
{
|
{
|
||||||
"range": "d2/testdata/d2compiler/TestCompile/grid_edge.d2,2:1:22-2:7:28",
|
"range": "d2/testdata/d2compiler/TestCompile/grid_edge.d2,2:1:22-2:7:28",
|
||||||
|
|
|
||||||
1
testdata/d2compiler/TestCompile/grid_gap_negative.exp.json
generated
vendored
1
testdata/d2compiler/TestCompile/grid_gap_negative.exp.json
generated
vendored
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
"graph": null,
|
"graph": null,
|
||||||
"err": {
|
"err": {
|
||||||
"ioerr": null,
|
|
||||||
"errs": [
|
"errs": [
|
||||||
{
|
{
|
||||||
"range": "d2/testdata/d2compiler/TestCompile/grid_gap_negative.d2,1:17:24-1:21:28",
|
"range": "d2/testdata/d2compiler/TestCompile/grid_gap_negative.d2,1:17:24-1:21:28",
|
||||||
|
|
|
||||||
1
testdata/d2compiler/TestCompile/grid_negative.exp.json
generated
vendored
1
testdata/d2compiler/TestCompile/grid_negative.exp.json
generated
vendored
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
"graph": null,
|
"graph": null,
|
||||||
"err": {
|
"err": {
|
||||||
"ioerr": null,
|
|
||||||
"errs": [
|
"errs": [
|
||||||
{
|
{
|
||||||
"range": "d2/testdata/d2compiler/TestCompile/grid_negative.d2,2:15:38-2:19:42",
|
"range": "d2/testdata/d2compiler/TestCompile/grid_negative.d2,2:15:38-2:19:42",
|
||||||
|
|
|
||||||
1
testdata/d2compiler/TestCompile/illegal-stroke-width.exp.json
generated
vendored
1
testdata/d2compiler/TestCompile/illegal-stroke-width.exp.json
generated
vendored
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
"graph": null,
|
"graph": null,
|
||||||
"err": {
|
"err": {
|
||||||
"ioerr": null,
|
|
||||||
"errs": [
|
"errs": [
|
||||||
{
|
{
|
||||||
"range": "d2/testdata/d2compiler/TestCompile/illegal-stroke-width.d2,1:22:28-1:24:30",
|
"range": "d2/testdata/d2compiler/TestCompile/illegal-stroke-width.d2,1:22:28-1:24:30",
|
||||||
|
|
|
||||||
1
testdata/d2compiler/TestCompile/image_children_Steps.exp.json
generated
vendored
1
testdata/d2compiler/TestCompile/image_children_Steps.exp.json
generated
vendored
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
"graph": null,
|
"graph": null,
|
||||||
"err": {
|
"err": {
|
||||||
"ioerr": null,
|
|
||||||
"errs": [
|
"errs": [
|
||||||
{
|
{
|
||||||
"range": "d2/testdata/d2compiler/TestCompile/image_children_Steps.d2,3:2:115-3:7:120",
|
"range": "d2/testdata/d2compiler/TestCompile/image_children_Steps.d2,3:2:115-3:7:120",
|
||||||
|
|
|
||||||
1
testdata/d2compiler/TestCompile/image_non_style.exp.json
generated
vendored
1
testdata/d2compiler/TestCompile/image_non_style.exp.json
generated
vendored
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
"graph": null,
|
"graph": null,
|
||||||
"err": {
|
"err": {
|
||||||
"ioerr": null,
|
|
||||||
"errs": [
|
"errs": [
|
||||||
{
|
{
|
||||||
"range": "d2/testdata/d2compiler/TestCompile/image_non_style.d2,3:2:115-3:6:119",
|
"range": "d2/testdata/d2compiler/TestCompile/image_non_style.d2,3:2:115-3:6:119",
|
||||||
|
|
|
||||||
1
testdata/d2compiler/TestCompile/improper-class-ref.exp.json
generated
vendored
1
testdata/d2compiler/TestCompile/improper-class-ref.exp.json
generated
vendored
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
"graph": null,
|
"graph": null,
|
||||||
"err": {
|
"err": {
|
||||||
"ioerr": null,
|
|
||||||
"errs": [
|
"errs": [
|
||||||
{
|
{
|
||||||
"range": "d2/testdata/d2compiler/TestCompile/improper-class-ref.d2,0:6:6-0:11:11",
|
"range": "d2/testdata/d2compiler/TestCompile/improper-class-ref.d2,0:6:6-0:11:11",
|
||||||
|
|
|
||||||
1
testdata/d2compiler/TestCompile/invalid-fill-pattern.exp.json
generated
vendored
1
testdata/d2compiler/TestCompile/invalid-fill-pattern.exp.json
generated
vendored
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
"graph": null,
|
"graph": null,
|
||||||
"err": {
|
"err": {
|
||||||
"ioerr": null,
|
|
||||||
"errs": [
|
"errs": [
|
||||||
{
|
{
|
||||||
"range": "d2/testdata/d2compiler/TestCompile/invalid-fill-pattern.d2,2:18:33-2:23:38",
|
"range": "d2/testdata/d2compiler/TestCompile/invalid-fill-pattern.d2,2:18:33-2:23:38",
|
||||||
|
|
|
||||||
1
testdata/d2compiler/TestCompile/invalid_direction.exp.json
generated
vendored
1
testdata/d2compiler/TestCompile/invalid_direction.exp.json
generated
vendored
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
"graph": null,
|
"graph": null,
|
||||||
"err": {
|
"err": {
|
||||||
"ioerr": null,
|
|
||||||
"errs": [
|
"errs": [
|
||||||
{
|
{
|
||||||
"range": "d2/testdata/d2compiler/TestCompile/invalid_direction.d2,1:13:18-1:21:26",
|
"range": "d2/testdata/d2compiler/TestCompile/invalid_direction.d2,1:13:18-1:21:26",
|
||||||
|
|
|
||||||
1
testdata/d2compiler/TestCompile/leaky_sequence.exp.json
generated
vendored
1
testdata/d2compiler/TestCompile/leaky_sequence.exp.json
generated
vendored
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
"graph": null,
|
"graph": null,
|
||||||
"err": {
|
"err": {
|
||||||
"ioerr": null,
|
|
||||||
"errs": [
|
"errs": [
|
||||||
{
|
{
|
||||||
"range": "d2/testdata/d2compiler/TestCompile/leaky_sequence.d2,4:0:37-4:8:45",
|
"range": "d2/testdata/d2compiler/TestCompile/leaky_sequence.d2,4:0:37-4:8:45",
|
||||||
|
|
|
||||||
1
testdata/d2compiler/TestCompile/link-board-not-board.exp.json
generated
vendored
1
testdata/d2compiler/TestCompile/link-board-not-board.exp.json
generated
vendored
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
"graph": null,
|
"graph": null,
|
||||||
"err": {
|
"err": {
|
||||||
"ioerr": null,
|
|
||||||
"errs": [
|
"errs": [
|
||||||
{
|
{
|
||||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-not-board.d2,1:0:4-1:18:22",
|
"range": "d2/testdata/d2compiler/TestCompile/link-board-not-board.d2,1:0:4-1:18:22",
|
||||||
|
|
|
||||||
1
testdata/d2compiler/TestCompile/link-board-not-found.exp.json
generated
vendored
1
testdata/d2compiler/TestCompile/link-board-not-found.exp.json
generated
vendored
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
"graph": null,
|
"graph": null,
|
||||||
"err": {
|
"err": {
|
||||||
"ioerr": null,
|
|
||||||
"errs": [
|
"errs": [
|
||||||
{
|
{
|
||||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-not-found.d2,0:0:0-0:16:16",
|
"range": "d2/testdata/d2compiler/TestCompile/link-board-not-found.d2,0:0:0-0:16:16",
|
||||||
|
|
|
||||||
1
testdata/d2compiler/TestCompile/link-board-underscore-not-found.exp.json
generated
vendored
1
testdata/d2compiler/TestCompile/link-board-underscore-not-found.exp.json
generated
vendored
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
"graph": null,
|
"graph": null,
|
||||||
"err": {
|
"err": {
|
||||||
"ioerr": null,
|
|
||||||
"errs": [
|
"errs": [
|
||||||
{
|
{
|
||||||
"range": "d2/testdata/d2compiler/TestCompile/link-board-underscore-not-found.d2,6:8:59-6:18:69",
|
"range": "d2/testdata/d2compiler/TestCompile/link-board-underscore-not-found.d2,6:8:59-6:18:69",
|
||||||
|
|
|
||||||
1
testdata/d2compiler/TestCompile/md_block_string_err.exp.json
generated
vendored
1
testdata/d2compiler/TestCompile/md_block_string_err.exp.json
generated
vendored
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
"graph": null,
|
"graph": null,
|
||||||
"err": {
|
"err": {
|
||||||
"ioerr": null,
|
|
||||||
"errs": [
|
"errs": [
|
||||||
{
|
{
|
||||||
"range": "d2/testdata/d2compiler/TestCompile/md_block_string_err.d2,3:18:50-3:24:56",
|
"range": "d2/testdata/d2compiler/TestCompile/md_block_string_err.d2,3:18:50-3:24:56",
|
||||||
|
|
|
||||||
1
testdata/d2compiler/TestCompile/near-invalid.exp.json
generated
vendored
1
testdata/d2compiler/TestCompile/near-invalid.exp.json
generated
vendored
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
"graph": null,
|
"graph": null,
|
||||||
"err": {
|
"err": {
|
||||||
"ioerr": null,
|
|
||||||
"errs": [
|
"errs": [
|
||||||
{
|
{
|
||||||
"range": "d2/testdata/d2compiler/TestCompile/near-invalid.d2,8:10:133-8:17:140",
|
"range": "d2/testdata/d2compiler/TestCompile/near-invalid.d2,8:10:133-8:17:140",
|
||||||
|
|
|
||||||
1
testdata/d2compiler/TestCompile/near_bad_connected.exp.json
generated
vendored
1
testdata/d2compiler/TestCompile/near_bad_connected.exp.json
generated
vendored
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
"graph": null,
|
"graph": null,
|
||||||
"err": {
|
"err": {
|
||||||
"ioerr": null,
|
|
||||||
"errs": [
|
"errs": [
|
||||||
{
|
{
|
||||||
"range": "d2/testdata/d2compiler/TestCompile/near_bad_connected.d2,4:4:42-4:10:48",
|
"range": "d2/testdata/d2compiler/TestCompile/near_bad_connected.d2,4:4:42-4:10:48",
|
||||||
|
|
|
||||||
1
testdata/d2compiler/TestCompile/near_bad_constant.exp.json
generated
vendored
1
testdata/d2compiler/TestCompile/near_bad_constant.exp.json
generated
vendored
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
"graph": null,
|
"graph": null,
|
||||||
"err": {
|
"err": {
|
||||||
"ioerr": null,
|
|
||||||
"errs": [
|
"errs": [
|
||||||
{
|
{
|
||||||
"range": "d2/testdata/d2compiler/TestCompile/near_bad_constant.d2,0:8:8-0:19:19",
|
"range": "d2/testdata/d2compiler/TestCompile/near_bad_constant.d2,0:8:8-0:19:19",
|
||||||
|
|
|
||||||
1
testdata/d2compiler/TestCompile/near_descendant_connect_to_outside.exp.json
generated
vendored
1
testdata/d2compiler/TestCompile/near_descendant_connect_to_outside.exp.json
generated
vendored
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
"graph": null,
|
"graph": null,
|
||||||
"err": {
|
"err": {
|
||||||
"ioerr": null,
|
|
||||||
"errs": [
|
"errs": [
|
||||||
{
|
{
|
||||||
"range": "d2/testdata/d2compiler/TestCompile/near_descendant_connect_to_outside.d2,5:4:47-5:12:55",
|
"range": "d2/testdata/d2compiler/TestCompile/near_descendant_connect_to_outside.d2,5:4:47-5:12:55",
|
||||||
|
|
|
||||||
1
testdata/d2compiler/TestCompile/near_near_const.exp.json
generated
vendored
1
testdata/d2compiler/TestCompile/near_near_const.exp.json
generated
vendored
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
"graph": null,
|
"graph": null,
|
||||||
"err": {
|
"err": {
|
||||||
"ioerr": null,
|
|
||||||
"errs": [
|
"errs": [
|
||||||
{
|
{
|
||||||
"range": "d2/testdata/d2compiler/TestCompile/near_near_const.d2,6:7:50-6:12:55",
|
"range": "d2/testdata/d2compiler/TestCompile/near_near_const.d2,6:7:50-6:12:55",
|
||||||
|
|
|
||||||
1
testdata/d2compiler/TestCompile/near_sequence.exp.json
generated
vendored
1
testdata/d2compiler/TestCompile/near_sequence.exp.json
generated
vendored
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
"graph": null,
|
"graph": null,
|
||||||
"err": {
|
"err": {
|
||||||
"ioerr": null,
|
|
||||||
"errs": [
|
"errs": [
|
||||||
{
|
{
|
||||||
"range": "d2/testdata/d2compiler/TestCompile/near_sequence.d2,4:8:45-4:11:48",
|
"range": "d2/testdata/d2compiler/TestCompile/near_sequence.d2,4:8:45-4:11:48",
|
||||||
|
|
|
||||||
1
testdata/d2compiler/TestCompile/nested_edge.exp.json
generated
vendored
1
testdata/d2compiler/TestCompile/nested_edge.exp.json
generated
vendored
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
"graph": null,
|
"graph": null,
|
||||||
"err": {
|
"err": {
|
||||||
"ioerr": null,
|
|
||||||
"errs": [
|
"errs": [
|
||||||
{
|
{
|
||||||
"range": "d2/testdata/d2compiler/TestCompile/nested_edge.d2,1:2:23-1:16:37",
|
"range": "d2/testdata/d2compiler/TestCompile/nested_edge.d2,1:2:23-1:16:37",
|
||||||
|
|
|
||||||
1
testdata/d2compiler/TestCompile/nested_near_constant.exp.json
generated
vendored
1
testdata/d2compiler/TestCompile/nested_near_constant.exp.json
generated
vendored
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
"graph": null,
|
"graph": null,
|
||||||
"err": {
|
"err": {
|
||||||
"ioerr": null,
|
|
||||||
"errs": [
|
"errs": [
|
||||||
{
|
{
|
||||||
"range": "d2/testdata/d2compiler/TestCompile/nested_near_constant.d2,0:10:10-0:20:20",
|
"range": "d2/testdata/d2compiler/TestCompile/nested_near_constant.d2,0:10:10-0:20:20",
|
||||||
|
|
|
||||||
1
testdata/d2compiler/TestCompile/no-class-inside-classes.exp.json
generated
vendored
1
testdata/d2compiler/TestCompile/no-class-inside-classes.exp.json
generated
vendored
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
"graph": null,
|
"graph": null,
|
||||||
"err": {
|
"err": {
|
||||||
"ioerr": null,
|
|
||||||
"errs": [
|
"errs": [
|
||||||
{
|
{
|
||||||
"range": "d2/testdata/d2compiler/TestCompile/no-class-inside-classes.d2,2:4:22-2:9:27",
|
"range": "d2/testdata/d2compiler/TestCompile/no-class-inside-classes.d2,2:4:22-2:9:27",
|
||||||
|
|
|
||||||
1
testdata/d2compiler/TestCompile/no-class-primary.exp.json
generated
vendored
1
testdata/d2compiler/TestCompile/no-class-primary.exp.json
generated
vendored
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
"graph": null,
|
"graph": null,
|
||||||
"err": {
|
"err": {
|
||||||
"ioerr": null,
|
|
||||||
"errs": [
|
"errs": [
|
||||||
{
|
{
|
||||||
"range": "d2/testdata/d2compiler/TestCompile/no-class-primary.d2,0:2:2-0:7:7",
|
"range": "d2/testdata/d2compiler/TestCompile/no-class-primary.d2,0:2:2-0:7:7",
|
||||||
|
|
|
||||||
1
testdata/d2compiler/TestCompile/no-nested-columns-class.exp.json
generated
vendored
1
testdata/d2compiler/TestCompile/no-nested-columns-class.exp.json
generated
vendored
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
"graph": null,
|
"graph": null,
|
||||||
"err": {
|
"err": {
|
||||||
"ioerr": null,
|
|
||||||
"errs": [
|
"errs": [
|
||||||
{
|
{
|
||||||
"range": "d2/testdata/d2compiler/TestCompile/no-nested-columns-class.d2,2:4:24-2:5:25",
|
"range": "d2/testdata/d2compiler/TestCompile/no-nested-columns-class.d2,2:4:24-2:5:25",
|
||||||
|
|
|
||||||
1
testdata/d2compiler/TestCompile/no-nested-columns-sql-2.exp.json
generated
vendored
1
testdata/d2compiler/TestCompile/no-nested-columns-sql-2.exp.json
generated
vendored
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
"graph": null,
|
"graph": null,
|
||||||
"err": {
|
"err": {
|
||||||
"ioerr": null,
|
|
||||||
"errs": [
|
"errs": [
|
||||||
{
|
{
|
||||||
"range": "d2/testdata/d2compiler/TestCompile/no-nested-columns-sql-2.d2,4:4:34-4:5:35",
|
"range": "d2/testdata/d2compiler/TestCompile/no-nested-columns-sql-2.d2,4:4:34-4:5:35",
|
||||||
|
|
|
||||||
1
testdata/d2compiler/TestCompile/no-nested-columns-sql.exp.json
generated
vendored
1
testdata/d2compiler/TestCompile/no-nested-columns-sql.exp.json
generated
vendored
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
"graph": null,
|
"graph": null,
|
||||||
"err": {
|
"err": {
|
||||||
"ioerr": null,
|
|
||||||
"errs": [
|
"errs": [
|
||||||
{
|
{
|
||||||
"range": "d2/testdata/d2compiler/TestCompile/no-nested-columns-sql.d2,2:9:33-2:10:34",
|
"range": "d2/testdata/d2compiler/TestCompile/no-nested-columns-sql.d2,2:9:33-2:10:34",
|
||||||
|
|
|
||||||
1
testdata/d2compiler/TestCompile/no_url_link_and_url_tooltip_concurrently.exp.json
generated
vendored
1
testdata/d2compiler/TestCompile/no_url_link_and_url_tooltip_concurrently.exp.json
generated
vendored
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
"graph": null,
|
"graph": null,
|
||||||
"err": {
|
"err": {
|
||||||
"ioerr": null,
|
|
||||||
"errs": [
|
"errs": [
|
||||||
{
|
{
|
||||||
"range": "d2/testdata/d2compiler/TestCompile/no_url_link_and_url_tooltip_concurrently.d2,0:43:43-0:61:61",
|
"range": "d2/testdata/d2compiler/TestCompile/no_url_link_and_url_tooltip_concurrently.d2,0:43:43-0:61:61",
|
||||||
|
|
|
||||||
1
testdata/d2compiler/TestCompile/obj_invalid_style.exp.json
generated
vendored
1
testdata/d2compiler/TestCompile/obj_invalid_style.exp.json
generated
vendored
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
"graph": null,
|
"graph": null,
|
||||||
"err": {
|
"err": {
|
||||||
"ioerr": null,
|
|
||||||
"errs": [
|
"errs": [
|
||||||
{
|
{
|
||||||
"range": "d2/testdata/d2compiler/TestCompile/obj_invalid_style.d2,1:2:7-1:9:14",
|
"range": "d2/testdata/d2compiler/TestCompile/obj_invalid_style.d2,1:2:7-1:9:14",
|
||||||
|
|
|
||||||
1
testdata/d2compiler/TestCompile/object_arrowhead_shape.exp.json
generated
vendored
1
testdata/d2compiler/TestCompile/object_arrowhead_shape.exp.json
generated
vendored
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
"graph": null,
|
"graph": null,
|
||||||
"err": {
|
"err": {
|
||||||
"ioerr": null,
|
|
||||||
"errs": [
|
"errs": [
|
||||||
{
|
{
|
||||||
"range": "d2/testdata/d2compiler/TestCompile/object_arrowhead_shape.d2,0:4:4-0:19:19",
|
"range": "d2/testdata/d2compiler/TestCompile/object_arrowhead_shape.d2,0:4:4-0:19:19",
|
||||||
|
|
|
||||||
1
testdata/d2compiler/TestCompile/positions_negative.exp.json
generated
vendored
1
testdata/d2compiler/TestCompile/positions_negative.exp.json
generated
vendored
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
"graph": null,
|
"graph": null,
|
||||||
"err": {
|
"err": {
|
||||||
"ioerr": null,
|
|
||||||
"errs": [
|
"errs": [
|
||||||
{
|
{
|
||||||
"range": "d2/testdata/d2compiler/TestCompile/positions_negative.d2,2:7:24-2:11:28",
|
"range": "d2/testdata/d2compiler/TestCompile/positions_negative.d2,2:7:24-2:11:28",
|
||||||
|
|
|
||||||
1
testdata/d2compiler/TestCompile/shape_edge_style.exp.json
generated
vendored
1
testdata/d2compiler/TestCompile/shape_edge_style.exp.json
generated
vendored
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
"graph": null,
|
"graph": null,
|
||||||
"err": {
|
"err": {
|
||||||
"ioerr": null,
|
|
||||||
"errs": [
|
"errs": [
|
||||||
{
|
{
|
||||||
"range": "d2/testdata/d2compiler/TestCompile/shape_edge_style.d2,2:1:7-2:21:27",
|
"range": "d2/testdata/d2compiler/TestCompile/shape_edge_style.d2,2:1:7-2:21:27",
|
||||||
|
|
|
||||||
1
testdata/d2compiler/TestCompile/shape_unquoted_hex.exp.json
generated
vendored
1
testdata/d2compiler/TestCompile/shape_unquoted_hex.exp.json
generated
vendored
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
"graph": null,
|
"graph": null,
|
||||||
"err": {
|
"err": {
|
||||||
"ioerr": null,
|
|
||||||
"errs": [
|
"errs": [
|
||||||
{
|
{
|
||||||
"range": "d2/testdata/d2compiler/TestCompile/shape_unquoted_hex.d2,2:9:24-2:10:25",
|
"range": "d2/testdata/d2compiler/TestCompile/shape_unquoted_hex.d2,2:9:24-2:10:25",
|
||||||
|
|
|
||||||
1
testdata/d2compiler/TestCompile/sql-panic.exp.json
generated
vendored
1
testdata/d2compiler/TestCompile/sql-panic.exp.json
generated
vendored
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
"graph": null,
|
"graph": null,
|
||||||
"err": {
|
"err": {
|
||||||
"ioerr": null,
|
|
||||||
"errs": [
|
"errs": [
|
||||||
{
|
{
|
||||||
"range": "d2/testdata/d2compiler/TestCompile/sql-panic.d2,2:26:54-2:64:92",
|
"range": "d2/testdata/d2compiler/TestCompile/sql-panic.d2,2:26:54-2:64:92",
|
||||||
|
|
|
||||||
1
testdata/d2compiler/TestCompile/tail-style-map.exp.json
generated
vendored
1
testdata/d2compiler/TestCompile/tail-style-map.exp.json
generated
vendored
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
"graph": null,
|
"graph": null,
|
||||||
"err": {
|
"err": {
|
||||||
"ioerr": null,
|
|
||||||
"errs": [
|
"errs": [
|
||||||
{
|
{
|
||||||
"range": "d2/testdata/d2compiler/TestCompile/tail-style-map.d2,0:6:6-0:11:11",
|
"range": "d2/testdata/d2compiler/TestCompile/tail-style-map.d2,0:6:6-0:11:11",
|
||||||
|
|
|
||||||
1
testdata/d2compiler/TestCompile/tail-style.exp.json
generated
vendored
1
testdata/d2compiler/TestCompile/tail-style.exp.json
generated
vendored
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
"graph": null,
|
"graph": null,
|
||||||
"err": {
|
"err": {
|
||||||
"ioerr": null,
|
|
||||||
"errs": [
|
"errs": [
|
||||||
{
|
{
|
||||||
"range": "d2/testdata/d2compiler/TestCompile/tail-style.d2,0:6:6-0:11:11",
|
"range": "d2/testdata/d2compiler/TestCompile/tail-style.d2,0:6:6-0:11:11",
|
||||||
|
|
|
||||||
1
testdata/d2compiler/TestCompile/underscore_parent_middle_path.exp.json
generated
vendored
1
testdata/d2compiler/TestCompile/underscore_parent_middle_path.exp.json
generated
vendored
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
"graph": null,
|
"graph": null,
|
||||||
"err": {
|
"err": {
|
||||||
"ioerr": null,
|
|
||||||
"errs": [
|
"errs": [
|
||||||
{
|
{
|
||||||
"range": "d2/testdata/d2compiler/TestCompile/underscore_parent_middle_path.d2,2:4:10-2:5:11",
|
"range": "d2/testdata/d2compiler/TestCompile/underscore_parent_middle_path.d2,2:4:10-2:5:11",
|
||||||
|
|
|
||||||
1
testdata/d2compiler/TestCompile/underscore_parent_root.exp.json
generated
vendored
1
testdata/d2compiler/TestCompile/underscore_parent_root.exp.json
generated
vendored
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
"graph": null,
|
"graph": null,
|
||||||
"err": {
|
"err": {
|
||||||
"ioerr": null,
|
|
||||||
"errs": [
|
"errs": [
|
||||||
{
|
{
|
||||||
"range": "d2/testdata/d2compiler/TestCompile/underscore_parent_root.d2,1:0:1-1:1:2",
|
"range": "d2/testdata/d2compiler/TestCompile/underscore_parent_root.d2,1:0:1-1:1:2",
|
||||||
|
|
|
||||||
1
testdata/d2compiler/TestCompile/underscore_parent_sandwich_path.exp.json
generated
vendored
1
testdata/d2compiler/TestCompile/underscore_parent_sandwich_path.exp.json
generated
vendored
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
"graph": null,
|
"graph": null,
|
||||||
"err": {
|
"err": {
|
||||||
"ioerr": null,
|
|
||||||
"errs": [
|
"errs": [
|
||||||
{
|
{
|
||||||
"range": "d2/testdata/d2compiler/TestCompile/underscore_parent_sandwich_path.d2,2:6:12-2:7:13",
|
"range": "d2/testdata/d2compiler/TestCompile/underscore_parent_sandwich_path.d2,2:6:12-2:7:13",
|
||||||
|
|
|
||||||
1
testdata/d2compiler/TestCompile/unsemantic_markdown.exp.json
generated
vendored
1
testdata/d2compiler/TestCompile/unsemantic_markdown.exp.json
generated
vendored
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
"graph": null,
|
"graph": null,
|
||||||
"err": {
|
"err": {
|
||||||
"ioerr": null,
|
|
||||||
"errs": [
|
"errs": [
|
||||||
{
|
{
|
||||||
"range": "d2/testdata/d2compiler/TestCompile/unsemantic_markdown.d2,0:0:0-3:1:19",
|
"range": "d2/testdata/d2compiler/TestCompile/unsemantic_markdown.d2,0:0:0-3:1:19",
|
||||||
|
|
|
||||||
1
testdata/d2compiler/TestCompile/unsemantic_markdown_2.exp.json
generated
vendored
1
testdata/d2compiler/TestCompile/unsemantic_markdown_2.exp.json
generated
vendored
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
"graph": null,
|
"graph": null,
|
||||||
"err": {
|
"err": {
|
||||||
"ioerr": null,
|
|
||||||
"errs": [
|
"errs": [
|
||||||
{
|
{
|
||||||
"range": "d2/testdata/d2compiler/TestCompile/unsemantic_markdown_2.d2,0:0:0-3:1:20",
|
"range": "d2/testdata/d2compiler/TestCompile/unsemantic_markdown_2.d2,0:0:0-3:1:20",
|
||||||
|
|
|
||||||
1
testdata/d2compiler/TestCompile2/boards/errs/duplicate_board.exp.json
generated
vendored
1
testdata/d2compiler/TestCompile2/boards/errs/duplicate_board.exp.json
generated
vendored
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
"graph": null,
|
"graph": null,
|
||||||
"err": {
|
"err": {
|
||||||
"ioerr": null,
|
|
||||||
"errs": [
|
"errs": [
|
||||||
{
|
{
|
||||||
"range": "d2/testdata/d2compiler/TestCompile2/boards/errs/duplicate_board.d2,8:1:51-8:4:54",
|
"range": "d2/testdata/d2compiler/TestCompile2/boards/errs/duplicate_board.d2,8:1:51-8:4:54",
|
||||||
|
|
|
||||||
82
testdata/d2ir/TestCompile/imports/#00.exp.json
generated
vendored
Normal file
82
testdata/d2ir/TestCompile/imports/#00.exp.json
generated
vendored
Normal file
|
|
@ -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
|
||||||
|
}
|
||||||
249
testdata/d2ir/TestCompile/imports/nested.exp.json
generated
vendored
Normal file
249
testdata/d2ir/TestCompile/imports/nested.exp.json
generated
vendored
Normal file
|
|
@ -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
|
||||||
|
}
|
||||||
82
testdata/d2ir/TestCompile/imports/spread.exp.json
generated
vendored
Normal file
82
testdata/d2ir/TestCompile/imports/spread.exp.json
generated
vendored
Normal file
|
|
@ -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
|
||||||
|
}
|
||||||
238
testdata/d2ir/TestCompile/imports/value.exp.json
generated
vendored
Normal file
238
testdata/d2ir/TestCompile/imports/value.exp.json
generated
vendored
Normal file
|
|
@ -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
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue