diff --git a/ci/release/changelogs/next.md b/ci/release/changelogs/next.md index 4a15bc469..bd1d4c41c 100644 --- a/ci/release/changelogs/next.md +++ b/ci/release/changelogs/next.md @@ -10,6 +10,7 @@ Layout capability also takes a subtle but important step forward: you can now cu - `null` keyword can be used to un-declare. See [docs](https://d2lang.com/tour/overrides#null) [#1446](https://github.com/terrastruct/d2/pull/1446) - Develop multi-board diagrams in watch mode (links to layers/scenarios/steps work in `--watch`) [#1503](https://github.com/terrastruct/d2/pull/1503) - Glob patterns have been implemented. See [docs](https://d2lang.com/tour/globs). [#1479](https://github.com/terrastruct/d2/pull/1479) +- Ampersand filters have been implemented. See [docs](https://d2lang.com/tour/filters). [#1509](https://github.com/terrastruct/d2/pull/1509) #### Improvements ๐Ÿงน diff --git a/d2ast/d2ast.go b/d2ast/d2ast.go index 6b6f47389..fdbe9c9c3 100644 --- a/d2ast/d2ast.go +++ b/d2ast/d2ast.go @@ -610,7 +610,7 @@ func (m *Map) IsFileMap() bool { type Key struct { Range Range `json:"range"` - // Indicates this MapKey is an override selector. + // Indicates this MapKey is a filter selector. Ampersand bool `json:"ampersand,omitempty"` // At least one of Key and Edges will be set but all four can also be set. @@ -720,6 +720,19 @@ func (mk *Key) SetScalar(scalar ScalarBox) { } } +func (mk *Key) HasQueryGlob() bool { + if mk.Key.HasGlob() && len(mk.Edges) == 0 { + return true + } + if mk.EdgeIndex != nil && mk.EdgeIndex.Glob && mk.EdgeKey == nil { + return true + } + if mk.EdgeKey.HasGlob() { + return true + } + return false +} + type KeyPath struct { Range Range `json:"range"` Path []*StringBox `json:"path"` @@ -748,6 +761,9 @@ func (kp *KeyPath) Copy() *KeyPath { } func (kp *KeyPath) HasDoubleGlob() bool { + if kp == nil { + return false + } for _, el := range kp.Path { if el.UnquotedString != nil && el.ScalarString() == "**" { return true @@ -757,6 +773,9 @@ func (kp *KeyPath) HasDoubleGlob() bool { } func (kp *KeyPath) HasGlob() bool { + if kp == nil { + return false + } for _, el := range kp.Path { if el.UnquotedString != nil && len(el.UnquotedString.Pattern) > 0 { return true @@ -1099,12 +1118,11 @@ 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 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. -// TODO: Return StringBox func RawString(s string, inKey bool) String { if s == "" { return FlatDoubleQuotedString(s) @@ -1117,10 +1135,6 @@ func RawString(s string, inKey bool) String { if i+1 < len(s) && s[i+1] != '-' { continue } - case '&': - if i > 0 { - continue - } } if strings.ContainsRune(UnquotedKeySpecials, r) { if !strings.ContainsRune(s, '"') { diff --git a/d2ir/compile.go b/d2ir/compile.go index 43763139d..a0783923e 100644 --- a/d2ir/compile.go +++ b/d2ir/compile.go @@ -22,6 +22,8 @@ type compiler struct { // importCache enables reuse of files imported multiple times. importCache map[string]*Map utf16 bool + + globStack []bool } type CompileOptions struct { @@ -344,6 +346,20 @@ func (c *compiler) overlay(base *Map, f *Field) { } func (c *compiler) compileMap(dst *Map, ast, scopeAST *d2ast.Map) { + for _, n := range ast.Nodes { + switch { + case n.MapKey != nil: + ok := c.ampersandFilter(&RefContext{ + Key: n.MapKey, + Scope: ast, + ScopeMap: dst, + ScopeAST: scopeAST, + }) + if !ok { + return + } + } + } for _, n := range ast.Nodes { switch { case n.MapKey != nil: @@ -396,6 +412,10 @@ func (c *compiler) compileKey(refctx *RefContext) { } func (c *compiler) compileField(dst *Map, kp *d2ast.KeyPath, refctx *RefContext) { + if refctx.Key.Ampersand { + return + } + fa, err := dst.EnsureField(kp, refctx, true) if err != nil { c.err.Errors = append(c.err.Errors, err.(d2ast.Error)) @@ -407,6 +427,62 @@ func (c *compiler) compileField(dst *Map, kp *d2ast.KeyPath, refctx *RefContext) } } +func (c *compiler) ampersandFilter(refctx *RefContext) bool { + if !refctx.Key.Ampersand { + return true + } + if len(c.globStack) == 0 || !c.globStack[len(c.globStack)-1] { + c.errorf(refctx.Key, "glob filters cannot be used outside globs") + return false + } + if len(refctx.Key.Edges) > 0 { + return true + } + + fa, err := refctx.ScopeMap.EnsureField(refctx.Key.Key, refctx, false) + if err != nil { + c.err.Errors = append(c.err.Errors, err.(d2ast.Error)) + return false + } + if len(fa) == 0 { + return false + } + for _, f := range fa { + ok := c._ampersandFilter(f, refctx) + if !ok { + return false + } + } + return true +} + +func (c *compiler) _ampersandFilter(f *Field, refctx *RefContext) bool { + if refctx.Key.Value.ScalarBox().Unbox() == nil { + c.errorf(refctx.Key, "glob filters cannot be composites") + return false + } + + if a, ok := f.Composite.(*Array); ok { + for _, v := range a.Values { + if s, ok := v.(*Scalar); ok { + if refctx.Key.Value.ScalarBox().Unbox().ScalarString() == s.Value.ScalarString() { + return true + } + } + } + } + + if f.Primary_ == nil { + return false + } + + if refctx.Key.Value.ScalarBox().Unbox().ScalarString() != f.Primary_.Value.ScalarString() { + return false + } + + return true +} + func (c *compiler) _compileField(f *Field, refctx *RefContext) { if len(refctx.Key.Edges) == 0 && refctx.Key.Value.Null != nil { // For vars, if we delete the field, it may just resolve to an outer scope var of the same name @@ -456,7 +532,9 @@ func (c *compiler) _compileField(f *Field, refctx *RefContext) { // If new board type, use that as the new scope AST, otherwise, carry on scopeAST = refctx.ScopeAST } + c.globStack = append(c.globStack, refctx.Key.HasQueryGlob()) c.compileMap(f.Map(), refctx.Key.Value.Map, scopeAST) + c.globStack = c.globStack[:len(c.globStack)-1] switch NodeBoardKind(f) { case BoardScenario, BoardStep: c.overlayClasses(f.Map()) @@ -693,7 +771,9 @@ func (c *compiler) _compileEdges(refctx *RefContext) { parent: e, } } + c.globStack = append(c.globStack, refctx.Key.HasQueryGlob()) c.compileMap(e.Map_, refctx.Key.Value.Map, refctx.ScopeAST) + c.globStack = c.globStack[:len(c.globStack)-1] } else if refctx.Key.Value.ScalarBox().Unbox() != nil { e.Primary_ = &Scalar{ parent: e, diff --git a/d2ir/compile_test.go b/d2ir/compile_test.go index 64d16ad8d..9fc96b228 100644 --- a/d2ir/compile_test.go +++ b/d2ir/compile_test.go @@ -27,6 +27,7 @@ func TestCompile(t *testing.T) { t.Run("steps", testCompileSteps) t.Run("imports", testCompileImports) t.Run("patterns", testCompilePatterns) + t.Run("filters", testCompileFilters) } type testCase struct { diff --git a/d2ir/filter_test.go b/d2ir/filter_test.go new file mode 100644 index 000000000..710ba0803 --- /dev/null +++ b/d2ir/filter_test.go @@ -0,0 +1,158 @@ +package d2ir_test + +import ( + "testing" + + "oss.terrastruct.com/util-go/assert" +) + +func testCompileFilters(t *testing.T) { + t.Parallel() + + tca := []testCase{ + { + name: "base", + run: func(t testing.TB) { + m, err := compile(t, `jacob: { + shape: circle +} +jeremy: { + shape: rectangle +} +*: { + &shape: rectangle + label: I'm a rectangle +}`) + assert.Success(t, err) + assertQuery(t, m, 1, 0, nil, "jacob") + assertQuery(t, m, 2, 0, nil, "jeremy") + assertQuery(t, m, 0, 0, "I'm a rectangle", "jeremy.label") + }, + }, + { + name: "order", + run: func(t testing.TB) { + m, err := compile(t, `jacob: { + shape: circle +} +jeremy: { + shape: rectangle +} +*: { + label: I'm a rectangle + &shape: rectangle +}`) + assert.Success(t, err) + assertQuery(t, m, 5, 0, nil, "") + assertQuery(t, m, 1, 0, nil, "jacob") + assertQuery(t, m, 2, 0, nil, "jeremy") + assertQuery(t, m, 0, 0, "I'm a rectangle", "jeremy.label") + }, + }, + { + name: "array", + run: func(t testing.TB) { + m, err := compile(t, `the-little-cannon: { + class: [server; deployed] +} +dino: { + class: [internal; deployed] +} +catapult: { + class: [jacob; server] +} + +*: { + &class: server + style.multiple: true +} +`) + assert.Success(t, err) + assertQuery(t, m, 10, 0, nil, "") + assertQuery(t, m, 3, 0, nil, "the-little-cannon") + assertQuery(t, m, 1, 0, nil, "dino") + assertQuery(t, m, 3, 0, nil, "catapult") + }, + }, + { + name: "edge", + run: func(t testing.TB) { + m, err := compile(t, `x -> y: { + source-arrowhead.shape: diamond + target-arrowhead.shape: diamond +} +x -> y + +(x -> *)[*]: { + &source-arrowhead.shape: diamond + &target-arrowhead.shape: diamond + label: diamond shape arrowheads +} +`) + assert.Success(t, err) + assertQuery(t, m, 7, 2, nil, "") + assertQuery(t, m, 5, 0, nil, "(x -> y)[0]") + assertQuery(t, m, 0, 0, "diamond shape arrowheads", "(x -> y)[0].label") + assertQuery(t, m, 0, 0, nil, "(x -> y)[1]") + }, + }, + } + + runa(t, tca) + + t.Run("errors", func(t *testing.T) { + tca := []testCase{ + { + name: "bad-syntax", + run: func(t testing.TB) { + _, err := compile(t, `jacob.style: { + fill: red + multiple: true +} + +*.&style: { + fill: red + multiple: true +} +`) + assert.ErrorString(t, err, `TestCompile/filters/errors/bad-syntax.d2:6:3: unexpected text after map key +TestCompile/filters/errors/bad-syntax.d2:9:1: unexpected map termination character } in file map`) + }, + }, + { + name: "no-glob", + run: func(t testing.TB) { + _, err := compile(t, `jacob.style: { + fill: red + multiple: true +} + +jasmine.style: { + &fill: red + multiple: false +} +`) + assert.ErrorString(t, err, `TestCompile/filters/errors/no-glob.d2:7:3: glob filters cannot be used outside globs`) + }, + }, + { + name: "composite", + run: func(t testing.TB) { + _, err := compile(t, `jacob.style: { + fill: red + multiple: true +} +*: { + &style: { + fill: red + multiple: true + } +} +`) + assert.ErrorString(t, err, `TestCompile/filters/errors/composite.d2:6:2: glob filters cannot be composites`) + }, + }, + } + runa(t, tca) + }) +} diff --git a/d2ir/pattern_test.go b/d2ir/pattern_test.go index aabd8be58..613751ab3 100644 --- a/d2ir/pattern_test.go +++ b/d2ir/pattern_test.go @@ -323,10 +323,9 @@ task.** -> fast { name: "glob-edge-glob-index", run: func(t testing.TB) { - m, err := compile(t, `(* -> b)[*].style.fill: red + _, err := compile(t, `(* -> b)[*].style.fill: red `) assert.ErrorString(t, err, `TestCompile/patterns/errors/glob-edge-glob-index.d2:1:2: indexed edge does not exist`) - assertQuery(t, m, 0, 0, nil, "") }, }, } diff --git a/d2parser/parse.go b/d2parser/parse.go index 6f792d374..50f6c91c1 100644 --- a/d2parser/parse.go +++ b/d2parser/parse.go @@ -1098,7 +1098,7 @@ func (p *parser) parseUnquotedString(inKey bool) (s *d2ast.UnquotedString) { } if inKey { switch r { - case ':', '.', '<', '>': + case ':', '.', '<', '>', '&': p.rewind() return s case '-': diff --git a/e2etests/regression_test.go b/e2etests/regression_test.go index 55bc62b14..24a0d0edd 100644 --- a/e2etests/regression_test.go +++ b/e2etests/regression_test.go @@ -648,11 +648,9 @@ group: { }, { name: "ampersand-escape", - script: `h&y: &โˆˆ { + script: `hy: &โˆˆ { tooltip: beans & rice } -&foo -&&bar `, }, { diff --git a/e2etests/testdata/regression/ampersand-escape/dagre/board.exp.json b/e2etests/testdata/regression/ampersand-escape/dagre/board.exp.json index 924c38e6b..f5f27d395 100644 --- a/e2etests/testdata/regression/ampersand-escape/dagre/board.exp.json +++ b/e2etests/testdata/regression/ampersand-escape/dagre/board.exp.json @@ -4,7 +4,7 @@ "fontFamily": "SourceSansPro", "shapes": [ { - "id": "h&y", + "id": "hy", "type": "rectangle", "pos": { "x": 0, @@ -43,88 +43,6 @@ "labelPosition": "INSIDE_MIDDLE_CENTER", "zIndex": 0, "level": 1 - }, - { - "id": "foo", - "type": "rectangle", - "pos": { - "x": 158, - "y": 0 - }, - "width": 69, - "height": 66, - "opacity": 1, - "strokeDash": 0, - "strokeWidth": 2, - "borderRadius": 0, - "fill": "B6", - "stroke": "B1", - "shadow": false, - "3d": false, - "multiple": false, - "double-border": false, - "tooltip": "", - "link": "", - "icon": null, - "iconPosition": "", - "blend": false, - "fields": null, - "methods": null, - "columns": null, - "label": "foo", - "fontSize": 16, - "fontFamily": "DEFAULT", - "language": "", - "color": "N1", - "italic": false, - "bold": true, - "underline": false, - "labelWidth": 24, - "labelHeight": 21, - "labelPosition": "INSIDE_MIDDLE_CENTER", - "zIndex": 0, - "level": 1 - }, - { - "id": "\"&bar\"", - "type": "rectangle", - "pos": { - "x": 287, - "y": 0 - }, - "width": 81, - "height": 66, - "opacity": 1, - "strokeDash": 0, - "strokeWidth": 2, - "borderRadius": 0, - "fill": "B6", - "stroke": "B1", - "shadow": false, - "3d": false, - "multiple": false, - "double-border": false, - "tooltip": "", - "link": "", - "icon": null, - "iconPosition": "", - "blend": false, - "fields": null, - "methods": null, - "columns": null, - "label": "&bar", - "fontSize": 16, - "fontFamily": "DEFAULT", - "language": "", - "color": "N1", - "italic": false, - "bold": true, - "underline": false, - "labelWidth": 36, - "labelHeight": 21, - "labelPosition": "INSIDE_MIDDLE_CENTER", - "zIndex": 0, - "level": 1 } ], "connections": [], diff --git a/e2etests/testdata/regression/ampersand-escape/dagre/sketch.exp.svg b/e2etests/testdata/regression/ampersand-escape/dagre/sketch.exp.svg index 34b6f853f..8f189785c 100644 --- a/e2etests/testdata/regression/ampersand-escape/dagre/sketch.exp.svg +++ b/e2etests/testdata/regression/ampersand-escape/dagre/sketch.exp.svg @@ -1,13 +1,13 @@ -&โˆˆbeans & ricefoo&barbeans & rice + .d2-1658760307 .fill-N1{fill:#0A0F25;} + .d2-1658760307 .fill-N2{fill:#676C7E;} + .d2-1658760307 .fill-N3{fill:#9499AB;} + .d2-1658760307 .fill-N4{fill:#CFD2DD;} + .d2-1658760307 .fill-N5{fill:#DEE1EB;} + .d2-1658760307 .fill-N6{fill:#EEF1F8;} + .d2-1658760307 .fill-N7{fill:#FFFFFF;} + .d2-1658760307 .fill-B1{fill:#0D32B2;} + .d2-1658760307 .fill-B2{fill:#0D32B2;} + .d2-1658760307 .fill-B3{fill:#E3E9FD;} + .d2-1658760307 .fill-B4{fill:#E3E9FD;} + .d2-1658760307 .fill-B5{fill:#EDF0FD;} + .d2-1658760307 .fill-B6{fill:#F7F8FE;} + .d2-1658760307 .fill-AA2{fill:#4A6FF3;} + .d2-1658760307 .fill-AA4{fill:#EDF0FD;} + .d2-1658760307 .fill-AA5{fill:#F7F8FE;} + .d2-1658760307 .fill-AB4{fill:#EDF0FD;} + .d2-1658760307 .fill-AB5{fill:#F7F8FE;} + .d2-1658760307 .stroke-N1{stroke:#0A0F25;} + .d2-1658760307 .stroke-N2{stroke:#676C7E;} + .d2-1658760307 .stroke-N3{stroke:#9499AB;} + .d2-1658760307 .stroke-N4{stroke:#CFD2DD;} + .d2-1658760307 .stroke-N5{stroke:#DEE1EB;} + .d2-1658760307 .stroke-N6{stroke:#EEF1F8;} + .d2-1658760307 .stroke-N7{stroke:#FFFFFF;} + .d2-1658760307 .stroke-B1{stroke:#0D32B2;} + .d2-1658760307 .stroke-B2{stroke:#0D32B2;} + .d2-1658760307 .stroke-B3{stroke:#E3E9FD;} + .d2-1658760307 .stroke-B4{stroke:#E3E9FD;} + .d2-1658760307 .stroke-B5{stroke:#EDF0FD;} + .d2-1658760307 .stroke-B6{stroke:#F7F8FE;} + .d2-1658760307 .stroke-AA2{stroke:#4A6FF3;} + .d2-1658760307 .stroke-AA4{stroke:#EDF0FD;} + .d2-1658760307 .stroke-AA5{stroke:#F7F8FE;} + .d2-1658760307 .stroke-AB4{stroke:#EDF0FD;} + .d2-1658760307 .stroke-AB5{stroke:#F7F8FE;} + .d2-1658760307 .background-color-N1{background-color:#0A0F25;} + .d2-1658760307 .background-color-N2{background-color:#676C7E;} + .d2-1658760307 .background-color-N3{background-color:#9499AB;} + .d2-1658760307 .background-color-N4{background-color:#CFD2DD;} + .d2-1658760307 .background-color-N5{background-color:#DEE1EB;} + .d2-1658760307 .background-color-N6{background-color:#EEF1F8;} + .d2-1658760307 .background-color-N7{background-color:#FFFFFF;} + .d2-1658760307 .background-color-B1{background-color:#0D32B2;} + .d2-1658760307 .background-color-B2{background-color:#0D32B2;} + .d2-1658760307 .background-color-B3{background-color:#E3E9FD;} + .d2-1658760307 .background-color-B4{background-color:#E3E9FD;} + .d2-1658760307 .background-color-B5{background-color:#EDF0FD;} + .d2-1658760307 .background-color-B6{background-color:#F7F8FE;} + .d2-1658760307 .background-color-AA2{background-color:#4A6FF3;} + .d2-1658760307 .background-color-AA4{background-color:#EDF0FD;} + .d2-1658760307 .background-color-AA5{background-color:#F7F8FE;} + .d2-1658760307 .background-color-AB4{background-color:#EDF0FD;} + .d2-1658760307 .background-color-AB5{background-color:#F7F8FE;} + .d2-1658760307 .color-N1{color:#0A0F25;} + .d2-1658760307 .color-N2{color:#676C7E;} + .d2-1658760307 .color-N3{color:#9499AB;} + .d2-1658760307 .color-N4{color:#CFD2DD;} + .d2-1658760307 .color-N5{color:#DEE1EB;} + .d2-1658760307 .color-N6{color:#EEF1F8;} + .d2-1658760307 .color-N7{color:#FFFFFF;} + .d2-1658760307 .color-B1{color:#0D32B2;} + .d2-1658760307 .color-B2{color:#0D32B2;} + .d2-1658760307 .color-B3{color:#E3E9FD;} + .d2-1658760307 .color-B4{color:#E3E9FD;} + .d2-1658760307 .color-B5{color:#EDF0FD;} + .d2-1658760307 .color-B6{color:#F7F8FE;} + .d2-1658760307 .color-AA2{color:#4A6FF3;} + .d2-1658760307 .color-AA4{color:#EDF0FD;} + .d2-1658760307 .color-AA5{color:#F7F8FE;} + .d2-1658760307 .color-AB4{color:#EDF0FD;} + .d2-1658760307 .color-AB5{color:#F7F8FE;}.appendix text.text{fill:#0A0F25}.md{--color-fg-default:#0A0F25;--color-fg-muted:#676C7E;--color-fg-subtle:#9499AB;--color-canvas-default:#FFFFFF;--color-canvas-subtle:#EEF1F8;--color-border-default:#0D32B2;--color-border-muted:#0D32B2;--color-neutral-muted:#EEF1F8;--color-accent-fg:#0D32B2;--color-accent-emphasis:#0D32B2;--color-attention-subtle:#676C7E;--color-danger-fg:red;}.sketch-overlay-B1{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-B2{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-B3{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-B4{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-B5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-B6{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AA2{fill:url(#streaks-dark);mix-blend-mode:overlay}.sketch-overlay-AA4{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AA5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AB4{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AB5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N1{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-N2{fill:url(#streaks-dark);mix-blend-mode:overlay}.sketch-overlay-N3{fill:url(#streaks-normal);mix-blend-mode:color-burn}.sketch-overlay-N4{fill:url(#streaks-normal);mix-blend-mode:color-burn}.sketch-overlay-N5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N6{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N7{fill:url(#streaks-bright);mix-blend-mode:darken}.light-code{display: block}.dark-code{display: none}]]>&โˆˆbeans & ricebeans & rice @@ -105,9 +105,7 @@ - - + + - - \ No newline at end of file diff --git a/e2etests/testdata/regression/ampersand-escape/elk/board.exp.json b/e2etests/testdata/regression/ampersand-escape/elk/board.exp.json index 29afa3817..c135331d8 100644 --- a/e2etests/testdata/regression/ampersand-escape/elk/board.exp.json +++ b/e2etests/testdata/regression/ampersand-escape/elk/board.exp.json @@ -4,7 +4,7 @@ "fontFamily": "SourceSansPro", "shapes": [ { - "id": "h&y", + "id": "hy", "type": "rectangle", "pos": { "x": 12, @@ -43,88 +43,6 @@ "labelPosition": "INSIDE_MIDDLE_CENTER", "zIndex": 0, "level": 1 - }, - { - "id": "foo", - "type": "rectangle", - "pos": { - "x": 130, - "y": 12 - }, - "width": 69, - "height": 66, - "opacity": 1, - "strokeDash": 0, - "strokeWidth": 2, - "borderRadius": 0, - "fill": "B6", - "stroke": "B1", - "shadow": false, - "3d": false, - "multiple": false, - "double-border": false, - "tooltip": "", - "link": "", - "icon": null, - "iconPosition": "", - "blend": false, - "fields": null, - "methods": null, - "columns": null, - "label": "foo", - "fontSize": 16, - "fontFamily": "DEFAULT", - "language": "", - "color": "N1", - "italic": false, - "bold": true, - "underline": false, - "labelWidth": 24, - "labelHeight": 21, - "labelPosition": "INSIDE_MIDDLE_CENTER", - "zIndex": 0, - "level": 1 - }, - { - "id": "\"&bar\"", - "type": "rectangle", - "pos": { - "x": 219, - "y": 12 - }, - "width": 81, - "height": 66, - "opacity": 1, - "strokeDash": 0, - "strokeWidth": 2, - "borderRadius": 0, - "fill": "B6", - "stroke": "B1", - "shadow": false, - "3d": false, - "multiple": false, - "double-border": false, - "tooltip": "", - "link": "", - "icon": null, - "iconPosition": "", - "blend": false, - "fields": null, - "methods": null, - "columns": null, - "label": "&bar", - "fontSize": 16, - "fontFamily": "DEFAULT", - "language": "", - "color": "N1", - "italic": false, - "bold": true, - "underline": false, - "labelWidth": 36, - "labelHeight": 21, - "labelPosition": "INSIDE_MIDDLE_CENTER", - "zIndex": 0, - "level": 1 } ], "connections": [], diff --git a/e2etests/testdata/regression/ampersand-escape/elk/sketch.exp.svg b/e2etests/testdata/regression/ampersand-escape/elk/sketch.exp.svg index 90424ee6b..eff889432 100644 --- a/e2etests/testdata/regression/ampersand-escape/elk/sketch.exp.svg +++ b/e2etests/testdata/regression/ampersand-escape/elk/sketch.exp.svg @@ -1,13 +1,13 @@ -&โˆˆbeans & ricefoo&barbeans & rice + .d2-616571211 .fill-N1{fill:#0A0F25;} + .d2-616571211 .fill-N2{fill:#676C7E;} + .d2-616571211 .fill-N3{fill:#9499AB;} + .d2-616571211 .fill-N4{fill:#CFD2DD;} + .d2-616571211 .fill-N5{fill:#DEE1EB;} + .d2-616571211 .fill-N6{fill:#EEF1F8;} + .d2-616571211 .fill-N7{fill:#FFFFFF;} + .d2-616571211 .fill-B1{fill:#0D32B2;} + .d2-616571211 .fill-B2{fill:#0D32B2;} + .d2-616571211 .fill-B3{fill:#E3E9FD;} + .d2-616571211 .fill-B4{fill:#E3E9FD;} + .d2-616571211 .fill-B5{fill:#EDF0FD;} + .d2-616571211 .fill-B6{fill:#F7F8FE;} + .d2-616571211 .fill-AA2{fill:#4A6FF3;} + .d2-616571211 .fill-AA4{fill:#EDF0FD;} + .d2-616571211 .fill-AA5{fill:#F7F8FE;} + .d2-616571211 .fill-AB4{fill:#EDF0FD;} + .d2-616571211 .fill-AB5{fill:#F7F8FE;} + .d2-616571211 .stroke-N1{stroke:#0A0F25;} + .d2-616571211 .stroke-N2{stroke:#676C7E;} + .d2-616571211 .stroke-N3{stroke:#9499AB;} + .d2-616571211 .stroke-N4{stroke:#CFD2DD;} + .d2-616571211 .stroke-N5{stroke:#DEE1EB;} + .d2-616571211 .stroke-N6{stroke:#EEF1F8;} + .d2-616571211 .stroke-N7{stroke:#FFFFFF;} + .d2-616571211 .stroke-B1{stroke:#0D32B2;} + .d2-616571211 .stroke-B2{stroke:#0D32B2;} + .d2-616571211 .stroke-B3{stroke:#E3E9FD;} + .d2-616571211 .stroke-B4{stroke:#E3E9FD;} + .d2-616571211 .stroke-B5{stroke:#EDF0FD;} + .d2-616571211 .stroke-B6{stroke:#F7F8FE;} + .d2-616571211 .stroke-AA2{stroke:#4A6FF3;} + .d2-616571211 .stroke-AA4{stroke:#EDF0FD;} + .d2-616571211 .stroke-AA5{stroke:#F7F8FE;} + .d2-616571211 .stroke-AB4{stroke:#EDF0FD;} + .d2-616571211 .stroke-AB5{stroke:#F7F8FE;} + .d2-616571211 .background-color-N1{background-color:#0A0F25;} + .d2-616571211 .background-color-N2{background-color:#676C7E;} + .d2-616571211 .background-color-N3{background-color:#9499AB;} + .d2-616571211 .background-color-N4{background-color:#CFD2DD;} + .d2-616571211 .background-color-N5{background-color:#DEE1EB;} + .d2-616571211 .background-color-N6{background-color:#EEF1F8;} + .d2-616571211 .background-color-N7{background-color:#FFFFFF;} + .d2-616571211 .background-color-B1{background-color:#0D32B2;} + .d2-616571211 .background-color-B2{background-color:#0D32B2;} + .d2-616571211 .background-color-B3{background-color:#E3E9FD;} + .d2-616571211 .background-color-B4{background-color:#E3E9FD;} + .d2-616571211 .background-color-B5{background-color:#EDF0FD;} + .d2-616571211 .background-color-B6{background-color:#F7F8FE;} + .d2-616571211 .background-color-AA2{background-color:#4A6FF3;} + .d2-616571211 .background-color-AA4{background-color:#EDF0FD;} + .d2-616571211 .background-color-AA5{background-color:#F7F8FE;} + .d2-616571211 .background-color-AB4{background-color:#EDF0FD;} + .d2-616571211 .background-color-AB5{background-color:#F7F8FE;} + .d2-616571211 .color-N1{color:#0A0F25;} + .d2-616571211 .color-N2{color:#676C7E;} + .d2-616571211 .color-N3{color:#9499AB;} + .d2-616571211 .color-N4{color:#CFD2DD;} + .d2-616571211 .color-N5{color:#DEE1EB;} + .d2-616571211 .color-N6{color:#EEF1F8;} + .d2-616571211 .color-N7{color:#FFFFFF;} + .d2-616571211 .color-B1{color:#0D32B2;} + .d2-616571211 .color-B2{color:#0D32B2;} + .d2-616571211 .color-B3{color:#E3E9FD;} + .d2-616571211 .color-B4{color:#E3E9FD;} + .d2-616571211 .color-B5{color:#EDF0FD;} + .d2-616571211 .color-B6{color:#F7F8FE;} + .d2-616571211 .color-AA2{color:#4A6FF3;} + .d2-616571211 .color-AA4{color:#EDF0FD;} + .d2-616571211 .color-AA5{color:#F7F8FE;} + .d2-616571211 .color-AB4{color:#EDF0FD;} + .d2-616571211 .color-AB5{color:#F7F8FE;}.appendix text.text{fill:#0A0F25}.md{--color-fg-default:#0A0F25;--color-fg-muted:#676C7E;--color-fg-subtle:#9499AB;--color-canvas-default:#FFFFFF;--color-canvas-subtle:#EEF1F8;--color-border-default:#0D32B2;--color-border-muted:#0D32B2;--color-neutral-muted:#EEF1F8;--color-accent-fg:#0D32B2;--color-accent-emphasis:#0D32B2;--color-attention-subtle:#676C7E;--color-danger-fg:red;}.sketch-overlay-B1{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-B2{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-B3{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-B4{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-B5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-B6{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AA2{fill:url(#streaks-dark);mix-blend-mode:overlay}.sketch-overlay-AA4{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AA5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AB4{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AB5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N1{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-N2{fill:url(#streaks-dark);mix-blend-mode:overlay}.sketch-overlay-N3{fill:url(#streaks-normal);mix-blend-mode:color-burn}.sketch-overlay-N4{fill:url(#streaks-normal);mix-blend-mode:color-burn}.sketch-overlay-N5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N6{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N7{fill:url(#streaks-bright);mix-blend-mode:darken}.light-code{display: block}.dark-code{display: none}]]>&โˆˆbeans & ricebeans & rice @@ -105,9 +105,7 @@ - - + + - - \ No newline at end of file diff --git a/testdata/d2ir/TestCompile/filters/array.exp.json b/testdata/d2ir/TestCompile/filters/array.exp.json new file mode 100644 index 000000000..1fc271233 --- /dev/null +++ b/testdata/d2ir/TestCompile/filters/array.exp.json @@ -0,0 +1,1229 @@ +{ + "fields": [ + { + "name": "the-little-cannon", + "composite": { + "fields": [ + { + "name": "class", + "composite": { + "values": [ + { + "value": { + "range": "TestCompile/filters/array.d2,1:9:30-1:15:36", + "value": [ + { + "string": "server", + "raw_string": "server" + } + ] + } + }, + { + "value": { + "range": "TestCompile/filters/array.d2,1:17:38-1:25:46", + "value": [ + { + "string": "deployed", + "raw_string": "deployed" + } + ] + } + } + ] + }, + "references": [ + { + "string": { + "range": "TestCompile/filters/array.d2,1:1:22-1:6:27", + "value": [ + { + "string": "class", + "raw_string": "class" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/array.d2,1:1:22-1:6:27", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/array.d2,1:1:22-1:6:27", + "value": [ + { + "string": "class", + "raw_string": "class" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/filters/array.d2,1:1:22-1:26:47", + "key": { + "range": "TestCompile/filters/array.d2,1:1:22-1:6:27", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/array.d2,1:1:22-1:6:27", + "value": [ + { + "string": "class", + "raw_string": "class" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "array": { + "range": "TestCompile/filters/array.d2,1:8:29-1:25:46", + "nodes": [ + { + "unquoted_string": { + "range": "TestCompile/filters/array.d2,1:9:30-1:15:36", + "value": [ + { + "string": "server", + "raw_string": "server" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/filters/array.d2,1:17:38-1:25:46", + "value": [ + { + "string": "deployed", + "raw_string": "deployed" + } + ] + } + } + ] + } + } + } + } + }, + { + "string": { + "range": "TestCompile/filters/array.d2,11:2:135-11:7:140", + "value": [ + { + "string": "class", + "raw_string": "class" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/array.d2,11:2:135-11:7:140", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/array.d2,11:2:135-11:7:140", + "value": [ + { + "string": "class", + "raw_string": "class" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/filters/array.d2,11:1:134-11:15:148", + "ampersand": true, + "key": { + "range": "TestCompile/filters/array.d2,11:2:135-11:7:140", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/array.d2,11:2:135-11:7:140", + "value": [ + { + "string": "class", + "raw_string": "class" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/array.d2,11:9:142-11:15:148", + "value": [ + { + "string": "server", + "raw_string": "server" + } + ] + } + } + } + } + } + ] + }, + { + "name": "style", + "composite": { + "fields": [ + { + "name": "multiple", + "primary": { + "value": { + "range": "TestCompile/filters/array.d2,12:17:166-12:21:170", + "value": true + } + }, + "references": [ + { + "string": { + "range": "TestCompile/filters/array.d2,12:7:156-12:15:164", + "value": [ + { + "string": "multiple", + "raw_string": "multiple" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/array.d2,12:1:150-12:15:164", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/array.d2,12:1:150-12:6:155", + "value": [ + { + "string": "style", + "raw_string": "style" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/filters/array.d2,12:7:156-12:15:164", + "value": [ + { + "string": "multiple", + "raw_string": "multiple" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/filters/array.d2,12:1:150-12:21:170", + "key": { + "range": "TestCompile/filters/array.d2,12:1:150-12:15:164", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/array.d2,12:1:150-12:6:155", + "value": [ + { + "string": "style", + "raw_string": "style" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/filters/array.d2,12:7:156-12:15:164", + "value": [ + { + "string": "multiple", + "raw_string": "multiple" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "boolean": { + "range": "TestCompile/filters/array.d2,12:17:166-12:21:170", + "value": true + } + } + } + } + } + ] + } + ], + "edges": null + }, + "references": [ + { + "string": { + "range": "TestCompile/filters/array.d2,12:1:150-12:6:155", + "value": [ + { + "string": "style", + "raw_string": "style" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/array.d2,12:1:150-12:15:164", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/array.d2,12:1:150-12:6:155", + "value": [ + { + "string": "style", + "raw_string": "style" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/filters/array.d2,12:7:156-12:15:164", + "value": [ + { + "string": "multiple", + "raw_string": "multiple" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/filters/array.d2,12:1:150-12:21:170", + "key": { + "range": "TestCompile/filters/array.d2,12:1:150-12:15:164", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/array.d2,12:1:150-12:6:155", + "value": [ + { + "string": "style", + "raw_string": "style" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/filters/array.d2,12:7:156-12:15:164", + "value": [ + { + "string": "multiple", + "raw_string": "multiple" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "boolean": { + "range": "TestCompile/filters/array.d2,12:17:166-12:21:170", + "value": true + } + } + } + } + } + ] + } + ], + "edges": null + }, + "references": [ + { + "string": { + "range": "TestCompile/filters/array.d2,0:0:0-0:17:17", + "value": [ + { + "string": "the-little-cannon", + "raw_string": "the-little-cannon" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/array.d2,0:0:0-0:17:17", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/array.d2,0:0:0-0:17:17", + "value": [ + { + "string": "the-little-cannon", + "raw_string": "the-little-cannon" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/filters/array.d2,0:0:0-2:1:49", + "key": { + "range": "TestCompile/filters/array.d2,0:0:0-0:17:17", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/array.d2,0:0:0-0:17:17", + "value": [ + { + "string": "the-little-cannon", + "raw_string": "the-little-cannon" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "TestCompile/filters/array.d2,0:19:19-2:1:49", + "nodes": [ + { + "map_key": { + "range": "TestCompile/filters/array.d2,1:1:22-1:26:47", + "key": { + "range": "TestCompile/filters/array.d2,1:1:22-1:6:27", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/array.d2,1:1:22-1:6:27", + "value": [ + { + "string": "class", + "raw_string": "class" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "array": { + "range": "TestCompile/filters/array.d2,1:8:29-1:25:46", + "nodes": [ + { + "unquoted_string": { + "range": "TestCompile/filters/array.d2,1:9:30-1:15:36", + "value": [ + { + "string": "server", + "raw_string": "server" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/filters/array.d2,1:17:38-1:25:46", + "value": [ + { + "string": "deployed", + "raw_string": "deployed" + } + ] + } + } + ] + } + } + } + } + ] + } + } + } + } + } + ] + }, + { + "name": "dino", + "composite": { + "fields": [ + { + "name": "class", + "composite": { + "values": [ + { + "value": { + "range": "TestCompile/filters/array.d2,4:9:67-4:17:75", + "value": [ + { + "string": "internal", + "raw_string": "internal" + } + ] + } + }, + { + "value": { + "range": "TestCompile/filters/array.d2,4:19:77-4:27:85", + "value": [ + { + "string": "deployed", + "raw_string": "deployed" + } + ] + } + } + ] + }, + "references": [ + { + "string": { + "range": "TestCompile/filters/array.d2,4:1:59-4:6:64", + "value": [ + { + "string": "class", + "raw_string": "class" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/array.d2,4:1:59-4:6:64", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/array.d2,4:1:59-4:6:64", + "value": [ + { + "string": "class", + "raw_string": "class" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/filters/array.d2,4:1:59-4:28:86", + "key": { + "range": "TestCompile/filters/array.d2,4:1:59-4:6:64", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/array.d2,4:1:59-4:6:64", + "value": [ + { + "string": "class", + "raw_string": "class" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "array": { + "range": "TestCompile/filters/array.d2,4:8:66-4:27:85", + "nodes": [ + { + "unquoted_string": { + "range": "TestCompile/filters/array.d2,4:9:67-4:17:75", + "value": [ + { + "string": "internal", + "raw_string": "internal" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/filters/array.d2,4:19:77-4:27:85", + "value": [ + { + "string": "deployed", + "raw_string": "deployed" + } + ] + } + } + ] + } + } + } + } + }, + { + "string": { + "range": "TestCompile/filters/array.d2,11:2:135-11:7:140", + "value": [ + { + "string": "class", + "raw_string": "class" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/array.d2,11:2:135-11:7:140", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/array.d2,11:2:135-11:7:140", + "value": [ + { + "string": "class", + "raw_string": "class" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/filters/array.d2,11:1:134-11:15:148", + "ampersand": true, + "key": { + "range": "TestCompile/filters/array.d2,11:2:135-11:7:140", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/array.d2,11:2:135-11:7:140", + "value": [ + { + "string": "class", + "raw_string": "class" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/array.d2,11:9:142-11:15:148", + "value": [ + { + "string": "server", + "raw_string": "server" + } + ] + } + } + } + } + } + ] + } + ], + "edges": null + }, + "references": [ + { + "string": { + "range": "TestCompile/filters/array.d2,3:0:50-3:4:54", + "value": [ + { + "string": "dino", + "raw_string": "dino" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/array.d2,3:0:50-3:4:54", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/array.d2,3:0:50-3:4:54", + "value": [ + { + "string": "dino", + "raw_string": "dino" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/filters/array.d2,3:0:50-5:1:88", + "key": { + "range": "TestCompile/filters/array.d2,3:0:50-3:4:54", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/array.d2,3:0:50-3:4:54", + "value": [ + { + "string": "dino", + "raw_string": "dino" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "TestCompile/filters/array.d2,3:6:56-5:1:88", + "nodes": [ + { + "map_key": { + "range": "TestCompile/filters/array.d2,4:1:59-4:28:86", + "key": { + "range": "TestCompile/filters/array.d2,4:1:59-4:6:64", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/array.d2,4:1:59-4:6:64", + "value": [ + { + "string": "class", + "raw_string": "class" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "array": { + "range": "TestCompile/filters/array.d2,4:8:66-4:27:85", + "nodes": [ + { + "unquoted_string": { + "range": "TestCompile/filters/array.d2,4:9:67-4:17:75", + "value": [ + { + "string": "internal", + "raw_string": "internal" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/filters/array.d2,4:19:77-4:27:85", + "value": [ + { + "string": "deployed", + "raw_string": "deployed" + } + ] + } + } + ] + } + } + } + } + ] + } + } + } + } + } + ] + }, + { + "name": "catapult", + "composite": { + "fields": [ + { + "name": "class", + "composite": { + "values": [ + { + "value": { + "range": "TestCompile/filters/array.d2,7:9:110-7:14:115", + "value": [ + { + "string": "jacob", + "raw_string": "jacob" + } + ] + } + }, + { + "value": { + "range": "TestCompile/filters/array.d2,7:16:117-7:22:123", + "value": [ + { + "string": "server", + "raw_string": "server" + } + ] + } + } + ] + }, + "references": [ + { + "string": { + "range": "TestCompile/filters/array.d2,7:1:102-7:6:107", + "value": [ + { + "string": "class", + "raw_string": "class" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/array.d2,7:1:102-7:6:107", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/array.d2,7:1:102-7:6:107", + "value": [ + { + "string": "class", + "raw_string": "class" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/filters/array.d2,7:1:102-7:23:124", + "key": { + "range": "TestCompile/filters/array.d2,7:1:102-7:6:107", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/array.d2,7:1:102-7:6:107", + "value": [ + { + "string": "class", + "raw_string": "class" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "array": { + "range": "TestCompile/filters/array.d2,7:8:109-7:22:123", + "nodes": [ + { + "unquoted_string": { + "range": "TestCompile/filters/array.d2,7:9:110-7:14:115", + "value": [ + { + "string": "jacob", + "raw_string": "jacob" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/filters/array.d2,7:16:117-7:22:123", + "value": [ + { + "string": "server", + "raw_string": "server" + } + ] + } + } + ] + } + } + } + } + }, + { + "string": { + "range": "TestCompile/filters/array.d2,11:2:135-11:7:140", + "value": [ + { + "string": "class", + "raw_string": "class" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/array.d2,11:2:135-11:7:140", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/array.d2,11:2:135-11:7:140", + "value": [ + { + "string": "class", + "raw_string": "class" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/filters/array.d2,11:1:134-11:15:148", + "ampersand": true, + "key": { + "range": "TestCompile/filters/array.d2,11:2:135-11:7:140", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/array.d2,11:2:135-11:7:140", + "value": [ + { + "string": "class", + "raw_string": "class" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/array.d2,11:9:142-11:15:148", + "value": [ + { + "string": "server", + "raw_string": "server" + } + ] + } + } + } + } + } + ] + }, + { + "name": "style", + "composite": { + "fields": [ + { + "name": "multiple", + "primary": { + "value": { + "range": "TestCompile/filters/array.d2,12:17:166-12:21:170", + "value": true + } + }, + "references": [ + { + "string": { + "range": "TestCompile/filters/array.d2,12:7:156-12:15:164", + "value": [ + { + "string": "multiple", + "raw_string": "multiple" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/array.d2,12:1:150-12:15:164", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/array.d2,12:1:150-12:6:155", + "value": [ + { + "string": "style", + "raw_string": "style" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/filters/array.d2,12:7:156-12:15:164", + "value": [ + { + "string": "multiple", + "raw_string": "multiple" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/filters/array.d2,12:1:150-12:21:170", + "key": { + "range": "TestCompile/filters/array.d2,12:1:150-12:15:164", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/array.d2,12:1:150-12:6:155", + "value": [ + { + "string": "style", + "raw_string": "style" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/filters/array.d2,12:7:156-12:15:164", + "value": [ + { + "string": "multiple", + "raw_string": "multiple" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "boolean": { + "range": "TestCompile/filters/array.d2,12:17:166-12:21:170", + "value": true + } + } + } + } + } + ] + } + ], + "edges": null + }, + "references": [ + { + "string": { + "range": "TestCompile/filters/array.d2,12:1:150-12:6:155", + "value": [ + { + "string": "style", + "raw_string": "style" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/array.d2,12:1:150-12:15:164", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/array.d2,12:1:150-12:6:155", + "value": [ + { + "string": "style", + "raw_string": "style" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/filters/array.d2,12:7:156-12:15:164", + "value": [ + { + "string": "multiple", + "raw_string": "multiple" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/filters/array.d2,12:1:150-12:21:170", + "key": { + "range": "TestCompile/filters/array.d2,12:1:150-12:15:164", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/array.d2,12:1:150-12:6:155", + "value": [ + { + "string": "style", + "raw_string": "style" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/filters/array.d2,12:7:156-12:15:164", + "value": [ + { + "string": "multiple", + "raw_string": "multiple" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "boolean": { + "range": "TestCompile/filters/array.d2,12:17:166-12:21:170", + "value": true + } + } + } + } + } + ] + } + ], + "edges": null + }, + "references": [ + { + "string": { + "range": "TestCompile/filters/array.d2,6:0:89-6:8:97", + "value": [ + { + "string": "catapult", + "raw_string": "catapult" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/array.d2,6:0:89-6:8:97", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/array.d2,6:0:89-6:8:97", + "value": [ + { + "string": "catapult", + "raw_string": "catapult" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/filters/array.d2,6:0:89-8:1:126", + "key": { + "range": "TestCompile/filters/array.d2,6:0:89-6:8:97", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/array.d2,6:0:89-6:8:97", + "value": [ + { + "string": "catapult", + "raw_string": "catapult" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "TestCompile/filters/array.d2,6:10:99-8:1:126", + "nodes": [ + { + "map_key": { + "range": "TestCompile/filters/array.d2,7:1:102-7:23:124", + "key": { + "range": "TestCompile/filters/array.d2,7:1:102-7:6:107", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/array.d2,7:1:102-7:6:107", + "value": [ + { + "string": "class", + "raw_string": "class" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "array": { + "range": "TestCompile/filters/array.d2,7:8:109-7:22:123", + "nodes": [ + { + "unquoted_string": { + "range": "TestCompile/filters/array.d2,7:9:110-7:14:115", + "value": [ + { + "string": "jacob", + "raw_string": "jacob" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/filters/array.d2,7:16:117-7:22:123", + "value": [ + { + "string": "server", + "raw_string": "server" + } + ] + } + } + ] + } + } + } + } + ] + } + } + } + } + } + ] + } + ], + "edges": null +} diff --git a/testdata/d2ir/TestCompile/filters/base#01.exp.json b/testdata/d2ir/TestCompile/filters/base#01.exp.json new file mode 100644 index 000000000..0521ab4f3 --- /dev/null +++ b/testdata/d2ir/TestCompile/filters/base#01.exp.json @@ -0,0 +1,560 @@ +{ + "fields": [ + { + "name": "jacob", + "composite": { + "fields": [ + { + "name": "shape", + "primary": { + "value": { + "range": "TestCompile/filters/base#01.d2,1:8:17-1:14:23", + "value": [ + { + "string": "circle", + "raw_string": "circle" + } + ] + } + }, + "references": [ + { + "string": { + "range": "TestCompile/filters/base#01.d2,1:1:10-1:6:15", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/base#01.d2,1:1:10-1:6:15", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/base#01.d2,1:1:10-1:6:15", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/filters/base#01.d2,1:1:10-1:14:23", + "key": { + "range": "TestCompile/filters/base#01.d2,1:1:10-1:6:15", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/base#01.d2,1:1:10-1:6:15", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/base#01.d2,1:8:17-1:14:23", + "value": [ + { + "string": "circle", + "raw_string": "circle" + } + ] + } + } + } + } + }, + { + "string": { + "range": "TestCompile/filters/base#01.d2,7:2:63-7:7:68", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/base#01.d2,7:2:63-7:7:68", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/base#01.d2,7:2:63-7:7:68", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/filters/base#01.d2,7:1:62-7:18:79", + "ampersand": true, + "key": { + "range": "TestCompile/filters/base#01.d2,7:2:63-7:7:68", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/base#01.d2,7:2:63-7:7:68", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/base#01.d2,7:9:70-7:18:79", + "value": [ + { + "string": "rectangle", + "raw_string": "rectangle" + } + ] + } + } + } + } + } + ] + } + ], + "edges": null + }, + "references": [ + { + "string": { + "range": "TestCompile/filters/base#01.d2,0:0:0-0:5:5", + "value": [ + { + "string": "jacob", + "raw_string": "jacob" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/base#01.d2,0:0:0-0:5:5", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/base#01.d2,0:0:0-0:5:5", + "value": [ + { + "string": "jacob", + "raw_string": "jacob" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/filters/base#01.d2,0:0:0-2:1:25", + "key": { + "range": "TestCompile/filters/base#01.d2,0:0:0-0:5:5", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/base#01.d2,0:0:0-0:5:5", + "value": [ + { + "string": "jacob", + "raw_string": "jacob" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "TestCompile/filters/base#01.d2,0:7:7-2:1:25", + "nodes": [ + { + "map_key": { + "range": "TestCompile/filters/base#01.d2,1:1:10-1:14:23", + "key": { + "range": "TestCompile/filters/base#01.d2,1:1:10-1:6:15", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/base#01.d2,1:1:10-1:6:15", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/base#01.d2,1:8:17-1:14:23", + "value": [ + { + "string": "circle", + "raw_string": "circle" + } + ] + } + } + } + } + ] + } + } + } + } + } + ] + }, + { + "name": "jeremy", + "composite": { + "fields": [ + { + "name": "shape", + "primary": { + "value": { + "range": "TestCompile/filters/base#01.d2,7:9:70-7:18:79", + "value": [ + { + "string": "rectangle", + "raw_string": "rectangle" + } + ] + } + }, + "references": [ + { + "string": { + "range": "TestCompile/filters/base#01.d2,4:1:37-4:6:42", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/base#01.d2,4:1:37-4:6:42", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/base#01.d2,4:1:37-4:6:42", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/filters/base#01.d2,4:1:37-4:17:53", + "key": { + "range": "TestCompile/filters/base#01.d2,4:1:37-4:6:42", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/base#01.d2,4:1:37-4:6:42", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/base#01.d2,4:8:44-4:17:53", + "value": [ + { + "string": "rectangle", + "raw_string": "rectangle" + } + ] + } + } + } + } + }, + { + "string": { + "range": "TestCompile/filters/base#01.d2,7:2:63-7:7:68", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/base#01.d2,7:2:63-7:7:68", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/base#01.d2,7:2:63-7:7:68", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/filters/base#01.d2,7:1:62-7:18:79", + "ampersand": true, + "key": { + "range": "TestCompile/filters/base#01.d2,7:2:63-7:7:68", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/base#01.d2,7:2:63-7:7:68", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/base#01.d2,7:9:70-7:18:79", + "value": [ + { + "string": "rectangle", + "raw_string": "rectangle" + } + ] + } + } + } + } + } + ] + }, + { + "name": "label", + "primary": { + "value": { + "range": "TestCompile/filters/base#01.d2,8:8:88-8:23:103", + "value": [ + { + "string": "I'm a rectangle", + "raw_string": "I'm a rectangle" + } + ] + } + }, + "references": [ + { + "string": { + "range": "TestCompile/filters/base#01.d2,8:1:81-8:6:86", + "value": [ + { + "string": "label", + "raw_string": "label" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/base#01.d2,8:1:81-8:6:86", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/base#01.d2,8:1:81-8:6:86", + "value": [ + { + "string": "label", + "raw_string": "label" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/filters/base#01.d2,8:1:81-8:23:103", + "key": { + "range": "TestCompile/filters/base#01.d2,8:1:81-8:6:86", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/base#01.d2,8:1:81-8:6:86", + "value": [ + { + "string": "label", + "raw_string": "label" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/base#01.d2,8:8:88-8:23:103", + "value": [ + { + "string": "I'm a rectangle", + "raw_string": "I'm a rectangle" + } + ] + } + } + } + } + } + ] + } + ], + "edges": null + }, + "references": [ + { + "string": { + "range": "TestCompile/filters/base#01.d2,3:0:26-3:6:32", + "value": [ + { + "string": "jeremy", + "raw_string": "jeremy" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/base#01.d2,3:0:26-3:6:32", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/base#01.d2,3:0:26-3:6:32", + "value": [ + { + "string": "jeremy", + "raw_string": "jeremy" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/filters/base#01.d2,3:0:26-5:1:55", + "key": { + "range": "TestCompile/filters/base#01.d2,3:0:26-3:6:32", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/base#01.d2,3:0:26-3:6:32", + "value": [ + { + "string": "jeremy", + "raw_string": "jeremy" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "TestCompile/filters/base#01.d2,3:8:34-5:1:55", + "nodes": [ + { + "map_key": { + "range": "TestCompile/filters/base#01.d2,4:1:37-4:17:53", + "key": { + "range": "TestCompile/filters/base#01.d2,4:1:37-4:6:42", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/base#01.d2,4:1:37-4:6:42", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/base#01.d2,4:8:44-4:17:53", + "value": [ + { + "string": "rectangle", + "raw_string": "rectangle" + } + ] + } + } + } + } + ] + } + } + } + } + } + ] + } + ], + "edges": null +} diff --git a/testdata/d2ir/TestCompile/filters/base.exp.json b/testdata/d2ir/TestCompile/filters/base.exp.json new file mode 100644 index 000000000..c8a934bbc --- /dev/null +++ b/testdata/d2ir/TestCompile/filters/base.exp.json @@ -0,0 +1,560 @@ +{ + "fields": [ + { + "name": "jacob", + "composite": { + "fields": [ + { + "name": "shape", + "primary": { + "value": { + "range": "TestCompile/filters/base.d2,1:8:17-1:14:23", + "value": [ + { + "string": "circle", + "raw_string": "circle" + } + ] + } + }, + "references": [ + { + "string": { + "range": "TestCompile/filters/base.d2,1:1:10-1:6:15", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/base.d2,1:1:10-1:6:15", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/base.d2,1:1:10-1:6:15", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/filters/base.d2,1:1:10-1:14:23", + "key": { + "range": "TestCompile/filters/base.d2,1:1:10-1:6:15", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/base.d2,1:1:10-1:6:15", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/base.d2,1:8:17-1:14:23", + "value": [ + { + "string": "circle", + "raw_string": "circle" + } + ] + } + } + } + } + }, + { + "string": { + "range": "TestCompile/filters/base.d2,7:2:63-7:7:68", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/base.d2,7:2:63-7:7:68", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/base.d2,7:2:63-7:7:68", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/filters/base.d2,7:1:62-7:18:79", + "ampersand": true, + "key": { + "range": "TestCompile/filters/base.d2,7:2:63-7:7:68", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/base.d2,7:2:63-7:7:68", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/base.d2,7:9:70-7:18:79", + "value": [ + { + "string": "rectangle", + "raw_string": "rectangle" + } + ] + } + } + } + } + } + ] + } + ], + "edges": null + }, + "references": [ + { + "string": { + "range": "TestCompile/filters/base.d2,0:0:0-0:5:5", + "value": [ + { + "string": "jacob", + "raw_string": "jacob" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/base.d2,0:0:0-0:5:5", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/base.d2,0:0:0-0:5:5", + "value": [ + { + "string": "jacob", + "raw_string": "jacob" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/filters/base.d2,0:0:0-2:1:25", + "key": { + "range": "TestCompile/filters/base.d2,0:0:0-0:5:5", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/base.d2,0:0:0-0:5:5", + "value": [ + { + "string": "jacob", + "raw_string": "jacob" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "TestCompile/filters/base.d2,0:7:7-2:1:25", + "nodes": [ + { + "map_key": { + "range": "TestCompile/filters/base.d2,1:1:10-1:14:23", + "key": { + "range": "TestCompile/filters/base.d2,1:1:10-1:6:15", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/base.d2,1:1:10-1:6:15", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/base.d2,1:8:17-1:14:23", + "value": [ + { + "string": "circle", + "raw_string": "circle" + } + ] + } + } + } + } + ] + } + } + } + } + } + ] + }, + { + "name": "jeremy", + "composite": { + "fields": [ + { + "name": "shape", + "primary": { + "value": { + "range": "TestCompile/filters/base.d2,4:8:44-4:17:53", + "value": [ + { + "string": "rectangle", + "raw_string": "rectangle" + } + ] + } + }, + "references": [ + { + "string": { + "range": "TestCompile/filters/base.d2,4:1:37-4:6:42", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/base.d2,4:1:37-4:6:42", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/base.d2,4:1:37-4:6:42", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/filters/base.d2,4:1:37-4:17:53", + "key": { + "range": "TestCompile/filters/base.d2,4:1:37-4:6:42", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/base.d2,4:1:37-4:6:42", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/base.d2,4:8:44-4:17:53", + "value": [ + { + "string": "rectangle", + "raw_string": "rectangle" + } + ] + } + } + } + } + }, + { + "string": { + "range": "TestCompile/filters/base.d2,7:2:63-7:7:68", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/base.d2,7:2:63-7:7:68", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/base.d2,7:2:63-7:7:68", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/filters/base.d2,7:1:62-7:18:79", + "ampersand": true, + "key": { + "range": "TestCompile/filters/base.d2,7:2:63-7:7:68", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/base.d2,7:2:63-7:7:68", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/base.d2,7:9:70-7:18:79", + "value": [ + { + "string": "rectangle", + "raw_string": "rectangle" + } + ] + } + } + } + } + } + ] + }, + { + "name": "label", + "primary": { + "value": { + "range": "TestCompile/filters/base.d2,8:8:88-8:23:103", + "value": [ + { + "string": "I'm a rectangle", + "raw_string": "I'm a rectangle" + } + ] + } + }, + "references": [ + { + "string": { + "range": "TestCompile/filters/base.d2,8:1:81-8:6:86", + "value": [ + { + "string": "label", + "raw_string": "label" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/base.d2,8:1:81-8:6:86", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/base.d2,8:1:81-8:6:86", + "value": [ + { + "string": "label", + "raw_string": "label" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/filters/base.d2,8:1:81-8:23:103", + "key": { + "range": "TestCompile/filters/base.d2,8:1:81-8:6:86", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/base.d2,8:1:81-8:6:86", + "value": [ + { + "string": "label", + "raw_string": "label" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/base.d2,8:8:88-8:23:103", + "value": [ + { + "string": "I'm a rectangle", + "raw_string": "I'm a rectangle" + } + ] + } + } + } + } + } + ] + } + ], + "edges": null + }, + "references": [ + { + "string": { + "range": "TestCompile/filters/base.d2,3:0:26-3:6:32", + "value": [ + { + "string": "jeremy", + "raw_string": "jeremy" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/base.d2,3:0:26-3:6:32", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/base.d2,3:0:26-3:6:32", + "value": [ + { + "string": "jeremy", + "raw_string": "jeremy" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/filters/base.d2,3:0:26-5:1:55", + "key": { + "range": "TestCompile/filters/base.d2,3:0:26-3:6:32", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/base.d2,3:0:26-3:6:32", + "value": [ + { + "string": "jeremy", + "raw_string": "jeremy" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "TestCompile/filters/base.d2,3:8:34-5:1:55", + "nodes": [ + { + "map_key": { + "range": "TestCompile/filters/base.d2,4:1:37-4:17:53", + "key": { + "range": "TestCompile/filters/base.d2,4:1:37-4:6:42", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/base.d2,4:1:37-4:6:42", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/base.d2,4:8:44-4:17:53", + "value": [ + { + "string": "rectangle", + "raw_string": "rectangle" + } + ] + } + } + } + } + ] + } + } + } + } + } + ] + } + ], + "edges": null +} diff --git a/testdata/d2ir/TestCompile/filters/edge.exp.json b/testdata/d2ir/TestCompile/filters/edge.exp.json new file mode 100644 index 000000000..7e65c4f85 --- /dev/null +++ b/testdata/d2ir/TestCompile/filters/edge.exp.json @@ -0,0 +1,2696 @@ +{ + "fields": [ + { + "name": "x", + "references": [ + { + "string": { + "range": "TestCompile/filters/edge.d2,0:0:0-0:1:1", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/edge.d2,0:0:0-0:1:1", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,0:0:0-0:1:1", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "context": { + "edge": { + "range": "TestCompile/filters/edge.d2,0:0:0-0:6:6", + "src": { + "range": "TestCompile/filters/edge.d2,0:0:0-0:1:1", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,0:0:0-0:1:1", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "src_arrow": "", + "dst": { + "range": "TestCompile/filters/edge.d2,0:5:5-0:6:6", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,0:5:5-0:6:6", + "value": [ + { + "string": "y", + "raw_string": "y" + } + ] + } + } + ] + }, + "dst_arrow": ">" + }, + "key": { + "range": "TestCompile/filters/edge.d2,0:0:0-3:1:77", + "edges": [ + { + "range": "TestCompile/filters/edge.d2,0:0:0-0:6:6", + "src": { + "range": "TestCompile/filters/edge.d2,0:0:0-0:1:1", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,0:0:0-0:1:1", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "src_arrow": "", + "dst": { + "range": "TestCompile/filters/edge.d2,0:5:5-0:6:6", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,0:5:5-0:6:6", + "value": [ + { + "string": "y", + "raw_string": "y" + } + ] + } + } + ] + }, + "dst_arrow": ">" + } + ], + "primary": {}, + "value": { + "map": { + "range": "TestCompile/filters/edge.d2,0:8:8-3:1:77", + "nodes": [ + { + "map_key": { + "range": "TestCompile/filters/edge.d2,1:1:11-1:32:42", + "key": { + "range": "TestCompile/filters/edge.d2,1:1:11-1:23:33", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,1:1:11-1:17:27", + "value": [ + { + "string": "source-arrowhead", + "raw_string": "source-arrowhead" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,1:18:28-1:23:33", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,1:25:35-1:32:42", + "value": [ + { + "string": "diamond", + "raw_string": "diamond" + } + ] + } + } + } + }, + { + "map_key": { + "range": "TestCompile/filters/edge.d2,2:1:44-2:32:75", + "key": { + "range": "TestCompile/filters/edge.d2,2:1:44-2:23:66", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,2:1:44-2:17:60", + "value": [ + { + "string": "target-arrowhead", + "raw_string": "target-arrowhead" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,2:18:61-2:23:66", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,2:25:68-2:32:75", + "value": [ + { + "string": "diamond", + "raw_string": "diamond" + } + ] + } + } + } + } + ] + } + } + } + } + }, + { + "string": { + "range": "TestCompile/filters/edge.d2,4:0:78-4:1:79", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/edge.d2,4:0:78-4:1:79", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,4:0:78-4:1:79", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "context": { + "edge": { + "range": "TestCompile/filters/edge.d2,4:0:78-4:6:84", + "src": { + "range": "TestCompile/filters/edge.d2,4:0:78-4:1:79", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,4:0:78-4:1:79", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "src_arrow": "", + "dst": { + "range": "TestCompile/filters/edge.d2,4:5:83-4:6:84", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,4:5:83-4:6:84", + "value": [ + { + "string": "y", + "raw_string": "y" + } + ] + } + } + ] + }, + "dst_arrow": ">" + }, + "key": { + "range": "TestCompile/filters/edge.d2,4:0:78-4:6:84", + "edges": [ + { + "range": "TestCompile/filters/edge.d2,4:0:78-4:6:84", + "src": { + "range": "TestCompile/filters/edge.d2,4:0:78-4:1:79", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,4:0:78-4:1:79", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "src_arrow": "", + "dst": { + "range": "TestCompile/filters/edge.d2,4:5:83-4:6:84", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,4:5:83-4:6:84", + "value": [ + { + "string": "y", + "raw_string": "y" + } + ] + } + } + ] + }, + "dst_arrow": ">" + } + ], + "primary": {}, + "value": {} + } + } + }, + { + "string": { + "range": "TestCompile/filters/edge.d2,6:1:87-6:2:88", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/edge.d2,6:1:87-6:2:88", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,6:1:87-6:2:88", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "context": { + "edge": { + "range": "TestCompile/filters/edge.d2,6:1:87-6:7:93", + "src": { + "range": "TestCompile/filters/edge.d2,6:1:87-6:2:88", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,6:1:87-6:2:88", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "src_arrow": "", + "dst": { + "range": "TestCompile/filters/edge.d2,6:6:92-6:7:93", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,6:6:92-6:7:93", + "value": [ + { + "string": "*", + "raw_string": "*" + } + ], + "pattern": [ + "*" + ] + } + } + ] + }, + "dst_arrow": ">" + }, + "key": { + "range": "TestCompile/filters/edge.d2,6:0:86-10:1:203", + "edges": [ + { + "range": "TestCompile/filters/edge.d2,6:1:87-6:7:93", + "src": { + "range": "TestCompile/filters/edge.d2,6:1:87-6:2:88", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,6:1:87-6:2:88", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "src_arrow": "", + "dst": { + "range": "TestCompile/filters/edge.d2,6:6:92-6:7:93", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,6:6:92-6:7:93", + "value": [ + { + "string": "*", + "raw_string": "*" + } + ], + "pattern": [ + "*" + ] + } + } + ] + }, + "dst_arrow": ">" + } + ], + "edge_index": { + "range": "TestCompile/filters/edge.d2,6:8:94-6:11:97", + "int": null, + "glob": true + }, + "primary": {}, + "value": { + "map": { + "range": "TestCompile/filters/edge.d2,6:13:99-10:1:203", + "nodes": [ + { + "map_key": { + "range": "TestCompile/filters/edge.d2,7:1:102-7:33:134", + "ampersand": true, + "key": { + "range": "TestCompile/filters/edge.d2,7:2:103-7:24:125", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,7:2:103-7:18:119", + "value": [ + { + "string": "source-arrowhead", + "raw_string": "source-arrowhead" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,7:19:120-7:24:125", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,7:26:127-7:33:134", + "value": [ + { + "string": "diamond", + "raw_string": "diamond" + } + ] + } + } + } + }, + { + "map_key": { + "range": "TestCompile/filters/edge.d2,8:1:136-8:33:168", + "ampersand": true, + "key": { + "range": "TestCompile/filters/edge.d2,8:2:137-8:24:159", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,8:2:137-8:18:153", + "value": [ + { + "string": "target-arrowhead", + "raw_string": "target-arrowhead" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,8:19:154-8:24:159", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,8:26:161-8:33:168", + "value": [ + { + "string": "diamond", + "raw_string": "diamond" + } + ] + } + } + } + }, + { + "map_key": { + "range": "TestCompile/filters/edge.d2,9:1:170-9:32:201", + "key": { + "range": "TestCompile/filters/edge.d2,9:1:170-9:6:175", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,9:1:170-9:6:175", + "value": [ + { + "string": "label", + "raw_string": "label" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,9:8:177-9:32:201", + "value": [ + { + "string": "diamond shape arrowheads", + "raw_string": "diamond shape arrowheads" + } + ] + } + } + } + } + ] + } + } + } + } + }, + { + "string": { + "range": "TestCompile/filters/edge.d2,6:1:87-6:2:88", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/edge.d2,6:1:87-6:2:88", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,6:1:87-6:2:88", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "context": { + "edge": { + "range": "TestCompile/filters/edge.d2,6:1:87-6:7:93", + "src": { + "range": "TestCompile/filters/edge.d2,6:1:87-6:2:88", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,6:1:87-6:2:88", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "src_arrow": "", + "dst": { + "range": "TestCompile/filters/edge.d2,6:6:92-6:7:93", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,6:6:92-6:7:93", + "value": [ + { + "string": "*", + "raw_string": "*" + } + ], + "pattern": [ + "*" + ] + } + } + ] + }, + "dst_arrow": ">" + }, + "key": { + "range": "TestCompile/filters/edge.d2,6:0:86-10:1:203", + "edges": [ + { + "range": "TestCompile/filters/edge.d2,6:1:87-6:7:93", + "src": { + "range": "TestCompile/filters/edge.d2,6:1:87-6:2:88", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,6:1:87-6:2:88", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "src_arrow": "", + "dst": { + "range": "TestCompile/filters/edge.d2,6:6:92-6:7:93", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,6:6:92-6:7:93", + "value": [ + { + "string": "*", + "raw_string": "*" + } + ], + "pattern": [ + "*" + ] + } + } + ] + }, + "dst_arrow": ">" + } + ], + "edge_index": { + "range": "TestCompile/filters/edge.d2,6:8:94-6:11:97", + "int": null, + "glob": true + }, + "primary": {}, + "value": { + "map": { + "range": "TestCompile/filters/edge.d2,6:13:99-10:1:203", + "nodes": [ + { + "map_key": { + "range": "TestCompile/filters/edge.d2,7:1:102-7:33:134", + "ampersand": true, + "key": { + "range": "TestCompile/filters/edge.d2,7:2:103-7:24:125", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,7:2:103-7:18:119", + "value": [ + { + "string": "source-arrowhead", + "raw_string": "source-arrowhead" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,7:19:120-7:24:125", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,7:26:127-7:33:134", + "value": [ + { + "string": "diamond", + "raw_string": "diamond" + } + ] + } + } + } + }, + { + "map_key": { + "range": "TestCompile/filters/edge.d2,8:1:136-8:33:168", + "ampersand": true, + "key": { + "range": "TestCompile/filters/edge.d2,8:2:137-8:24:159", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,8:2:137-8:18:153", + "value": [ + { + "string": "target-arrowhead", + "raw_string": "target-arrowhead" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,8:19:154-8:24:159", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,8:26:161-8:33:168", + "value": [ + { + "string": "diamond", + "raw_string": "diamond" + } + ] + } + } + } + }, + { + "map_key": { + "range": "TestCompile/filters/edge.d2,9:1:170-9:32:201", + "key": { + "range": "TestCompile/filters/edge.d2,9:1:170-9:6:175", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,9:1:170-9:6:175", + "value": [ + { + "string": "label", + "raw_string": "label" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,9:8:177-9:32:201", + "value": [ + { + "string": "diamond shape arrowheads", + "raw_string": "diamond shape arrowheads" + } + ] + } + } + } + } + ] + } + } + } + } + } + ] + }, + { + "name": "y", + "references": [ + { + "string": { + "range": "TestCompile/filters/edge.d2,0:5:5-0:6:6", + "value": [ + { + "string": "y", + "raw_string": "y" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/edge.d2,0:5:5-0:6:6", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,0:5:5-0:6:6", + "value": [ + { + "string": "y", + "raw_string": "y" + } + ] + } + } + ] + }, + "context": { + "edge": { + "range": "TestCompile/filters/edge.d2,0:0:0-0:6:6", + "src": { + "range": "TestCompile/filters/edge.d2,0:0:0-0:1:1", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,0:0:0-0:1:1", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "src_arrow": "", + "dst": { + "range": "TestCompile/filters/edge.d2,0:5:5-0:6:6", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,0:5:5-0:6:6", + "value": [ + { + "string": "y", + "raw_string": "y" + } + ] + } + } + ] + }, + "dst_arrow": ">" + }, + "key": { + "range": "TestCompile/filters/edge.d2,0:0:0-3:1:77", + "edges": [ + { + "range": "TestCompile/filters/edge.d2,0:0:0-0:6:6", + "src": { + "range": "TestCompile/filters/edge.d2,0:0:0-0:1:1", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,0:0:0-0:1:1", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "src_arrow": "", + "dst": { + "range": "TestCompile/filters/edge.d2,0:5:5-0:6:6", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,0:5:5-0:6:6", + "value": [ + { + "string": "y", + "raw_string": "y" + } + ] + } + } + ] + }, + "dst_arrow": ">" + } + ], + "primary": {}, + "value": { + "map": { + "range": "TestCompile/filters/edge.d2,0:8:8-3:1:77", + "nodes": [ + { + "map_key": { + "range": "TestCompile/filters/edge.d2,1:1:11-1:32:42", + "key": { + "range": "TestCompile/filters/edge.d2,1:1:11-1:23:33", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,1:1:11-1:17:27", + "value": [ + { + "string": "source-arrowhead", + "raw_string": "source-arrowhead" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,1:18:28-1:23:33", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,1:25:35-1:32:42", + "value": [ + { + "string": "diamond", + "raw_string": "diamond" + } + ] + } + } + } + }, + { + "map_key": { + "range": "TestCompile/filters/edge.d2,2:1:44-2:32:75", + "key": { + "range": "TestCompile/filters/edge.d2,2:1:44-2:23:66", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,2:1:44-2:17:60", + "value": [ + { + "string": "target-arrowhead", + "raw_string": "target-arrowhead" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,2:18:61-2:23:66", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,2:25:68-2:32:75", + "value": [ + { + "string": "diamond", + "raw_string": "diamond" + } + ] + } + } + } + } + ] + } + } + } + } + }, + { + "string": { + "range": "TestCompile/filters/edge.d2,4:5:83-4:6:84", + "value": [ + { + "string": "y", + "raw_string": "y" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/edge.d2,4:5:83-4:6:84", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,4:5:83-4:6:84", + "value": [ + { + "string": "y", + "raw_string": "y" + } + ] + } + } + ] + }, + "context": { + "edge": { + "range": "TestCompile/filters/edge.d2,4:0:78-4:6:84", + "src": { + "range": "TestCompile/filters/edge.d2,4:0:78-4:1:79", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,4:0:78-4:1:79", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "src_arrow": "", + "dst": { + "range": "TestCompile/filters/edge.d2,4:5:83-4:6:84", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,4:5:83-4:6:84", + "value": [ + { + "string": "y", + "raw_string": "y" + } + ] + } + } + ] + }, + "dst_arrow": ">" + }, + "key": { + "range": "TestCompile/filters/edge.d2,4:0:78-4:6:84", + "edges": [ + { + "range": "TestCompile/filters/edge.d2,4:0:78-4:6:84", + "src": { + "range": "TestCompile/filters/edge.d2,4:0:78-4:1:79", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,4:0:78-4:1:79", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "src_arrow": "", + "dst": { + "range": "TestCompile/filters/edge.d2,4:5:83-4:6:84", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,4:5:83-4:6:84", + "value": [ + { + "string": "y", + "raw_string": "y" + } + ] + } + } + ] + }, + "dst_arrow": ">" + } + ], + "primary": {}, + "value": {} + } + } + } + ] + } + ], + "edges": [ + { + "edge_id": { + "src_path": [ + "x" + ], + "src_arrow": false, + "dst_path": [ + "y" + ], + "dst_arrow": true, + "index": 0, + "glob": false + }, + "map": { + "fields": [ + { + "name": "source-arrowhead", + "composite": { + "fields": [ + { + "name": "shape", + "primary": { + "value": { + "range": "TestCompile/filters/edge.d2,1:25:35-1:32:42", + "value": [ + { + "string": "diamond", + "raw_string": "diamond" + } + ] + } + }, + "references": [ + { + "string": { + "range": "TestCompile/filters/edge.d2,1:18:28-1:23:33", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/edge.d2,1:1:11-1:23:33", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,1:1:11-1:17:27", + "value": [ + { + "string": "source-arrowhead", + "raw_string": "source-arrowhead" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,1:18:28-1:23:33", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/filters/edge.d2,1:1:11-1:32:42", + "key": { + "range": "TestCompile/filters/edge.d2,1:1:11-1:23:33", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,1:1:11-1:17:27", + "value": [ + { + "string": "source-arrowhead", + "raw_string": "source-arrowhead" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,1:18:28-1:23:33", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,1:25:35-1:32:42", + "value": [ + { + "string": "diamond", + "raw_string": "diamond" + } + ] + } + } + } + } + }, + { + "string": { + "range": "TestCompile/filters/edge.d2,7:19:120-7:24:125", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/edge.d2,7:2:103-7:24:125", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,7:2:103-7:18:119", + "value": [ + { + "string": "source-arrowhead", + "raw_string": "source-arrowhead" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,7:19:120-7:24:125", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/filters/edge.d2,7:1:102-7:33:134", + "ampersand": true, + "key": { + "range": "TestCompile/filters/edge.d2,7:2:103-7:24:125", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,7:2:103-7:18:119", + "value": [ + { + "string": "source-arrowhead", + "raw_string": "source-arrowhead" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,7:19:120-7:24:125", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,7:26:127-7:33:134", + "value": [ + { + "string": "diamond", + "raw_string": "diamond" + } + ] + } + } + } + } + } + ] + } + ], + "edges": null + }, + "references": [ + { + "string": { + "range": "TestCompile/filters/edge.d2,1:1:11-1:17:27", + "value": [ + { + "string": "source-arrowhead", + "raw_string": "source-arrowhead" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/edge.d2,1:1:11-1:23:33", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,1:1:11-1:17:27", + "value": [ + { + "string": "source-arrowhead", + "raw_string": "source-arrowhead" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,1:18:28-1:23:33", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/filters/edge.d2,1:1:11-1:32:42", + "key": { + "range": "TestCompile/filters/edge.d2,1:1:11-1:23:33", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,1:1:11-1:17:27", + "value": [ + { + "string": "source-arrowhead", + "raw_string": "source-arrowhead" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,1:18:28-1:23:33", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,1:25:35-1:32:42", + "value": [ + { + "string": "diamond", + "raw_string": "diamond" + } + ] + } + } + } + } + }, + { + "string": { + "range": "TestCompile/filters/edge.d2,7:2:103-7:18:119", + "value": [ + { + "string": "source-arrowhead", + "raw_string": "source-arrowhead" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/edge.d2,7:2:103-7:24:125", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,7:2:103-7:18:119", + "value": [ + { + "string": "source-arrowhead", + "raw_string": "source-arrowhead" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,7:19:120-7:24:125", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/filters/edge.d2,7:1:102-7:33:134", + "ampersand": true, + "key": { + "range": "TestCompile/filters/edge.d2,7:2:103-7:24:125", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,7:2:103-7:18:119", + "value": [ + { + "string": "source-arrowhead", + "raw_string": "source-arrowhead" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,7:19:120-7:24:125", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,7:26:127-7:33:134", + "value": [ + { + "string": "diamond", + "raw_string": "diamond" + } + ] + } + } + } + } + } + ] + }, + { + "name": "target-arrowhead", + "composite": { + "fields": [ + { + "name": "shape", + "primary": { + "value": { + "range": "TestCompile/filters/edge.d2,2:25:68-2:32:75", + "value": [ + { + "string": "diamond", + "raw_string": "diamond" + } + ] + } + }, + "references": [ + { + "string": { + "range": "TestCompile/filters/edge.d2,2:18:61-2:23:66", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/edge.d2,2:1:44-2:23:66", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,2:1:44-2:17:60", + "value": [ + { + "string": "target-arrowhead", + "raw_string": "target-arrowhead" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,2:18:61-2:23:66", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/filters/edge.d2,2:1:44-2:32:75", + "key": { + "range": "TestCompile/filters/edge.d2,2:1:44-2:23:66", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,2:1:44-2:17:60", + "value": [ + { + "string": "target-arrowhead", + "raw_string": "target-arrowhead" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,2:18:61-2:23:66", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,2:25:68-2:32:75", + "value": [ + { + "string": "diamond", + "raw_string": "diamond" + } + ] + } + } + } + } + }, + { + "string": { + "range": "TestCompile/filters/edge.d2,8:19:154-8:24:159", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/edge.d2,8:2:137-8:24:159", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,8:2:137-8:18:153", + "value": [ + { + "string": "target-arrowhead", + "raw_string": "target-arrowhead" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,8:19:154-8:24:159", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/filters/edge.d2,8:1:136-8:33:168", + "ampersand": true, + "key": { + "range": "TestCompile/filters/edge.d2,8:2:137-8:24:159", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,8:2:137-8:18:153", + "value": [ + { + "string": "target-arrowhead", + "raw_string": "target-arrowhead" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,8:19:154-8:24:159", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,8:26:161-8:33:168", + "value": [ + { + "string": "diamond", + "raw_string": "diamond" + } + ] + } + } + } + } + } + ] + } + ], + "edges": null + }, + "references": [ + { + "string": { + "range": "TestCompile/filters/edge.d2,2:1:44-2:17:60", + "value": [ + { + "string": "target-arrowhead", + "raw_string": "target-arrowhead" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/edge.d2,2:1:44-2:23:66", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,2:1:44-2:17:60", + "value": [ + { + "string": "target-arrowhead", + "raw_string": "target-arrowhead" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,2:18:61-2:23:66", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/filters/edge.d2,2:1:44-2:32:75", + "key": { + "range": "TestCompile/filters/edge.d2,2:1:44-2:23:66", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,2:1:44-2:17:60", + "value": [ + { + "string": "target-arrowhead", + "raw_string": "target-arrowhead" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,2:18:61-2:23:66", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,2:25:68-2:32:75", + "value": [ + { + "string": "diamond", + "raw_string": "diamond" + } + ] + } + } + } + } + }, + { + "string": { + "range": "TestCompile/filters/edge.d2,8:2:137-8:18:153", + "value": [ + { + "string": "target-arrowhead", + "raw_string": "target-arrowhead" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/edge.d2,8:2:137-8:24:159", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,8:2:137-8:18:153", + "value": [ + { + "string": "target-arrowhead", + "raw_string": "target-arrowhead" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,8:19:154-8:24:159", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/filters/edge.d2,8:1:136-8:33:168", + "ampersand": true, + "key": { + "range": "TestCompile/filters/edge.d2,8:2:137-8:24:159", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,8:2:137-8:18:153", + "value": [ + { + "string": "target-arrowhead", + "raw_string": "target-arrowhead" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,8:19:154-8:24:159", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,8:26:161-8:33:168", + "value": [ + { + "string": "diamond", + "raw_string": "diamond" + } + ] + } + } + } + } + } + ] + }, + { + "name": "label", + "primary": { + "value": { + "range": "TestCompile/filters/edge.d2,9:8:177-9:32:201", + "value": [ + { + "string": "diamond shape arrowheads", + "raw_string": "diamond shape arrowheads" + } + ] + } + }, + "references": [ + { + "string": { + "range": "TestCompile/filters/edge.d2,9:1:170-9:6:175", + "value": [ + { + "string": "label", + "raw_string": "label" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/edge.d2,9:1:170-9:6:175", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,9:1:170-9:6:175", + "value": [ + { + "string": "label", + "raw_string": "label" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/filters/edge.d2,9:1:170-9:32:201", + "key": { + "range": "TestCompile/filters/edge.d2,9:1:170-9:6:175", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,9:1:170-9:6:175", + "value": [ + { + "string": "label", + "raw_string": "label" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,9:8:177-9:32:201", + "value": [ + { + "string": "diamond shape arrowheads", + "raw_string": "diamond shape arrowheads" + } + ] + } + } + } + } + } + ] + } + ], + "edges": null + }, + "references": [ + { + "context": { + "edge": { + "range": "TestCompile/filters/edge.d2,0:0:0-0:6:6", + "src": { + "range": "TestCompile/filters/edge.d2,0:0:0-0:1:1", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,0:0:0-0:1:1", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "src_arrow": "", + "dst": { + "range": "TestCompile/filters/edge.d2,0:5:5-0:6:6", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,0:5:5-0:6:6", + "value": [ + { + "string": "y", + "raw_string": "y" + } + ] + } + } + ] + }, + "dst_arrow": ">" + }, + "key": { + "range": "TestCompile/filters/edge.d2,0:0:0-3:1:77", + "edges": [ + { + "range": "TestCompile/filters/edge.d2,0:0:0-0:6:6", + "src": { + "range": "TestCompile/filters/edge.d2,0:0:0-0:1:1", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,0:0:0-0:1:1", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "src_arrow": "", + "dst": { + "range": "TestCompile/filters/edge.d2,0:5:5-0:6:6", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,0:5:5-0:6:6", + "value": [ + { + "string": "y", + "raw_string": "y" + } + ] + } + } + ] + }, + "dst_arrow": ">" + } + ], + "primary": {}, + "value": { + "map": { + "range": "TestCompile/filters/edge.d2,0:8:8-3:1:77", + "nodes": [ + { + "map_key": { + "range": "TestCompile/filters/edge.d2,1:1:11-1:32:42", + "key": { + "range": "TestCompile/filters/edge.d2,1:1:11-1:23:33", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,1:1:11-1:17:27", + "value": [ + { + "string": "source-arrowhead", + "raw_string": "source-arrowhead" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,1:18:28-1:23:33", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,1:25:35-1:32:42", + "value": [ + { + "string": "diamond", + "raw_string": "diamond" + } + ] + } + } + } + }, + { + "map_key": { + "range": "TestCompile/filters/edge.d2,2:1:44-2:32:75", + "key": { + "range": "TestCompile/filters/edge.d2,2:1:44-2:23:66", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,2:1:44-2:17:60", + "value": [ + { + "string": "target-arrowhead", + "raw_string": "target-arrowhead" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,2:18:61-2:23:66", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,2:25:68-2:32:75", + "value": [ + { + "string": "diamond", + "raw_string": "diamond" + } + ] + } + } + } + } + ] + } + } + } + } + }, + { + "context": { + "edge": { + "range": "TestCompile/filters/edge.d2,6:1:87-6:7:93", + "src": { + "range": "TestCompile/filters/edge.d2,6:1:87-6:2:88", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,6:1:87-6:2:88", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "src_arrow": "", + "dst": { + "range": "TestCompile/filters/edge.d2,6:6:92-6:7:93", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,6:6:92-6:7:93", + "value": [ + { + "string": "*", + "raw_string": "*" + } + ], + "pattern": [ + "*" + ] + } + } + ] + }, + "dst_arrow": ">" + }, + "key": { + "range": "TestCompile/filters/edge.d2,6:0:86-10:1:203", + "edges": [ + { + "range": "TestCompile/filters/edge.d2,6:1:87-6:7:93", + "src": { + "range": "TestCompile/filters/edge.d2,6:1:87-6:2:88", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,6:1:87-6:2:88", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "src_arrow": "", + "dst": { + "range": "TestCompile/filters/edge.d2,6:6:92-6:7:93", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,6:6:92-6:7:93", + "value": [ + { + "string": "*", + "raw_string": "*" + } + ], + "pattern": [ + "*" + ] + } + } + ] + }, + "dst_arrow": ">" + } + ], + "edge_index": { + "range": "TestCompile/filters/edge.d2,6:8:94-6:11:97", + "int": null, + "glob": true + }, + "primary": {}, + "value": { + "map": { + "range": "TestCompile/filters/edge.d2,6:13:99-10:1:203", + "nodes": [ + { + "map_key": { + "range": "TestCompile/filters/edge.d2,7:1:102-7:33:134", + "ampersand": true, + "key": { + "range": "TestCompile/filters/edge.d2,7:2:103-7:24:125", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,7:2:103-7:18:119", + "value": [ + { + "string": "source-arrowhead", + "raw_string": "source-arrowhead" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,7:19:120-7:24:125", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,7:26:127-7:33:134", + "value": [ + { + "string": "diamond", + "raw_string": "diamond" + } + ] + } + } + } + }, + { + "map_key": { + "range": "TestCompile/filters/edge.d2,8:1:136-8:33:168", + "ampersand": true, + "key": { + "range": "TestCompile/filters/edge.d2,8:2:137-8:24:159", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,8:2:137-8:18:153", + "value": [ + { + "string": "target-arrowhead", + "raw_string": "target-arrowhead" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,8:19:154-8:24:159", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,8:26:161-8:33:168", + "value": [ + { + "string": "diamond", + "raw_string": "diamond" + } + ] + } + } + } + }, + { + "map_key": { + "range": "TestCompile/filters/edge.d2,9:1:170-9:32:201", + "key": { + "range": "TestCompile/filters/edge.d2,9:1:170-9:6:175", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,9:1:170-9:6:175", + "value": [ + { + "string": "label", + "raw_string": "label" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,9:8:177-9:32:201", + "value": [ + { + "string": "diamond shape arrowheads", + "raw_string": "diamond shape arrowheads" + } + ] + } + } + } + } + ] + } + } + } + } + } + ] + }, + { + "edge_id": { + "src_path": [ + "x" + ], + "src_arrow": false, + "dst_path": [ + "y" + ], + "dst_arrow": true, + "index": 1, + "glob": false + }, + "map": { + "fields": null, + "edges": null + }, + "references": [ + { + "context": { + "edge": { + "range": "TestCompile/filters/edge.d2,4:0:78-4:6:84", + "src": { + "range": "TestCompile/filters/edge.d2,4:0:78-4:1:79", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,4:0:78-4:1:79", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "src_arrow": "", + "dst": { + "range": "TestCompile/filters/edge.d2,4:5:83-4:6:84", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,4:5:83-4:6:84", + "value": [ + { + "string": "y", + "raw_string": "y" + } + ] + } + } + ] + }, + "dst_arrow": ">" + }, + "key": { + "range": "TestCompile/filters/edge.d2,4:0:78-4:6:84", + "edges": [ + { + "range": "TestCompile/filters/edge.d2,4:0:78-4:6:84", + "src": { + "range": "TestCompile/filters/edge.d2,4:0:78-4:1:79", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,4:0:78-4:1:79", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "src_arrow": "", + "dst": { + "range": "TestCompile/filters/edge.d2,4:5:83-4:6:84", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,4:5:83-4:6:84", + "value": [ + { + "string": "y", + "raw_string": "y" + } + ] + } + } + ] + }, + "dst_arrow": ">" + } + ], + "primary": {}, + "value": {} + } + } + }, + { + "context": { + "edge": { + "range": "TestCompile/filters/edge.d2,6:1:87-6:7:93", + "src": { + "range": "TestCompile/filters/edge.d2,6:1:87-6:2:88", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,6:1:87-6:2:88", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "src_arrow": "", + "dst": { + "range": "TestCompile/filters/edge.d2,6:6:92-6:7:93", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,6:6:92-6:7:93", + "value": [ + { + "string": "*", + "raw_string": "*" + } + ], + "pattern": [ + "*" + ] + } + } + ] + }, + "dst_arrow": ">" + }, + "key": { + "range": "TestCompile/filters/edge.d2,6:0:86-10:1:203", + "edges": [ + { + "range": "TestCompile/filters/edge.d2,6:1:87-6:7:93", + "src": { + "range": "TestCompile/filters/edge.d2,6:1:87-6:2:88", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,6:1:87-6:2:88", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "src_arrow": "", + "dst": { + "range": "TestCompile/filters/edge.d2,6:6:92-6:7:93", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,6:6:92-6:7:93", + "value": [ + { + "string": "*", + "raw_string": "*" + } + ], + "pattern": [ + "*" + ] + } + } + ] + }, + "dst_arrow": ">" + } + ], + "edge_index": { + "range": "TestCompile/filters/edge.d2,6:8:94-6:11:97", + "int": null, + "glob": true + }, + "primary": {}, + "value": { + "map": { + "range": "TestCompile/filters/edge.d2,6:13:99-10:1:203", + "nodes": [ + { + "map_key": { + "range": "TestCompile/filters/edge.d2,7:1:102-7:33:134", + "ampersand": true, + "key": { + "range": "TestCompile/filters/edge.d2,7:2:103-7:24:125", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,7:2:103-7:18:119", + "value": [ + { + "string": "source-arrowhead", + "raw_string": "source-arrowhead" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,7:19:120-7:24:125", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,7:26:127-7:33:134", + "value": [ + { + "string": "diamond", + "raw_string": "diamond" + } + ] + } + } + } + }, + { + "map_key": { + "range": "TestCompile/filters/edge.d2,8:1:136-8:33:168", + "ampersand": true, + "key": { + "range": "TestCompile/filters/edge.d2,8:2:137-8:24:159", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,8:2:137-8:18:153", + "value": [ + { + "string": "target-arrowhead", + "raw_string": "target-arrowhead" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,8:19:154-8:24:159", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,8:26:161-8:33:168", + "value": [ + { + "string": "diamond", + "raw_string": "diamond" + } + ] + } + } + } + }, + { + "map_key": { + "range": "TestCompile/filters/edge.d2,9:1:170-9:32:201", + "key": { + "range": "TestCompile/filters/edge.d2,9:1:170-9:6:175", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,9:1:170-9:6:175", + "value": [ + { + "string": "label", + "raw_string": "label" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/edge.d2,9:8:177-9:32:201", + "value": [ + { + "string": "diamond shape arrowheads", + "raw_string": "diamond shape arrowheads" + } + ] + } + } + } + } + ] + } + } + } + } + } + ] + } + ] +} diff --git a/testdata/d2ir/TestCompile/filters/errors/bad-syntax.exp.json b/testdata/d2ir/TestCompile/filters/errors/bad-syntax.exp.json new file mode 100644 index 000000000..a91868c61 --- /dev/null +++ b/testdata/d2ir/TestCompile/filters/errors/bad-syntax.exp.json @@ -0,0 +1,749 @@ +{ + "fields": [ + { + "name": "jacob", + "composite": { + "fields": [ + { + "name": "style", + "composite": { + "fields": [ + { + "name": "fill", + "primary": { + "value": { + "range": "TestCompile/filters/errors/bad-syntax.d2,1:7:22-1:10:25", + "value": [ + { + "string": "red", + "raw_string": "red" + } + ] + } + }, + "references": [ + { + "string": { + "range": "TestCompile/filters/errors/bad-syntax.d2,1:1:16-1:5:20", + "value": [ + { + "string": "fill", + "raw_string": "fill" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/errors/bad-syntax.d2,1:1:16-1:5:20", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/errors/bad-syntax.d2,1:1:16-1:5:20", + "value": [ + { + "string": "fill", + "raw_string": "fill" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/filters/errors/bad-syntax.d2,1:1:16-1:10:25", + "key": { + "range": "TestCompile/filters/errors/bad-syntax.d2,1:1:16-1:5:20", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/errors/bad-syntax.d2,1:1:16-1:5:20", + "value": [ + { + "string": "fill", + "raw_string": "fill" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/errors/bad-syntax.d2,1:7:22-1:10:25", + "value": [ + { + "string": "red", + "raw_string": "red" + } + ] + } + } + } + } + } + ] + }, + { + "name": "multiple", + "primary": { + "value": { + "range": "TestCompile/filters/errors/bad-syntax.d2,2:11:37-2:15:41", + "value": true + } + }, + "references": [ + { + "string": { + "range": "TestCompile/filters/errors/bad-syntax.d2,2:1:27-2:9:35", + "value": [ + { + "string": "multiple", + "raw_string": "multiple" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/errors/bad-syntax.d2,2:1:27-2:9:35", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/errors/bad-syntax.d2,2:1:27-2:9:35", + "value": [ + { + "string": "multiple", + "raw_string": "multiple" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/filters/errors/bad-syntax.d2,2:1:27-2:15:41", + "key": { + "range": "TestCompile/filters/errors/bad-syntax.d2,2:1:27-2:9:35", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/errors/bad-syntax.d2,2:1:27-2:9:35", + "value": [ + { + "string": "multiple", + "raw_string": "multiple" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "boolean": { + "range": "TestCompile/filters/errors/bad-syntax.d2,2:11:37-2:15:41", + "value": true + } + } + } + } + } + ] + } + ], + "edges": null + }, + "references": [ + { + "string": { + "range": "TestCompile/filters/errors/bad-syntax.d2,0:6:6-0:11:11", + "value": [ + { + "string": "style", + "raw_string": "style" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/errors/bad-syntax.d2,0:0:0-0:11:11", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/errors/bad-syntax.d2,0:0:0-0:5:5", + "value": [ + { + "string": "jacob", + "raw_string": "jacob" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/filters/errors/bad-syntax.d2,0:6:6-0:11:11", + "value": [ + { + "string": "style", + "raw_string": "style" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/filters/errors/bad-syntax.d2,0:0:0-3:1:43", + "key": { + "range": "TestCompile/filters/errors/bad-syntax.d2,0:0:0-0:11:11", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/errors/bad-syntax.d2,0:0:0-0:5:5", + "value": [ + { + "string": "jacob", + "raw_string": "jacob" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/filters/errors/bad-syntax.d2,0:6:6-0:11:11", + "value": [ + { + "string": "style", + "raw_string": "style" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "TestCompile/filters/errors/bad-syntax.d2,0:13:13-3:1:43", + "nodes": [ + { + "map_key": { + "range": "TestCompile/filters/errors/bad-syntax.d2,1:1:16-1:10:25", + "key": { + "range": "TestCompile/filters/errors/bad-syntax.d2,1:1:16-1:5:20", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/errors/bad-syntax.d2,1:1:16-1:5:20", + "value": [ + { + "string": "fill", + "raw_string": "fill" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/errors/bad-syntax.d2,1:7:22-1:10:25", + "value": [ + { + "string": "red", + "raw_string": "red" + } + ] + } + } + } + }, + { + "map_key": { + "range": "TestCompile/filters/errors/bad-syntax.d2,2:1:27-2:15:41", + "key": { + "range": "TestCompile/filters/errors/bad-syntax.d2,2:1:27-2:9:35", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/errors/bad-syntax.d2,2:1:27-2:9:35", + "value": [ + { + "string": "multiple", + "raw_string": "multiple" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "boolean": { + "range": "TestCompile/filters/errors/bad-syntax.d2,2:11:37-2:15:41", + "value": true + } + } + } + } + ] + } + } + } + } + } + ] + }, + { + "name": "&style", + "composite": { + "fields": [ + { + "name": "fill", + "primary": { + "value": { + "range": "TestCompile/filters/errors/bad-syntax.d2,6:8:65-6:11:68", + "value": [ + { + "string": "red", + "raw_string": "red" + } + ] + } + }, + "references": [ + { + "string": { + "range": "TestCompile/filters/errors/bad-syntax.d2,6:2:59-6:6:63", + "value": [ + { + "string": "fill", + "raw_string": "fill" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/errors/bad-syntax.d2,6:2:59-6:6:63", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/errors/bad-syntax.d2,6:2:59-6:6:63", + "value": [ + { + "string": "fill", + "raw_string": "fill" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/filters/errors/bad-syntax.d2,6:2:59-6:11:68", + "key": { + "range": "TestCompile/filters/errors/bad-syntax.d2,6:2:59-6:6:63", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/errors/bad-syntax.d2,6:2:59-6:6:63", + "value": [ + { + "string": "fill", + "raw_string": "fill" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/errors/bad-syntax.d2,6:8:65-6:11:68", + "value": [ + { + "string": "red", + "raw_string": "red" + } + ] + } + } + } + } + } + ] + }, + { + "name": "multiple", + "primary": { + "value": { + "range": "TestCompile/filters/errors/bad-syntax.d2,7:12:81-7:16:85", + "value": true + } + }, + "references": [ + { + "string": { + "range": "TestCompile/filters/errors/bad-syntax.d2,7:2:71-7:10:79", + "value": [ + { + "string": "multiple", + "raw_string": "multiple" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/errors/bad-syntax.d2,7:2:71-7:10:79", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/errors/bad-syntax.d2,7:2:71-7:10:79", + "value": [ + { + "string": "multiple", + "raw_string": "multiple" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/filters/errors/bad-syntax.d2,7:2:71-7:16:85", + "key": { + "range": "TestCompile/filters/errors/bad-syntax.d2,7:2:71-7:10:79", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/errors/bad-syntax.d2,7:2:71-7:10:79", + "value": [ + { + "string": "multiple", + "raw_string": "multiple" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "boolean": { + "range": "TestCompile/filters/errors/bad-syntax.d2,7:12:81-7:16:85", + "value": true + } + } + } + } + } + ] + } + ], + "edges": null + }, + "references": [ + { + "string": { + "range": "TestCompile/filters/errors/bad-syntax.d2,5:2:47-5:8:53", + "value": [ + { + "string": "&style", + "raw_string": "&style" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/errors/bad-syntax.d2,5:0:45-5:8:53", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/errors/bad-syntax.d2,5:0:45-5:1:46", + "value": [ + { + "string": "*", + "raw_string": "*" + } + ], + "pattern": [ + "*" + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/filters/errors/bad-syntax.d2,5:2:47-5:8:53", + "value": [ + { + "string": "&style", + "raw_string": "&style" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/filters/errors/bad-syntax.d2,5:0:45-8:1:87", + "key": { + "range": "TestCompile/filters/errors/bad-syntax.d2,5:0:45-5:8:53", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/errors/bad-syntax.d2,5:0:45-5:1:46", + "value": [ + { + "string": "*", + "raw_string": "*" + } + ], + "pattern": [ + "*" + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/filters/errors/bad-syntax.d2,5:2:47-5:8:53", + "value": [ + { + "string": "&style", + "raw_string": "&style" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "TestCompile/filters/errors/bad-syntax.d2,5:10:55-8:1:87", + "nodes": [ + { + "map_key": { + "range": "TestCompile/filters/errors/bad-syntax.d2,6:2:59-6:11:68", + "key": { + "range": "TestCompile/filters/errors/bad-syntax.d2,6:2:59-6:6:63", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/errors/bad-syntax.d2,6:2:59-6:6:63", + "value": [ + { + "string": "fill", + "raw_string": "fill" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/errors/bad-syntax.d2,6:8:65-6:11:68", + "value": [ + { + "string": "red", + "raw_string": "red" + } + ] + } + } + } + }, + { + "map_key": { + "range": "TestCompile/filters/errors/bad-syntax.d2,7:2:71-7:16:85", + "key": { + "range": "TestCompile/filters/errors/bad-syntax.d2,7:2:71-7:10:79", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/errors/bad-syntax.d2,7:2:71-7:10:79", + "value": [ + { + "string": "multiple", + "raw_string": "multiple" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "boolean": { + "range": "TestCompile/filters/errors/bad-syntax.d2,7:12:81-7:16:85", + "value": true + } + } + } + } + ] + } + } + } + } + } + ] + } + ], + "edges": null + }, + "references": [ + { + "string": { + "range": "TestCompile/filters/errors/bad-syntax.d2,0:0:0-0:5:5", + "value": [ + { + "string": "jacob", + "raw_string": "jacob" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/errors/bad-syntax.d2,0:0:0-0:11:11", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/errors/bad-syntax.d2,0:0:0-0:5:5", + "value": [ + { + "string": "jacob", + "raw_string": "jacob" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/filters/errors/bad-syntax.d2,0:6:6-0:11:11", + "value": [ + { + "string": "style", + "raw_string": "style" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/filters/errors/bad-syntax.d2,0:0:0-3:1:43", + "key": { + "range": "TestCompile/filters/errors/bad-syntax.d2,0:0:0-0:11:11", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/errors/bad-syntax.d2,0:0:0-0:5:5", + "value": [ + { + "string": "jacob", + "raw_string": "jacob" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/filters/errors/bad-syntax.d2,0:6:6-0:11:11", + "value": [ + { + "string": "style", + "raw_string": "style" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "TestCompile/filters/errors/bad-syntax.d2,0:13:13-3:1:43", + "nodes": [ + { + "map_key": { + "range": "TestCompile/filters/errors/bad-syntax.d2,1:1:16-1:10:25", + "key": { + "range": "TestCompile/filters/errors/bad-syntax.d2,1:1:16-1:5:20", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/errors/bad-syntax.d2,1:1:16-1:5:20", + "value": [ + { + "string": "fill", + "raw_string": "fill" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/errors/bad-syntax.d2,1:7:22-1:10:25", + "value": [ + { + "string": "red", + "raw_string": "red" + } + ] + } + } + } + }, + { + "map_key": { + "range": "TestCompile/filters/errors/bad-syntax.d2,2:1:27-2:15:41", + "key": { + "range": "TestCompile/filters/errors/bad-syntax.d2,2:1:27-2:9:35", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/errors/bad-syntax.d2,2:1:27-2:9:35", + "value": [ + { + "string": "multiple", + "raw_string": "multiple" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "boolean": { + "range": "TestCompile/filters/errors/bad-syntax.d2,2:11:37-2:15:41", + "value": true + } + } + } + } + ] + } + } + } + } + } + ] + } + ], + "edges": null +} diff --git a/testdata/d2ir/TestCompile/filters/errors/composite.exp.json b/testdata/d2ir/TestCompile/filters/errors/composite.exp.json new file mode 100644 index 000000000..8aa7bec36 --- /dev/null +++ b/testdata/d2ir/TestCompile/filters/errors/composite.exp.json @@ -0,0 +1,449 @@ +{ + "fields": [ + { + "name": "jacob", + "composite": { + "fields": [ + { + "name": "style", + "composite": { + "fields": [ + { + "name": "fill", + "primary": { + "value": { + "range": "TestCompile/filters/errors/composite.d2,8:7:73-8:10:76", + "value": [ + { + "string": "red", + "raw_string": "red" + } + ] + } + }, + "references": [ + { + "string": { + "range": "TestCompile/filters/errors/composite.d2,8:1:67-8:5:71", + "value": [ + { + "string": "fill", + "raw_string": "fill" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/errors/composite.d2,8:1:67-8:5:71", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/errors/composite.d2,8:1:67-8:5:71", + "value": [ + { + "string": "fill", + "raw_string": "fill" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/filters/errors/composite.d2,8:1:67-8:10:76", + "key": { + "range": "TestCompile/filters/errors/composite.d2,8:1:67-8:5:71", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/errors/composite.d2,8:1:67-8:5:71", + "value": [ + { + "string": "fill", + "raw_string": "fill" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/errors/composite.d2,8:7:73-8:10:76", + "value": [ + { + "string": "red", + "raw_string": "red" + } + ] + } + } + } + } + } + ] + }, + { + "name": "multiple", + "primary": { + "value": { + "range": "TestCompile/filters/errors/composite.d2,9:11:88-9:15:92", + "value": true + } + }, + "references": [ + { + "string": { + "range": "TestCompile/filters/errors/composite.d2,9:1:78-9:9:86", + "value": [ + { + "string": "multiple", + "raw_string": "multiple" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/errors/composite.d2,9:1:78-9:9:86", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/errors/composite.d2,9:1:78-9:9:86", + "value": [ + { + "string": "multiple", + "raw_string": "multiple" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/filters/errors/composite.d2,9:1:78-9:15:92", + "key": { + "range": "TestCompile/filters/errors/composite.d2,9:1:78-9:9:86", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/errors/composite.d2,9:1:78-9:9:86", + "value": [ + { + "string": "multiple", + "raw_string": "multiple" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "boolean": { + "range": "TestCompile/filters/errors/composite.d2,9:11:88-9:15:92", + "value": true + } + } + } + } + } + ] + } + ], + "edges": null + }, + "references": [ + { + "string": { + "range": "TestCompile/filters/errors/composite.d2,7:6:57-7:11:62", + "value": [ + { + "string": "style", + "raw_string": "style" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/errors/composite.d2,7:0:51-7:11:62", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/errors/composite.d2,7:0:51-7:5:56", + "value": [ + { + "string": "jacob", + "raw_string": "jacob" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/filters/errors/composite.d2,7:6:57-7:11:62", + "value": [ + { + "string": "style", + "raw_string": "style" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/filters/errors/composite.d2,7:0:51-10:1:94", + "key": { + "range": "TestCompile/filters/errors/composite.d2,7:0:51-7:11:62", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/errors/composite.d2,7:0:51-7:5:56", + "value": [ + { + "string": "jacob", + "raw_string": "jacob" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/filters/errors/composite.d2,7:6:57-7:11:62", + "value": [ + { + "string": "style", + "raw_string": "style" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "TestCompile/filters/errors/composite.d2,7:13:64-10:1:94", + "nodes": [ + { + "map_key": { + "range": "TestCompile/filters/errors/composite.d2,8:1:67-8:10:76", + "key": { + "range": "TestCompile/filters/errors/composite.d2,8:1:67-8:5:71", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/errors/composite.d2,8:1:67-8:5:71", + "value": [ + { + "string": "fill", + "raw_string": "fill" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/errors/composite.d2,8:7:73-8:10:76", + "value": [ + { + "string": "red", + "raw_string": "red" + } + ] + } + } + } + }, + { + "map_key": { + "range": "TestCompile/filters/errors/composite.d2,9:1:78-9:15:92", + "key": { + "range": "TestCompile/filters/errors/composite.d2,9:1:78-9:9:86", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/errors/composite.d2,9:1:78-9:9:86", + "value": [ + { + "string": "multiple", + "raw_string": "multiple" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "boolean": { + "range": "TestCompile/filters/errors/composite.d2,9:11:88-9:15:92", + "value": true + } + } + } + } + ] + } + } + } + } + } + ] + } + ], + "edges": null + }, + "references": [ + { + "string": { + "range": "TestCompile/filters/errors/composite.d2,7:0:51-7:5:56", + "value": [ + { + "string": "jacob", + "raw_string": "jacob" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/errors/composite.d2,7:0:51-7:11:62", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/errors/composite.d2,7:0:51-7:5:56", + "value": [ + { + "string": "jacob", + "raw_string": "jacob" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/filters/errors/composite.d2,7:6:57-7:11:62", + "value": [ + { + "string": "style", + "raw_string": "style" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/filters/errors/composite.d2,7:0:51-10:1:94", + "key": { + "range": "TestCompile/filters/errors/composite.d2,7:0:51-7:11:62", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/errors/composite.d2,7:0:51-7:5:56", + "value": [ + { + "string": "jacob", + "raw_string": "jacob" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/filters/errors/composite.d2,7:6:57-7:11:62", + "value": [ + { + "string": "style", + "raw_string": "style" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "TestCompile/filters/errors/composite.d2,7:13:64-10:1:94", + "nodes": [ + { + "map_key": { + "range": "TestCompile/filters/errors/composite.d2,8:1:67-8:10:76", + "key": { + "range": "TestCompile/filters/errors/composite.d2,8:1:67-8:5:71", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/errors/composite.d2,8:1:67-8:5:71", + "value": [ + { + "string": "fill", + "raw_string": "fill" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/errors/composite.d2,8:7:73-8:10:76", + "value": [ + { + "string": "red", + "raw_string": "red" + } + ] + } + } + } + }, + { + "map_key": { + "range": "TestCompile/filters/errors/composite.d2,9:1:78-9:15:92", + "key": { + "range": "TestCompile/filters/errors/composite.d2,9:1:78-9:9:86", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/errors/composite.d2,9:1:78-9:9:86", + "value": [ + { + "string": "multiple", + "raw_string": "multiple" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "boolean": { + "range": "TestCompile/filters/errors/composite.d2,9:11:88-9:15:92", + "value": true + } + } + } + } + ] + } + } + } + } + } + ] + } + ], + "edges": null +} diff --git a/testdata/d2ir/TestCompile/filters/errors/no-glob.exp.json b/testdata/d2ir/TestCompile/filters/errors/no-glob.exp.json new file mode 100644 index 000000000..549e146b6 --- /dev/null +++ b/testdata/d2ir/TestCompile/filters/errors/no-glob.exp.json @@ -0,0 +1,750 @@ +{ + "fields": [ + { + "name": "jacob", + "composite": { + "fields": [ + { + "name": "style", + "composite": { + "fields": [ + { + "name": "fill", + "primary": { + "value": { + "range": "TestCompile/filters/errors/no-glob.d2,1:7:22-1:10:25", + "value": [ + { + "string": "red", + "raw_string": "red" + } + ] + } + }, + "references": [ + { + "string": { + "range": "TestCompile/filters/errors/no-glob.d2,1:1:16-1:5:20", + "value": [ + { + "string": "fill", + "raw_string": "fill" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/errors/no-glob.d2,1:1:16-1:5:20", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/errors/no-glob.d2,1:1:16-1:5:20", + "value": [ + { + "string": "fill", + "raw_string": "fill" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/filters/errors/no-glob.d2,1:1:16-1:10:25", + "key": { + "range": "TestCompile/filters/errors/no-glob.d2,1:1:16-1:5:20", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/errors/no-glob.d2,1:1:16-1:5:20", + "value": [ + { + "string": "fill", + "raw_string": "fill" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/errors/no-glob.d2,1:7:22-1:10:25", + "value": [ + { + "string": "red", + "raw_string": "red" + } + ] + } + } + } + } + } + ] + }, + { + "name": "multiple", + "primary": { + "value": { + "range": "TestCompile/filters/errors/no-glob.d2,2:11:37-2:15:41", + "value": true + } + }, + "references": [ + { + "string": { + "range": "TestCompile/filters/errors/no-glob.d2,2:1:27-2:9:35", + "value": [ + { + "string": "multiple", + "raw_string": "multiple" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/errors/no-glob.d2,2:1:27-2:9:35", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/errors/no-glob.d2,2:1:27-2:9:35", + "value": [ + { + "string": "multiple", + "raw_string": "multiple" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/filters/errors/no-glob.d2,2:1:27-2:15:41", + "key": { + "range": "TestCompile/filters/errors/no-glob.d2,2:1:27-2:9:35", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/errors/no-glob.d2,2:1:27-2:9:35", + "value": [ + { + "string": "multiple", + "raw_string": "multiple" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "boolean": { + "range": "TestCompile/filters/errors/no-glob.d2,2:11:37-2:15:41", + "value": true + } + } + } + } + } + ] + } + ], + "edges": null + }, + "references": [ + { + "string": { + "range": "TestCompile/filters/errors/no-glob.d2,0:6:6-0:11:11", + "value": [ + { + "string": "style", + "raw_string": "style" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/errors/no-glob.d2,0:0:0-0:11:11", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/errors/no-glob.d2,0:0:0-0:5:5", + "value": [ + { + "string": "jacob", + "raw_string": "jacob" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/filters/errors/no-glob.d2,0:6:6-0:11:11", + "value": [ + { + "string": "style", + "raw_string": "style" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/filters/errors/no-glob.d2,0:0:0-3:1:43", + "key": { + "range": "TestCompile/filters/errors/no-glob.d2,0:0:0-0:11:11", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/errors/no-glob.d2,0:0:0-0:5:5", + "value": [ + { + "string": "jacob", + "raw_string": "jacob" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/filters/errors/no-glob.d2,0:6:6-0:11:11", + "value": [ + { + "string": "style", + "raw_string": "style" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "TestCompile/filters/errors/no-glob.d2,0:13:13-3:1:43", + "nodes": [ + { + "map_key": { + "range": "TestCompile/filters/errors/no-glob.d2,1:1:16-1:10:25", + "key": { + "range": "TestCompile/filters/errors/no-glob.d2,1:1:16-1:5:20", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/errors/no-glob.d2,1:1:16-1:5:20", + "value": [ + { + "string": "fill", + "raw_string": "fill" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/errors/no-glob.d2,1:7:22-1:10:25", + "value": [ + { + "string": "red", + "raw_string": "red" + } + ] + } + } + } + }, + { + "map_key": { + "range": "TestCompile/filters/errors/no-glob.d2,2:1:27-2:15:41", + "key": { + "range": "TestCompile/filters/errors/no-glob.d2,2:1:27-2:9:35", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/errors/no-glob.d2,2:1:27-2:9:35", + "value": [ + { + "string": "multiple", + "raw_string": "multiple" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "boolean": { + "range": "TestCompile/filters/errors/no-glob.d2,2:11:37-2:15:41", + "value": true + } + } + } + } + ] + } + } + } + } + } + ] + } + ], + "edges": null + }, + "references": [ + { + "string": { + "range": "TestCompile/filters/errors/no-glob.d2,0:0:0-0:5:5", + "value": [ + { + "string": "jacob", + "raw_string": "jacob" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/errors/no-glob.d2,0:0:0-0:11:11", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/errors/no-glob.d2,0:0:0-0:5:5", + "value": [ + { + "string": "jacob", + "raw_string": "jacob" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/filters/errors/no-glob.d2,0:6:6-0:11:11", + "value": [ + { + "string": "style", + "raw_string": "style" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/filters/errors/no-glob.d2,0:0:0-3:1:43", + "key": { + "range": "TestCompile/filters/errors/no-glob.d2,0:0:0-0:11:11", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/errors/no-glob.d2,0:0:0-0:5:5", + "value": [ + { + "string": "jacob", + "raw_string": "jacob" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/filters/errors/no-glob.d2,0:6:6-0:11:11", + "value": [ + { + "string": "style", + "raw_string": "style" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "TestCompile/filters/errors/no-glob.d2,0:13:13-3:1:43", + "nodes": [ + { + "map_key": { + "range": "TestCompile/filters/errors/no-glob.d2,1:1:16-1:10:25", + "key": { + "range": "TestCompile/filters/errors/no-glob.d2,1:1:16-1:5:20", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/errors/no-glob.d2,1:1:16-1:5:20", + "value": [ + { + "string": "fill", + "raw_string": "fill" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/errors/no-glob.d2,1:7:22-1:10:25", + "value": [ + { + "string": "red", + "raw_string": "red" + } + ] + } + } + } + }, + { + "map_key": { + "range": "TestCompile/filters/errors/no-glob.d2,2:1:27-2:15:41", + "key": { + "range": "TestCompile/filters/errors/no-glob.d2,2:1:27-2:9:35", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/errors/no-glob.d2,2:1:27-2:9:35", + "value": [ + { + "string": "multiple", + "raw_string": "multiple" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "boolean": { + "range": "TestCompile/filters/errors/no-glob.d2,2:11:37-2:15:41", + "value": true + } + } + } + } + ] + } + } + } + } + } + ] + }, + { + "name": "jasmine", + "composite": { + "fields": [ + { + "name": "style", + "composite": { + "fields": null, + "edges": null + }, + "references": [ + { + "string": { + "range": "TestCompile/filters/errors/no-glob.d2,5:8:53-5:13:58", + "value": [ + { + "string": "style", + "raw_string": "style" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/errors/no-glob.d2,5:0:45-5:13:58", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/errors/no-glob.d2,5:0:45-5:7:52", + "value": [ + { + "string": "jasmine", + "raw_string": "jasmine" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/filters/errors/no-glob.d2,5:8:53-5:13:58", + "value": [ + { + "string": "style", + "raw_string": "style" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/filters/errors/no-glob.d2,5:0:45-8:1:94", + "key": { + "range": "TestCompile/filters/errors/no-glob.d2,5:0:45-5:13:58", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/errors/no-glob.d2,5:0:45-5:7:52", + "value": [ + { + "string": "jasmine", + "raw_string": "jasmine" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/filters/errors/no-glob.d2,5:8:53-5:13:58", + "value": [ + { + "string": "style", + "raw_string": "style" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "TestCompile/filters/errors/no-glob.d2,5:15:60-8:1:94", + "nodes": [ + { + "map_key": { + "range": "TestCompile/filters/errors/no-glob.d2,6:2:64-6:12:74", + "ampersand": true, + "key": { + "range": "TestCompile/filters/errors/no-glob.d2,6:3:65-6:7:69", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/errors/no-glob.d2,6:3:65-6:7:69", + "value": [ + { + "string": "fill", + "raw_string": "fill" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/errors/no-glob.d2,6:9:71-6:12:74", + "value": [ + { + "string": "red", + "raw_string": "red" + } + ] + } + } + } + }, + { + "map_key": { + "range": "TestCompile/filters/errors/no-glob.d2,7:2:77-7:17:92", + "key": { + "range": "TestCompile/filters/errors/no-glob.d2,7:2:77-7:10:85", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/errors/no-glob.d2,7:2:77-7:10:85", + "value": [ + { + "string": "multiple", + "raw_string": "multiple" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "boolean": { + "range": "TestCompile/filters/errors/no-glob.d2,7:12:87-7:17:92", + "value": false + } + } + } + } + ] + } + } + } + } + } + ] + } + ], + "edges": null + }, + "references": [ + { + "string": { + "range": "TestCompile/filters/errors/no-glob.d2,5:0:45-5:7:52", + "value": [ + { + "string": "jasmine", + "raw_string": "jasmine" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/errors/no-glob.d2,5:0:45-5:13:58", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/errors/no-glob.d2,5:0:45-5:7:52", + "value": [ + { + "string": "jasmine", + "raw_string": "jasmine" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/filters/errors/no-glob.d2,5:8:53-5:13:58", + "value": [ + { + "string": "style", + "raw_string": "style" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/filters/errors/no-glob.d2,5:0:45-8:1:94", + "key": { + "range": "TestCompile/filters/errors/no-glob.d2,5:0:45-5:13:58", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/errors/no-glob.d2,5:0:45-5:7:52", + "value": [ + { + "string": "jasmine", + "raw_string": "jasmine" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/filters/errors/no-glob.d2,5:8:53-5:13:58", + "value": [ + { + "string": "style", + "raw_string": "style" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "TestCompile/filters/errors/no-glob.d2,5:15:60-8:1:94", + "nodes": [ + { + "map_key": { + "range": "TestCompile/filters/errors/no-glob.d2,6:2:64-6:12:74", + "ampersand": true, + "key": { + "range": "TestCompile/filters/errors/no-glob.d2,6:3:65-6:7:69", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/errors/no-glob.d2,6:3:65-6:7:69", + "value": [ + { + "string": "fill", + "raw_string": "fill" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/errors/no-glob.d2,6:9:71-6:12:74", + "value": [ + { + "string": "red", + "raw_string": "red" + } + ] + } + } + } + }, + { + "map_key": { + "range": "TestCompile/filters/errors/no-glob.d2,7:2:77-7:17:92", + "key": { + "range": "TestCompile/filters/errors/no-glob.d2,7:2:77-7:10:85", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/errors/no-glob.d2,7:2:77-7:10:85", + "value": [ + { + "string": "multiple", + "raw_string": "multiple" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "boolean": { + "range": "TestCompile/filters/errors/no-glob.d2,7:12:87-7:17:92", + "value": false + } + } + } + } + ] + } + } + } + } + } + ] + } + ], + "edges": null +} diff --git a/testdata/d2ir/TestCompile/filters/escaped.exp.json b/testdata/d2ir/TestCompile/filters/escaped.exp.json new file mode 100644 index 000000000..c6257902d --- /dev/null +++ b/testdata/d2ir/TestCompile/filters/escaped.exp.json @@ -0,0 +1,560 @@ +{ + "fields": [ + { + "name": "jacob", + "composite": { + "fields": [ + { + "name": "shape", + "primary": { + "value": { + "range": "TestCompile/filters/escaped.d2,1:8:17-1:14:23", + "value": [ + { + "string": "circle", + "raw_string": "circle" + } + ] + } + }, + "references": [ + { + "string": { + "range": "TestCompile/filters/escaped.d2,1:1:10-1:6:15", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/escaped.d2,1:1:10-1:6:15", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/escaped.d2,1:1:10-1:6:15", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/filters/escaped.d2,1:1:10-1:14:23", + "key": { + "range": "TestCompile/filters/escaped.d2,1:1:10-1:6:15", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/escaped.d2,1:1:10-1:6:15", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/escaped.d2,1:8:17-1:14:23", + "value": [ + { + "string": "circle", + "raw_string": "circle" + } + ] + } + } + } + } + }, + { + "string": { + "range": "TestCompile/filters/escaped.d2,7:2:63-7:7:68", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/escaped.d2,7:2:63-7:7:68", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/escaped.d2,7:2:63-7:7:68", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/filters/escaped.d2,7:1:62-7:18:79", + "ampersand": true, + "key": { + "range": "TestCompile/filters/escaped.d2,7:2:63-7:7:68", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/escaped.d2,7:2:63-7:7:68", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/escaped.d2,7:9:70-7:18:79", + "value": [ + { + "string": "rectangle", + "raw_string": "rectangle" + } + ] + } + } + } + } + } + ] + } + ], + "edges": null + }, + "references": [ + { + "string": { + "range": "TestCompile/filters/escaped.d2,0:0:0-0:5:5", + "value": [ + { + "string": "jacob", + "raw_string": "jacob" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/escaped.d2,0:0:0-0:5:5", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/escaped.d2,0:0:0-0:5:5", + "value": [ + { + "string": "jacob", + "raw_string": "jacob" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/filters/escaped.d2,0:0:0-2:1:25", + "key": { + "range": "TestCompile/filters/escaped.d2,0:0:0-0:5:5", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/escaped.d2,0:0:0-0:5:5", + "value": [ + { + "string": "jacob", + "raw_string": "jacob" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "TestCompile/filters/escaped.d2,0:7:7-2:1:25", + "nodes": [ + { + "map_key": { + "range": "TestCompile/filters/escaped.d2,1:1:10-1:14:23", + "key": { + "range": "TestCompile/filters/escaped.d2,1:1:10-1:6:15", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/escaped.d2,1:1:10-1:6:15", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/escaped.d2,1:8:17-1:14:23", + "value": [ + { + "string": "circle", + "raw_string": "circle" + } + ] + } + } + } + } + ] + } + } + } + } + } + ] + }, + { + "name": "jeremy", + "composite": { + "fields": [ + { + "name": "shape", + "primary": { + "value": { + "range": "TestCompile/filters/escaped.d2,7:9:70-7:18:79", + "value": [ + { + "string": "rectangle", + "raw_string": "rectangle" + } + ] + } + }, + "references": [ + { + "string": { + "range": "TestCompile/filters/escaped.d2,4:1:37-4:6:42", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/escaped.d2,4:1:37-4:6:42", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/escaped.d2,4:1:37-4:6:42", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/filters/escaped.d2,4:1:37-4:17:53", + "key": { + "range": "TestCompile/filters/escaped.d2,4:1:37-4:6:42", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/escaped.d2,4:1:37-4:6:42", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/escaped.d2,4:8:44-4:17:53", + "value": [ + { + "string": "rectangle", + "raw_string": "rectangle" + } + ] + } + } + } + } + }, + { + "string": { + "range": "TestCompile/filters/escaped.d2,7:2:63-7:7:68", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/escaped.d2,7:2:63-7:7:68", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/escaped.d2,7:2:63-7:7:68", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/filters/escaped.d2,7:1:62-7:18:79", + "ampersand": true, + "key": { + "range": "TestCompile/filters/escaped.d2,7:2:63-7:7:68", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/escaped.d2,7:2:63-7:7:68", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/escaped.d2,7:9:70-7:18:79", + "value": [ + { + "string": "rectangle", + "raw_string": "rectangle" + } + ] + } + } + } + } + } + ] + }, + { + "name": "label", + "primary": { + "value": { + "range": "TestCompile/filters/escaped.d2,8:8:88-8:23:103", + "value": [ + { + "string": "I'm a rectangle", + "raw_string": "I'm a rectangle" + } + ] + } + }, + "references": [ + { + "string": { + "range": "TestCompile/filters/escaped.d2,8:1:81-8:6:86", + "value": [ + { + "string": "label", + "raw_string": "label" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/escaped.d2,8:1:81-8:6:86", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/escaped.d2,8:1:81-8:6:86", + "value": [ + { + "string": "label", + "raw_string": "label" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/filters/escaped.d2,8:1:81-8:23:103", + "key": { + "range": "TestCompile/filters/escaped.d2,8:1:81-8:6:86", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/escaped.d2,8:1:81-8:6:86", + "value": [ + { + "string": "label", + "raw_string": "label" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/escaped.d2,8:8:88-8:23:103", + "value": [ + { + "string": "I'm a rectangle", + "raw_string": "I'm a rectangle" + } + ] + } + } + } + } + } + ] + } + ], + "edges": null + }, + "references": [ + { + "string": { + "range": "TestCompile/filters/escaped.d2,3:0:26-3:6:32", + "value": [ + { + "string": "jeremy", + "raw_string": "jeremy" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/escaped.d2,3:0:26-3:6:32", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/escaped.d2,3:0:26-3:6:32", + "value": [ + { + "string": "jeremy", + "raw_string": "jeremy" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/filters/escaped.d2,3:0:26-5:1:55", + "key": { + "range": "TestCompile/filters/escaped.d2,3:0:26-3:6:32", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/escaped.d2,3:0:26-3:6:32", + "value": [ + { + "string": "jeremy", + "raw_string": "jeremy" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "TestCompile/filters/escaped.d2,3:8:34-5:1:55", + "nodes": [ + { + "map_key": { + "range": "TestCompile/filters/escaped.d2,4:1:37-4:17:53", + "key": { + "range": "TestCompile/filters/escaped.d2,4:1:37-4:6:42", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/escaped.d2,4:1:37-4:6:42", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/escaped.d2,4:8:44-4:17:53", + "value": [ + { + "string": "rectangle", + "raw_string": "rectangle" + } + ] + } + } + } + } + ] + } + } + } + } + } + ] + } + ], + "edges": null +} diff --git a/testdata/d2ir/TestCompile/filters/order.exp.json b/testdata/d2ir/TestCompile/filters/order.exp.json new file mode 100644 index 000000000..d7a77a374 --- /dev/null +++ b/testdata/d2ir/TestCompile/filters/order.exp.json @@ -0,0 +1,560 @@ +{ + "fields": [ + { + "name": "jacob", + "composite": { + "fields": [ + { + "name": "shape", + "primary": { + "value": { + "range": "TestCompile/filters/order.d2,1:8:17-1:14:23", + "value": [ + { + "string": "circle", + "raw_string": "circle" + } + ] + } + }, + "references": [ + { + "string": { + "range": "TestCompile/filters/order.d2,1:1:10-1:6:15", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/order.d2,1:1:10-1:6:15", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/order.d2,1:1:10-1:6:15", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/filters/order.d2,1:1:10-1:14:23", + "key": { + "range": "TestCompile/filters/order.d2,1:1:10-1:6:15", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/order.d2,1:1:10-1:6:15", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/order.d2,1:8:17-1:14:23", + "value": [ + { + "string": "circle", + "raw_string": "circle" + } + ] + } + } + } + } + }, + { + "string": { + "range": "TestCompile/filters/order.d2,8:2:87-8:7:92", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/order.d2,8:2:87-8:7:92", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/order.d2,8:2:87-8:7:92", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/filters/order.d2,8:1:86-8:18:103", + "ampersand": true, + "key": { + "range": "TestCompile/filters/order.d2,8:2:87-8:7:92", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/order.d2,8:2:87-8:7:92", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/order.d2,8:9:94-8:18:103", + "value": [ + { + "string": "rectangle", + "raw_string": "rectangle" + } + ] + } + } + } + } + } + ] + } + ], + "edges": null + }, + "references": [ + { + "string": { + "range": "TestCompile/filters/order.d2,0:0:0-0:5:5", + "value": [ + { + "string": "jacob", + "raw_string": "jacob" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/order.d2,0:0:0-0:5:5", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/order.d2,0:0:0-0:5:5", + "value": [ + { + "string": "jacob", + "raw_string": "jacob" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/filters/order.d2,0:0:0-2:1:25", + "key": { + "range": "TestCompile/filters/order.d2,0:0:0-0:5:5", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/order.d2,0:0:0-0:5:5", + "value": [ + { + "string": "jacob", + "raw_string": "jacob" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "TestCompile/filters/order.d2,0:7:7-2:1:25", + "nodes": [ + { + "map_key": { + "range": "TestCompile/filters/order.d2,1:1:10-1:14:23", + "key": { + "range": "TestCompile/filters/order.d2,1:1:10-1:6:15", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/order.d2,1:1:10-1:6:15", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/order.d2,1:8:17-1:14:23", + "value": [ + { + "string": "circle", + "raw_string": "circle" + } + ] + } + } + } + } + ] + } + } + } + } + } + ] + }, + { + "name": "jeremy", + "composite": { + "fields": [ + { + "name": "shape", + "primary": { + "value": { + "range": "TestCompile/filters/order.d2,4:8:44-4:17:53", + "value": [ + { + "string": "rectangle", + "raw_string": "rectangle" + } + ] + } + }, + "references": [ + { + "string": { + "range": "TestCompile/filters/order.d2,4:1:37-4:6:42", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/order.d2,4:1:37-4:6:42", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/order.d2,4:1:37-4:6:42", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/filters/order.d2,4:1:37-4:17:53", + "key": { + "range": "TestCompile/filters/order.d2,4:1:37-4:6:42", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/order.d2,4:1:37-4:6:42", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/order.d2,4:8:44-4:17:53", + "value": [ + { + "string": "rectangle", + "raw_string": "rectangle" + } + ] + } + } + } + } + }, + { + "string": { + "range": "TestCompile/filters/order.d2,8:2:87-8:7:92", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/order.d2,8:2:87-8:7:92", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/order.d2,8:2:87-8:7:92", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/filters/order.d2,8:1:86-8:18:103", + "ampersand": true, + "key": { + "range": "TestCompile/filters/order.d2,8:2:87-8:7:92", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/order.d2,8:2:87-8:7:92", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/order.d2,8:9:94-8:18:103", + "value": [ + { + "string": "rectangle", + "raw_string": "rectangle" + } + ] + } + } + } + } + } + ] + }, + { + "name": "label", + "primary": { + "value": { + "range": "TestCompile/filters/order.d2,7:8:69-7:23:84", + "value": [ + { + "string": "I'm a rectangle", + "raw_string": "I'm a rectangle" + } + ] + } + }, + "references": [ + { + "string": { + "range": "TestCompile/filters/order.d2,7:1:62-7:6:67", + "value": [ + { + "string": "label", + "raw_string": "label" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/order.d2,7:1:62-7:6:67", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/order.d2,7:1:62-7:6:67", + "value": [ + { + "string": "label", + "raw_string": "label" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/filters/order.d2,7:1:62-7:23:84", + "key": { + "range": "TestCompile/filters/order.d2,7:1:62-7:6:67", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/order.d2,7:1:62-7:6:67", + "value": [ + { + "string": "label", + "raw_string": "label" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/order.d2,7:8:69-7:23:84", + "value": [ + { + "string": "I'm a rectangle", + "raw_string": "I'm a rectangle" + } + ] + } + } + } + } + } + ] + } + ], + "edges": null + }, + "references": [ + { + "string": { + "range": "TestCompile/filters/order.d2,3:0:26-3:6:32", + "value": [ + { + "string": "jeremy", + "raw_string": "jeremy" + } + ] + }, + "key_path": { + "range": "TestCompile/filters/order.d2,3:0:26-3:6:32", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/order.d2,3:0:26-3:6:32", + "value": [ + { + "string": "jeremy", + "raw_string": "jeremy" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/filters/order.d2,3:0:26-5:1:55", + "key": { + "range": "TestCompile/filters/order.d2,3:0:26-3:6:32", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/order.d2,3:0:26-3:6:32", + "value": [ + { + "string": "jeremy", + "raw_string": "jeremy" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "TestCompile/filters/order.d2,3:8:34-5:1:55", + "nodes": [ + { + "map_key": { + "range": "TestCompile/filters/order.d2,4:1:37-4:17:53", + "key": { + "range": "TestCompile/filters/order.d2,4:1:37-4:6:42", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/filters/order.d2,4:1:37-4:6:42", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/filters/order.d2,4:8:44-4:17:53", + "value": [ + { + "string": "rectangle", + "raw_string": "rectangle" + } + ] + } + } + } + } + ] + } + } + } + } + } + ] + } + ], + "edges": null +}