handle interpolation

This commit is contained in:
Alexander Wang 2023-07-11 13:32:07 -07:00
parent e7e2566564
commit 090d10e9ca
No known key found for this signature in database
GPG key ID: D89FA31966BDBECE
82 changed files with 692 additions and 939 deletions

View file

@ -503,6 +503,17 @@ type UnquotedString struct {
Value []InterpolationBox `json:"value"`
}
func (s *UnquotedString) Coalesce() {
var b strings.Builder
for _, box := range s.Value {
if box.String == nil {
break
}
b.WriteString(*box.String)
}
s.SetString(b.String())
}
func FlatUnquotedString(s string) *UnquotedString {
return &UnquotedString{
Value: []InterpolationBox{{String: &s}},
@ -514,6 +525,17 @@ type DoubleQuotedString struct {
Value []InterpolationBox `json:"value"`
}
func (s *DoubleQuotedString) Coalesce() {
var b strings.Builder
for _, box := range s.Value {
if box.String == nil {
break
}
b.WriteString(*box.String)
}
s.SetString(b.String())
}
func FlatDoubleQuotedString(s string) *DoubleQuotedString {
return &DoubleQuotedString{
Value: []InterpolationBox{{String: &s}},

View file

@ -3253,6 +3253,30 @@ hi: 1 ${x} 2
assert.Equal(t, "1 im a var 2", g.Objects[0].Label.Value)
},
},
{
name: "double-quoted",
run: func(t *testing.T) {
g := assertCompile(t, `
vars: {
x: im a var
}
hi: "1 ${x} 2"
`, "")
assert.Equal(t, "1 im a var 2", g.Objects[0].Label.Value)
},
},
{
name: "single-quoted",
run: func(t *testing.T) {
g := assertCompile(t, `
vars: {
x: im a var
}
hi: '1 ${x} 2'
`, "")
assert.Equal(t, "1 ${x} 2", g.Objects[0].Label.Value)
},
},
{
name: "edge label",
run: func(t *testing.T) {
@ -3411,19 +3435,9 @@ scenarios: {
x: ${x}
}
}
layers: {
l2: {
vars: {
x: im replaced x var
}
x: ${x}
}
}
`, "")
assert.Equal(t, 1, len(g.Scenarios[0].Objects))
assert.Equal(t, "im replaced x var", g.Scenarios[0].Objects[0].Label.Value)
assert.Equal(t, 1, len(g.Layers[0].Objects))
assert.Equal(t, "im replaced x var", g.Layers[0].Objects[0].Label.Value)
},
},
}
@ -3456,17 +3470,6 @@ vars: {
x: hey
}
hi: ${z}
`, "d2/testdata/d2compiler/TestCompile2/vars/errors/missing.d2:5:1: could not resolve variable z")
},
},
{
name: "key",
run: func(t *testing.T) {
assertCompile(t, `
vars: {
x: hey
}
${x}
`, "d2/testdata/d2compiler/TestCompile2/vars/errors/missing.d2:5:1: could not resolve variable z")
},
},

View file

@ -7,6 +7,7 @@ import (
"oss.terrastruct.com/d2/d2ast"
"oss.terrastruct.com/d2/d2format"
"oss.terrastruct.com/d2/d2parser"
"oss.terrastruct.com/util-go/go2"
)
type compiler struct {
@ -96,7 +97,47 @@ func (c *compiler) overlayClasses(m *Map) {
}
}
func (c *compiler) resolveSubstitution(vars *Map, mk *d2ast.Key, substitution *d2ast.Substitution) d2ast.Scalar {
func (c *compiler) resolveSubstitutions(refctx *RefContext) {
varsMap := &Map{}
boardScope := refctx.ScopeMap
if NodeBoardKind(refctx.ScopeMap) == "" {
boardScope = ParentBoard(refctx.ScopeMap).Map()
}
vars := boardScope.GetField("vars")
if vars != nil {
varsMap = vars.Map()
}
switch {
case refctx.Key.Value.Substitution != nil:
resolvedField := c.resolveSubstitution(varsMap, refctx.Key, refctx.Key.Value.Substitution)
if resolvedField != nil {
refctx.Key.Value = d2ast.MakeValueBox(resolvedField.Primary().Value)
}
case refctx.Key.Value.UnquotedString != nil:
for i, box := range refctx.Key.Value.UnquotedString.Value {
if box.Substitution != nil {
resolvedField := c.resolveSubstitution(varsMap, refctx.Key, box.Substitution)
if resolvedField != nil {
refctx.Key.Value.UnquotedString.Value[i].String = go2.Pointer(resolvedField.Primary().String())
}
}
}
refctx.Key.Value.UnquotedString.Coalesce()
case refctx.Key.Value.DoubleQuotedString != nil:
for i, box := range refctx.Key.Value.DoubleQuotedString.Value {
if box.Substitution != nil {
resolvedField := c.resolveSubstitution(varsMap, refctx.Key, box.Substitution)
if resolvedField != nil {
refctx.Key.Value.DoubleQuotedString.Value[i].String = go2.Pointer(resolvedField.Primary().String())
}
}
}
refctx.Key.Value.DoubleQuotedString.Coalesce()
}
}
func (c *compiler) resolveSubstitution(vars *Map, mk *d2ast.Key, substitution *d2ast.Substitution) *Field {
var resolved *Field
for _, p := range substitution.Path {
if vars == nil {
@ -115,7 +156,7 @@ func (c *compiler) resolveSubstitution(vars *Map, mk *d2ast.Key, substitution *d
c.errorf(mk, "could not resolve variable %s", strings.Join(substitution.IDA(), "."))
} else {
// TODO maps
return resolved.Primary().Value
return resolved
}
return nil
}
@ -205,6 +246,7 @@ func (c *compiler) compileMap(dst *Map, ast, scopeAST *d2ast.Map) {
func (c *compiler) compileKey(refctx *RefContext) {
// resolve substitutions here
c.resolveSubstitutions(refctx)
if len(refctx.Key.Edges) == 0 {
c.compileField(refctx.ScopeMap, refctx.Key.Key, refctx)
} else {
@ -308,15 +350,15 @@ func (c *compiler) compileField(dst *Map, kp *d2ast.KeyPath, refctx *RefContext)
c.overlayClasses(f.Map())
}
}
} else if refctx.Key.Value.Substitution != nil {
vars := ParentBoard(f).Map().GetField("vars")
resolved := c.resolveSubstitution(vars.Map(), refctx.Key, refctx.Key.Value.Substitution)
if resolved != nil {
f.Primary_ = &Scalar{
parent: f,
Value: resolved,
}
}
// } else if refctx.Key.Value.Substitution != nil {
// vars := ParentBoard(f).Map().GetField("vars")
// resolved := c.resolveSubstitution(vars.Map(), refctx.Key, refctx.Key.Value.Substitution)
// if resolved != nil {
// f.Primary_ = &Scalar{
// parent: f,
// Value: resolved,
// }
// }
} else if refctx.Key.Value.ScalarBox().Unbox() != nil {
// If the link is a board, we need to transform it into an absolute path.
if f.Name == "link" {
@ -496,15 +538,15 @@ func (c *compiler) compileEdges(refctx *RefContext) {
}
}
c.compileMap(e.Map_, refctx.Key.Value.Map, refctx.ScopeAST)
} else if refctx.Key.Value.Substitution != nil {
vars := ParentBoard(e).Map().GetField("vars")
resolved := c.resolveSubstitution(vars.Map(), refctx.Key, refctx.Key.Value.Substitution)
if resolved != nil {
e.Primary_ = &Scalar{
parent: e,
Value: resolved,
}
}
// } else if refctx.Key.Value.Substitution != nil {
// vars := ParentBoard(e).Map().GetField("vars")
// resolved := c.resolveSubstitution(vars.Map(), refctx.Key, refctx.Key.Value.Substitution)
// if resolved != nil {
// e.Primary_ = &Scalar{
// parent: e,
// Value: resolved,
// }
// }
} else if refctx.Key.Value.ScalarBox().Unbox() != nil {
e.Primary_ = &Scalar{
parent: e,

View file

@ -76,7 +76,11 @@
"value": {
"double_quoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,2:11:39-2:13:41",
"value": null
"value": [
{
"string": ""
}
]
}
}
}
@ -106,8 +110,7 @@
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,3:11:53-3:17:59",
"value": [
{
"string": "circle",
"raw_string": "circle"
"string": "circle"
}
]
}
@ -150,8 +153,7 @@
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,4:16:76-4:22:82",
"value": [
{
"string": "orange",
"raw_string": "orange"
"string": "orange"
}
]
}
@ -212,8 +214,7 @@
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,7:11:108-7:17:114",
"value": [
{
"string": "then",
"raw_string": "then"
"string": "then"
}
]
}

View file

@ -59,8 +59,7 @@
"range": "d2/testdata/d2compiler/TestCompile/basic_icon.d2,1:8:18-1:64:74",
"value": [
{
"string": "https://icons.terrastruct.com/essentials/004-picture.svg",
"raw_string": "https://icons.terrastruct.com/essentials/004-picture.svg"
"string": "https://icons.terrastruct.com/essentials/004-picture.svg"
}
]
}

View file

@ -54,8 +54,7 @@
"range": "d2/testdata/d2compiler/TestCompile/basic_sequence.d2,1:9:14-1:25:30",
"value": [
{
"string": "sequence_diagram",
"raw_string": "sequence_diagram"
"string": "sequence_diagram"
}
]
}

View file

@ -54,8 +54,7 @@
"range": "d2/testdata/d2compiler/TestCompile/basic_shape.d2,2:9:15-2:15:21",
"value": [
{
"string": "circle",
"raw_string": "circle"
"string": "circle"
}
]
}

View file

@ -78,8 +78,7 @@
"range": "d2/testdata/d2compiler/TestCompile/class-shape-class.d2,2:11:38-2:16:43",
"value": [
{
"string": "class",
"raw_string": "class"
"string": "class"
}
]
}
@ -145,8 +144,7 @@
"range": "d2/testdata/d2compiler/TestCompile/class-shape-class.d2,7:9:70-7:19:80",
"value": [
{
"string": "classClass",
"raw_string": "classClass"
"string": "classClass"
}
]
}
@ -178,8 +176,7 @@
"range": "d2/testdata/d2compiler/TestCompile/class-shape-class.d2,8:12:93-8:15:96",
"value": [
{
"string": "int",
"raw_string": "int"
"string": "int"
}
]
}

View file

@ -64,8 +64,7 @@
"range": "d2/testdata/d2compiler/TestCompile/class_paren.d2,1:9:28-1:14:33",
"value": [
{
"string": "class",
"raw_string": "class"
"string": "class"
}
]
}
@ -120,8 +119,7 @@
"range": "d2/testdata/d2compiler/TestCompile/class_paren.d2,4:13:60-4:19:66",
"value": [
{
"string": "string",
"raw_string": "string"
"string": "string"
}
]
}
@ -153,8 +151,7 @@
"range": "d2/testdata/d2compiler/TestCompile/class_paren.d2,5:8:75-5:12:79",
"value": [
{
"string": "bool",
"raw_string": "bool"
"string": "bool"
}
]
}

View file

@ -54,8 +54,7 @@
"range": "d2/testdata/d2compiler/TestCompile/class_style.d2,1:9:28-1:16:35",
"value": [
{
"string": "class",
"raw_string": "class"
"string": "class"
}
]
}
@ -87,8 +86,7 @@
"range": "d2/testdata/d2compiler/TestCompile/class_style.d2,2:14:50-2:22:58",
"value": [
{
"string": "string",
"raw_string": "string"
"string": "string"
}
]
}

View file

@ -76,7 +76,11 @@
"value": {
"double_quoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/classes.d2,2:11:39-2:13:41",
"value": null
"value": [
{
"string": ""
}
]
}
}
}
@ -106,8 +110,7 @@
"range": "d2/testdata/d2compiler/TestCompile/classes.d2,3:11:53-3:17:59",
"value": [
{
"string": "circle",
"raw_string": "circle"
"string": "circle"
}
]
}
@ -150,8 +153,7 @@
"range": "d2/testdata/d2compiler/TestCompile/classes.d2,4:16:76-4:22:82",
"value": [
{
"string": "orange",
"raw_string": "orange"
"string": "orange"
}
]
}
@ -212,8 +214,7 @@
"range": "d2/testdata/d2compiler/TestCompile/classes.d2,7:11:108-7:17:114",
"value": [
{
"string": "then",
"raw_string": "then"
"string": "then"
}
]
}
@ -319,8 +320,7 @@
"range": "d2/testdata/d2compiler/TestCompile/classes.d2,11:17:164-11:28:175",
"value": [
{
"string": "dragon_ball",
"raw_string": "dragon_ball"
"string": "dragon_ball"
}
]
}
@ -391,8 +391,7 @@
"range": "d2/testdata/d2compiler/TestCompile/classes.d2,12:20:198-12:31:209",
"value": [
{
"string": "dragon_ball",
"raw_string": "dragon_ball"
"string": "dragon_ball"
}
]
}
@ -435,8 +434,7 @@
"range": "d2/testdata/d2compiler/TestCompile/classes.d2,12:45:223-12:48:226",
"value": [
{
"string": "red",
"raw_string": "red"
"string": "red"
}
]
}
@ -497,8 +495,7 @@
"range": "d2/testdata/d2compiler/TestCompile/classes.d2,13:16:245-13:20:249",
"value": [
{
"string": "**",
"raw_string": "**"
"string": "**"
}
]
}
@ -530,8 +527,7 @@
"range": "d2/testdata/d2compiler/TestCompile/classes.d2,13:29:258-13:40:269",
"value": [
{
"string": "dragon_ball",
"raw_string": "dragon_ball"
"string": "dragon_ball"
}
]
}
@ -615,8 +611,7 @@
"range": "d2/testdata/d2compiler/TestCompile/classes.d2,15:26:299-15:30:303",
"value": [
{
"string": "path",
"raw_string": "path"
"string": "path"
}
]
}

View file

@ -78,8 +78,7 @@
"range": "d2/testdata/d2compiler/TestCompile/dimensions_on_containers.d2,3:9:45-3:15:51",
"value": [
{
"string": "circle",
"raw_string": "circle"
"string": "circle"
}
]
}
@ -164,8 +163,7 @@
"range": "d2/testdata/d2compiler/TestCompile/dimensions_on_containers.d2,7:10:89-7:17:96",
"value": [
{
"string": "diamond",
"raw_string": "diamond"
"string": "diamond"
}
]
}
@ -289,8 +287,7 @@
"range": "d2/testdata/d2compiler/TestCompile/dimensions_on_containers.d2,13:9:163-13:16:170",
"value": [
{
"string": "diamond",
"raw_string": "diamond"
"string": "diamond"
}
]
}
@ -404,8 +401,7 @@
"range": "d2/testdata/d2compiler/TestCompile/dimensions_on_containers.d2,18:10:221-18:16:227",
"value": [
{
"string": "circle",
"raw_string": "circle"
"string": "circle"
}
]
}
@ -500,8 +496,7 @@
"range": "d2/testdata/d2compiler/TestCompile/dimensions_on_containers.d2,23:9:277-23:13:281",
"value": [
{
"string": "oval",
"raw_string": "oval"
"string": "oval"
}
]
}
@ -615,8 +610,7 @@
"range": "d2/testdata/d2compiler/TestCompile/dimensions_on_containers.d2,28:10:333-28:17:340",
"value": [
{
"string": "hexagon",
"raw_string": "hexagon"
"string": "hexagon"
}
]
}
@ -740,8 +734,7 @@
"range": "d2/testdata/d2compiler/TestCompile/dimensions_on_containers.d2,34:9:407-34:16:414",
"value": [
{
"string": "hexagon",
"raw_string": "hexagon"
"string": "hexagon"
}
]
}
@ -855,8 +848,7 @@
"range": "d2/testdata/d2compiler/TestCompile/dimensions_on_containers.d2,39:10:463-39:14:467",
"value": [
{
"string": "oval",
"raw_string": "oval"
"string": "oval"
}
]
}

View file

@ -59,8 +59,7 @@
"range": "d2/testdata/d2compiler/TestCompile/dimensions_on_nonimage.d2,1:9:19-1:16:26",
"value": [
{
"string": "hexagon",
"raw_string": "hexagon"
"string": "hexagon"
}
]
}

View file

@ -111,8 +111,7 @@
"range": "d2/testdata/d2compiler/TestCompile/edge_arrowhead_fields.d2,2:11:80-2:18:87",
"value": [
{
"string": "diamond",
"raw_string": "diamond"
"string": "diamond"
}
]
}
@ -149,8 +148,7 @@
"range": "d2/testdata/d2compiler/TestCompile/edge_arrowhead_fields.d2,4:20:112-4:24:116",
"value": [
{
"string": "QOTD",
"raw_string": "QOTD"
"string": "QOTD"
}
]
}

View file

@ -77,8 +77,7 @@
"range": "d2/testdata/d2compiler/TestCompile/edge_arrowhead_primary.d2,1:20:30-1:56:66",
"value": [
{
"string": "Reisner's Rule of Conceptual Inertia",
"raw_string": "Reisner's Rule of Conceptual Inertia"
"string": "Reisner's Rule of Conceptual Inertia"
}
]
}

View file

@ -90,8 +90,7 @@
"range": "d2/testdata/d2compiler/TestCompile/edge_chain.d2,1:13:14-1:55:56",
"value": [
{
"string": "The kids will love our inflatable slides",
"raw_string": "The kids will love our inflatable slides"
"string": "The kids will love our inflatable slides"
}
]
}

View file

@ -114,8 +114,7 @@
"range": "d2/testdata/d2compiler/TestCompile/edge_chain_map.d2,2:9:25-2:88:104",
"value": [
{
"string": "Space: the final frontier. These are the voyages of the starship Enterprise.",
"raw_string": "Space: the final frontier. These are the voyages of the starship Enterprise."
"string": "Space: the final frontier. These are the voyages of the starship Enterprise."
}
]
}

View file

@ -54,8 +54,7 @@
"range": "d2/testdata/d2compiler/TestCompile/edge_column_index.d2,1:8:15-1:17:24",
"value": [
{
"string": "sql_table",
"raw_string": "sql_table"
"string": "sql_table"
}
]
}
@ -87,8 +86,7 @@
"range": "d2/testdata/d2compiler/TestCompile/edge_column_index.d2,2:5:30-2:8:33",
"value": [
{
"string": "int",
"raw_string": "int"
"string": "int"
}
]
}
@ -120,8 +118,7 @@
"range": "d2/testdata/d2compiler/TestCompile/edge_column_index.d2,3:9:43-3:12:46",
"value": [
{
"string": "int",
"raw_string": "int"
"string": "int"
}
]
}
@ -182,8 +179,7 @@
"range": "d2/testdata/d2compiler/TestCompile/edge_column_index.d2,7:8:65-7:17:74",
"value": [
{
"string": "sql_table",
"raw_string": "sql_table"
"string": "sql_table"
}
]
}
@ -215,8 +211,7 @@
"range": "d2/testdata/d2compiler/TestCompile/edge_column_index.d2,8:5:80-8:8:83",
"value": [
{
"string": "int",
"raw_string": "int"
"string": "int"
}
]
}
@ -248,8 +243,7 @@
"range": "d2/testdata/d2compiler/TestCompile/edge_column_index.d2,9:7:91-9:13:97",
"value": [
{
"string": "string",
"raw_string": "string"
"string": "string"
}
]
}

View file

@ -131,8 +131,7 @@
"range": "d2/testdata/d2compiler/TestCompile/edge_flat_arrowhead.d2,1:36:43-1:43:50",
"value": [
{
"string": "diamond",
"raw_string": "diamond"
"string": "diamond"
}
]
}

View file

@ -94,8 +94,7 @@
"range": "d2/testdata/d2compiler/TestCompile/edge_flat_label_arrowhead.d2,2:26:48-2:28:50",
"value": [
{
"string": "yo",
"raw_string": "yo"
"string": "yo"
}
]
}

View file

@ -53,8 +53,7 @@
"range": "d2/testdata/d2compiler/TestCompile/edge_index.d2,1:8:9-1:11:12",
"value": [
{
"string": "one",
"raw_string": "one"
"string": "one"
}
]
}
@ -114,8 +113,7 @@
"range": "d2/testdata/d2compiler/TestCompile/edge_index.d2,2:13:26-2:16:29",
"value": [
{
"string": "two",
"raw_string": "two"
"string": "two"
}
]
}

View file

@ -128,8 +128,7 @@
"range": "d2/testdata/d2compiler/TestCompile/edge_index_map.d2,3:9:32-3:88:111",
"value": [
{
"string": "Space: the final frontier. These are the voyages of the starship Enterprise.",
"raw_string": "Space: the final frontier. These are the voyages of the starship Enterprise."
"string": "Space: the final frontier. These are the voyages of the starship Enterprise."
}
]
}

View file

@ -77,8 +77,7 @@
"range": "d2/testdata/d2compiler/TestCompile/edge_index_nested.d2,2:9:15-2:12:18",
"value": [
{
"string": "one",
"raw_string": "one"
"string": "one"
}
]
}
@ -138,8 +137,7 @@
"range": "d2/testdata/d2compiler/TestCompile/edge_index_nested.d2,3:14:33-3:17:36",
"value": [
{
"string": "two",
"raw_string": "two"
"string": "two"
}
]
}

View file

@ -77,8 +77,7 @@
"range": "d2/testdata/d2compiler/TestCompile/edge_index_nested_cross_scope.d2,2:9:15-2:12:18",
"value": [
{
"string": "one",
"raw_string": "one"
"string": "one"
}
]
}
@ -159,8 +158,7 @@
"range": "d2/testdata/d2compiler/TestCompile/edge_index_nested_cross_scope.d2,4:15:36-4:18:39",
"value": [
{
"string": "two",
"raw_string": "two"
"string": "two"
}
]
}

View file

@ -77,8 +77,7 @@
"range": "d2/testdata/d2compiler/TestCompile/edge_map.d2,2:9:20-2:88:99",
"value": [
{
"string": "Space: the final frontier. These are the voyages of the starship Enterprise.",
"raw_string": "Space: the final frontier. These are the voyages of the starship Enterprise."
"string": "Space: the final frontier. These are the voyages of the starship Enterprise."
}
]
}

View file

@ -101,8 +101,7 @@
"range": "d2/testdata/d2compiler/TestCompile/edge_map_arrowhead.d2,2:11:43-2:18:50",
"value": [
{
"string": "diamond",
"raw_string": "diamond"
"string": "diamond"
}
]
}

View file

@ -88,8 +88,7 @@
"range": "d2/testdata/d2compiler/TestCompile/edge_mixed_arrowhead.d2,1:26:36-1:33:43",
"value": [
{
"string": "diamond",
"raw_string": "diamond"
"string": "diamond"
}
]
}
@ -194,8 +193,7 @@
"range": "d2/testdata/d2compiler/TestCompile/edge_mixed_arrowhead.d2,4:9:87-4:16:94",
"value": [
{
"string": "diamond",
"raw_string": "diamond"
"string": "diamond"
}
]
}

View file

@ -88,8 +88,7 @@
"range": "d2/testdata/d2compiler/TestCompile/edge_non_shape_arrowhead.d2,0:34:34-0:42:42",
"value": [
{
"string": "triangle",
"raw_string": "triangle"
"string": "triangle"
}
]
}

View file

@ -144,8 +144,7 @@
"range": "d2/testdata/d2compiler/TestCompile/edge_semiflat_arrowhead.d2,2:9:48-2:16:55",
"value": [
{
"string": "diamond",
"raw_string": "diamond"
"string": "diamond"
}
]
}

View file

@ -78,8 +78,7 @@
"range": "d2/testdata/d2compiler/TestCompile/fill-pattern.d2,2:18:33-2:22:37",
"value": [
{
"string": "dots",
"raw_string": "dots"
"string": "dots"
}
]
}

View file

@ -88,8 +88,7 @@
"range": "d2/testdata/d2compiler/TestCompile/icon-near-composite-together.d2,2:8:41-2:24:57",
"value": [
{
"string": "outside-top-left",
"raw_string": "outside-top-left"
"string": "outside-top-left"
}
]
}

View file

@ -59,8 +59,7 @@
"range": "d2/testdata/d2compiler/TestCompile/image_style.d2,1:8:18-1:64:74",
"value": [
{
"string": "https://icons.terrastruct.com/essentials/004-picture.svg",
"raw_string": "https://icons.terrastruct.com/essentials/004-picture.svg"
"string": "https://icons.terrastruct.com/essentials/004-picture.svg"
}
]
}
@ -92,8 +91,7 @@
"range": "d2/testdata/d2compiler/TestCompile/image_style.d2,2:9:84-2:14:89",
"value": [
{
"string": "image",
"raw_string": "image"
"string": "image"
}
]
}
@ -136,8 +134,7 @@
"range": "d2/testdata/d2compiler/TestCompile/image_style.d2,3:16:106-3:25:115",
"value": [
{
"string": "#0D32B2",
"raw_string": "#0D32B2"
"string": "#0D32B2"
}
]
}

View file

@ -54,8 +54,7 @@
"range": "d2/testdata/d2compiler/TestCompile/label-near-composite-separate.d2,1:8:15-1:13:20",
"value": [
{
"string": "sushi",
"raw_string": "sushi"
"string": "sushi"
}
]
}
@ -98,8 +97,7 @@
"range": "d2/testdata/d2compiler/TestCompile/label-near-composite-separate.d2,2:13:34-2:29:50",
"value": [
{
"string": "outside-top-left",
"raw_string": "outside-top-left"
"string": "outside-top-left"
}
]
}

View file

@ -88,8 +88,7 @@
"range": "d2/testdata/d2compiler/TestCompile/label-near-composite-together.d2,2:8:32-2:24:48",
"value": [
{
"string": "outside-top-left",
"raw_string": "outside-top-left"
"string": "outside-top-left"
}
]
}

View file

@ -75,8 +75,7 @@
"range": "d2/testdata/d2compiler/TestCompile/label-near-parent.d2,1:13:26-1:29:42",
"value": [
{
"string": "outside-top-left",
"raw_string": "outside-top-left"
"string": "outside-top-left"
}
]
}

View file

@ -30,8 +30,7 @@
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,0:10:10-0:30:30",
"value": [
{
"string": "How does the cat go?",
"raw_string": "How does the cat go?"
"string": "How does the cat go?"
}
]
}
@ -177,8 +176,7 @@
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,5:26:103-5:30:107",
"value": [
{
"string": "goes",
"raw_string": "goes"
"string": "goes"
}
]
}
@ -290,8 +288,7 @@
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,11:25:164-11:30:169",
"value": [
{
"string": "green",
"raw_string": "green"
"string": "green"
}
]
}
@ -511,8 +508,7 @@
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,5:26:103-5:30:107",
"value": [
{
"string": "goes",
"raw_string": "goes"
"string": "goes"
}
]
}
@ -701,8 +697,7 @@
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,0:10:10-0:30:30",
"value": [
{
"string": "How does the cat go?",
"raw_string": "How does the cat go?"
"string": "How does the cat go?"
}
]
}
@ -788,8 +783,7 @@
"range": "d2/testdata/d2compiler/TestCompile/link-board-mixed.d2,11:25:164-11:30:169",
"value": [
{
"string": "green",
"raw_string": "green"
"string": "green"
}
]
}

View file

@ -41,8 +41,7 @@
"range": "d2/testdata/d2compiler/TestCompile/missing-class.d2,0:9:9-0:11:11",
"value": [
{
"string": "yo",
"raw_string": "yo"
"string": "yo"
}
]
}

View file

@ -41,8 +41,7 @@
"range": "d2/testdata/d2compiler/TestCompile/near_constant.d2,0:8:8-0:18:18",
"value": [
{
"string": "top-center",
"raw_string": "top-center"
"string": "top-center"
}
]
}

View file

@ -158,8 +158,7 @@
"range": "d2/testdata/d2compiler/TestCompile/nested-array-classes.d2,5:26:101-5:31:106",
"value": [
{
"string": "arrow",
"raw_string": "arrow"
"string": "arrow"
}
]
}

View file

@ -78,8 +78,7 @@
"range": "d2/testdata/d2compiler/TestCompile/nested_sql.d2,2:11:31-2:20:40",
"value": [
{
"string": "sql_table",
"raw_string": "sql_table"
"string": "sql_table"
}
]
}
@ -111,8 +110,7 @@
"range": "d2/testdata/d2compiler/TestCompile/nested_sql.d2,4:15:57-4:21:63",
"value": [
{
"string": "string",
"raw_string": "string"
"string": "string"
}
]
}
@ -144,8 +142,7 @@
"range": "d2/testdata/d2compiler/TestCompile/nested_sql.d2,5:10:74-5:14:78",
"value": [
{
"string": "bool",
"raw_string": "bool"
"string": "bool"
}
]
}

View file

@ -54,8 +54,7 @@
"range": "d2/testdata/d2compiler/TestCompile/path_link.d2,1:8:13-1:39:44",
"value": [
{
"string": "Overview.Untitled board 7.zzzzz",
"raw_string": "Overview.Untitled board 7.zzzzz"
"string": "Overview.Untitled board 7.zzzzz"
}
]
}

View file

@ -78,8 +78,7 @@
"range": "d2/testdata/d2compiler/TestCompile/reordered-classes.d2,2:11:29-2:17:35",
"value": [
{
"string": "circle",
"raw_string": "circle"
"string": "circle"
}
]
}
@ -132,8 +131,7 @@
"range": "d2/testdata/d2compiler/TestCompile/reordered-classes.d2,5:9:51-5:10:52",
"value": [
{
"string": "x",
"raw_string": "x"
"string": "x"
}
]
}
@ -187,8 +185,7 @@
"range": "d2/testdata/d2compiler/TestCompile/reordered-classes.d2,6:17:70-6:24:77",
"value": [
{
"string": "diamond",
"raw_string": "diamond"
"string": "diamond"
}
]
}

View file

@ -54,8 +54,7 @@
"range": "d2/testdata/d2compiler/TestCompile/reserved_icon_near_style.d2,1:8:13-1:14:19",
"value": [
{
"string": "orange",
"raw_string": "orange"
"string": "orange"
}
]
}
@ -138,8 +137,7 @@
"range": "d2/testdata/d2compiler/TestCompile/reserved_icon_near_style.d2,3:16:57-3:19:60",
"value": [
{
"string": "red",
"raw_string": "red"
"string": "red"
}
]
}
@ -182,8 +180,7 @@
"range": "d2/testdata/d2compiler/TestCompile/reserved_icon_near_style.d2,4:13:74-4:18:79",
"value": [
{
"string": "green",
"raw_string": "green"
"string": "green"
}
]
}
@ -231,8 +228,7 @@
"range": "d2/testdata/d2compiler/TestCompile/reserved_icon_near_style.d2,6:8:90-6:9:91",
"value": [
{
"string": "y",
"raw_string": "y"
"string": "y"
}
]
}

View file

@ -30,8 +30,7 @@
"range": "d2/testdata/d2compiler/TestCompile/root_direction.d2,0:11:11-0:16:16",
"value": [
{
"string": "right",
"raw_string": "right"
"string": "right"
}
]
}

View file

@ -30,8 +30,7 @@
"range": "d2/testdata/d2compiler/TestCompile/root_sequence.d2,0:7:7-0:23:23",
"value": [
{
"string": "sequence_diagram",
"raw_string": "sequence_diagram"
"string": "sequence_diagram"
}
]
}

View file

@ -30,8 +30,7 @@
"range": "d2/testdata/d2compiler/TestCompile/sequence-timestamp.d2,0:7:7-0:23:23",
"value": [
{
"string": "sequence_diagram",
"raw_string": "sequence_diagram"
"string": "sequence_diagram"
}
]
}

View file

@ -30,8 +30,7 @@
"range": "d2/testdata/d2compiler/TestCompile/sequence_container.d2,0:7:7-0:23:23",
"value": [
{
"string": "sequence_diagram",
"raw_string": "sequence_diagram"
"string": "sequence_diagram"
}
]
}

View file

@ -30,8 +30,7 @@
"range": "d2/testdata/d2compiler/TestCompile/sequence_container_2.d2,0:7:7-0:23:23",
"value": [
{
"string": "sequence_diagram",
"raw_string": "sequence_diagram"
"string": "sequence_diagram"
}
]
}

View file

@ -30,8 +30,7 @@
"range": "d2/testdata/d2compiler/TestCompile/sequence_grouped_note.d2,0:7:7-0:23:23",
"value": [
{
"string": "sequence_diagram",
"raw_string": "sequence_diagram"
"string": "sequence_diagram"
}
]
}

View file

@ -54,8 +54,7 @@
"range": "d2/testdata/d2compiler/TestCompile/sequence_scoping.d2,1:9:14-1:25:30",
"value": [
{
"string": "sequence_diagram",
"raw_string": "sequence_diagram"
"string": "sequence_diagram"
}
]
}

View file

@ -54,8 +54,7 @@
"range": "d2/testdata/d2compiler/TestCompile/set_direction.d2,1:13:18-1:17:22",
"value": [
{
"string": "left",
"raw_string": "left"
"string": "left"
}
]
}

View file

@ -59,8 +59,7 @@
"range": "d2/testdata/d2compiler/TestCompile/single_dimension_on_circle.d2,1:8:18-1:14:24",
"value": [
{
"string": "circle",
"raw_string": "circle"
"string": "circle"
}
]
}

View file

@ -54,8 +54,7 @@
"range": "d2/testdata/d2compiler/TestCompile/sql-constraints.d2,1:9:14-1:18:23",
"value": [
{
"string": "sql_table",
"raw_string": "sql_table"
"string": "sql_table"
}
]
}
@ -121,8 +120,7 @@
"range": "d2/testdata/d2compiler/TestCompile/sql-constraints.d2,2:22:46-2:33:57",
"value": [
{
"string": "primary_key",
"raw_string": "primary_key"
"string": "primary_key"
}
]
}

View file

@ -78,8 +78,7 @@
"range": "d2/testdata/d2compiler/TestCompile/sql-regression.d2,2:10:26-2:22:38",
"value": [
{
"string": "lemonchiffon",
"raw_string": "lemonchiffon"
"string": "lemonchiffon"
}
]
}
@ -140,8 +139,7 @@
"range": "d2/testdata/d2compiler/TestCompile/sql-regression.d2,5:11:61-5:20:70",
"value": [
{
"string": "sql_table",
"raw_string": "sql_table"
"string": "sql_table"
}
]
}

View file

@ -64,8 +64,7 @@
"range": "d2/testdata/d2compiler/TestCompile/sql_paren.d2,1:9:28-1:18:37",
"value": [
{
"string": "sql_table",
"raw_string": "sql_table"
"string": "sql_table"
}
]
}
@ -97,8 +96,7 @@
"range": "d2/testdata/d2compiler/TestCompile/sql_paren.d2,3:13:52-3:19:58",
"value": [
{
"string": "string",
"raw_string": "string"
"string": "string"
}
]
}
@ -130,8 +128,7 @@
"range": "d2/testdata/d2compiler/TestCompile/sql_paren.d2,4:8:67-4:12:71",
"value": [
{
"string": "bool",
"raw_string": "bool"
"string": "bool"
}
]
}

View file

@ -54,8 +54,7 @@
"range": "d2/testdata/d2compiler/TestCompile/table_connection_attr.d2,1:9:14-1:18:23",
"value": [
{
"string": "sql_table",
"raw_string": "sql_table"
"string": "sql_table"
}
]
}
@ -139,8 +138,7 @@
"range": "d2/testdata/d2compiler/TestCompile/table_connection_attr.d2,5:9:44-5:18:53",
"value": [
{
"string": "sql_table",
"raw_string": "sql_table"
"string": "sql_table"
}
]
}

View file

@ -54,8 +54,7 @@
"range": "d2/testdata/d2compiler/TestCompile/table_style.d2,1:9:28-1:18:37",
"value": [
{
"string": "sql_table",
"raw_string": "sql_table"
"string": "sql_table"
}
]
}
@ -87,8 +86,7 @@
"range": "d2/testdata/d2compiler/TestCompile/table_style.d2,2:13:51-2:19:57",
"value": [
{
"string": "string",
"raw_string": "string"
"string": "string"
}
]
}

View file

@ -54,8 +54,7 @@
"range": "d2/testdata/d2compiler/TestCompile/table_style_map.d2,1:9:28-1:18:37",
"value": [
{
"string": "sql_table",
"raw_string": "sql_table"
"string": "sql_table"
}
]
}
@ -87,8 +86,7 @@
"range": "d2/testdata/d2compiler/TestCompile/table_style_map.d2,2:13:51-2:19:57",
"value": [
{
"string": "string",
"raw_string": "string"
"string": "string"
}
]
}
@ -173,8 +171,7 @@
"range": "d2/testdata/d2compiler/TestCompile/table_style_map.d2,5:16:102-5:20:106",
"value": [
{
"string": "blue",
"raw_string": "blue"
"string": "blue"
}
]
}

View file

@ -30,8 +30,7 @@
"range": "d2/testdata/d2compiler/TestCompile/text-transform.d2,0:11:11-0:16:16",
"value": [
{
"string": "right",
"raw_string": "right"
"string": "right"
}
]
}
@ -144,8 +143,7 @@
"range": "d2/testdata/d2compiler/TestCompile/text-transform.d2,3:20:61-3:30:71",
"value": [
{
"string": "capitalize",
"raw_string": "capitalize"
"string": "capitalize"
}
]
}
@ -209,8 +207,7 @@
"range": "d2/testdata/d2compiler/TestCompile/text-transform.d2,6:24:102-6:33:111",
"value": [
{
"string": "uppercase",
"raw_string": "uppercase"
"string": "uppercase"
}
]
}
@ -264,8 +261,7 @@
"range": "d2/testdata/d2compiler/TestCompile/text-transform.d2,7:24:136-7:33:145",
"value": [
{
"string": "lowercase",
"raw_string": "lowercase"
"string": "lowercase"
}
]
}

View file

@ -53,8 +53,7 @@
"range": "d2/testdata/d2compiler/TestCompile/underscore_edge_existing.d2,1:8:9-1:77:78",
"value": [
{
"string": "Can you imagine how life could be improved if we could do away with",
"raw_string": "Can you imagine how life could be improved if we could do away with"
"string": "Can you imagine how life could be improved if we could do away with"
}
]
}
@ -155,8 +154,7 @@
"range": "d2/testdata/d2compiler/TestCompile/underscore_edge_existing.d2,3:13:97-3:80:164",
"value": [
{
"string": "Well, it's garish, ugly, and derelicts have used it for a toilet.",
"raw_string": "Well, it's garish, ugly, and derelicts have used it for a toilet."
"string": "Well, it's garish, ugly, and derelicts have used it for a toilet."
}
]
}

View file

@ -53,8 +53,7 @@
"range": "d2/testdata/d2compiler/TestCompile/underscore_edge_index.d2,1:8:9-1:77:78",
"value": [
{
"string": "Can you imagine how life could be improved if we could do away with",
"raw_string": "Can you imagine how life could be improved if we could do away with"
"string": "Can you imagine how life could be improved if we could do away with"
}
]
}
@ -160,8 +159,7 @@
"range": "d2/testdata/d2compiler/TestCompile/underscore_edge_index.d2,3:18:102-3:85:169",
"value": [
{
"string": "Well, it's garish, ugly, and derelicts have used it for a toilet.",
"raw_string": "Well, it's garish, ugly, and derelicts have used it for a toilet."
"string": "Well, it's garish, ugly, and derelicts have used it for a toilet."
}
]
}

View file

@ -65,8 +65,7 @@
"range": "d2/testdata/d2compiler/TestCompile/underscore_parent_preference_1.d2,2:6:12-2:84:90",
"value": [
{
"string": "All we are given is possibilities -- to make ourselves one thing or another.",
"raw_string": "All we are given is possibilities -- to make ourselves one thing or another."
"string": "All we are given is possibilities -- to make ourselves one thing or another."
}
]
}
@ -103,8 +102,7 @@
"range": "d2/testdata/d2compiler/TestCompile/underscore_parent_preference_1.d2,4:3:96-4:80:173",
"value": [
{
"string": "But it's real. And if it's real it can be affected ... we may not be able",
"raw_string": "But it's real. And if it's real it can be affected ... we may not be able"
"string": "But it's real. And if it's real it can be affected ... we may not be able"
}
]
}

View file

@ -30,8 +30,7 @@
"range": "d2/testdata/d2compiler/TestCompile/underscore_parent_preference_2.d2,1:3:4-1:80:81",
"value": [
{
"string": "But it's real. And if it's real it can be affected ... we may not be able",
"raw_string": "But it's real. And if it's real it can be affected ... we may not be able"
"string": "But it's real. And if it's real it can be affected ... we may not be able"
}
]
}
@ -98,8 +97,7 @@
"range": "d2/testdata/d2compiler/TestCompile/underscore_parent_preference_2.d2,3:6:93-3:84:171",
"value": [
{
"string": "All we are given is possibilities -- to make ourselves one thing or another.",
"raw_string": "All we are given is possibilities -- to make ourselves one thing or another."
"string": "All we are given is possibilities -- to make ourselves one thing or another."
}
]
}

View file

@ -54,8 +54,7 @@
"range": "d2/testdata/d2compiler/TestCompile/url_link.d2,1:8:13-1:26:31",
"value": [
{
"string": "https://google.com",
"raw_string": "https://google.com"
"string": "https://google.com"
}
]
}

View file

@ -54,8 +54,7 @@
"range": "d2/testdata/d2compiler/TestCompile/url_link_and_not_url_tooltip_concurrently.d2,0:10:10-0:28:28",
"value": [
{
"string": "https://google.com",
"raw_string": "https://google.com"
"string": "https://google.com"
}
]
}
@ -87,8 +86,7 @@
"range": "d2/testdata/d2compiler/TestCompile/url_link_and_not_url_tooltip_concurrently.d2,0:39:39-0:50:50",
"value": [
{
"string": "hello world",
"raw_string": "hello world"
"string": "hello world"
}
]
}

View file

@ -54,8 +54,7 @@
"range": "d2/testdata/d2compiler/TestCompile/url_link_non_url_tooltip_ok.d2,0:10:10-0:32:32",
"value": [
{
"string": "https://not-google.com",
"raw_string": "https://not-google.com"
"string": "https://not-google.com"
}
]
}
@ -87,8 +86,7 @@
"range": "d2/testdata/d2compiler/TestCompile/url_link_non_url_tooltip_ok.d2,0:43:43-0:92:92",
"value": [
{
"string": "note: url.ParseRequestURI might see this as a URL",
"raw_string": "note: url.ParseRequestURI might see this as a URL"
"string": "note: url.ParseRequestURI might see this as a URL"
}
]
}

View file

@ -54,8 +54,7 @@
"range": "d2/testdata/d2compiler/TestCompile/url_tooltip.d2,0:13:13-0:31:31",
"value": [
{
"string": "https://google.com",
"raw_string": "https://google.com"
"string": "https://google.com"
}
]
}

View file

@ -54,8 +54,7 @@
"range": "d2/testdata/d2compiler/TestCompile/wrong_column_index.d2,1:9:24-1:18:33",
"value": [
{
"string": "sql_table",
"raw_string": "sql_table"
"string": "sql_table"
}
]
}
@ -121,8 +120,7 @@
"range": "d2/testdata/d2compiler/TestCompile/wrong_column_index.d2,2:23:57-2:34:68",
"value": [
{
"string": "primary_key",
"raw_string": "primary_key"
"string": "primary_key"
}
]
}
@ -159,8 +157,7 @@
"range": "d2/testdata/d2compiler/TestCompile/wrong_column_index.d2,3:15:85-3:18:88",
"value": [
{
"string": "int",
"raw_string": "int"
"string": "int"
}
]
}
@ -192,8 +189,7 @@
"range": "d2/testdata/d2compiler/TestCompile/wrong_column_index.d2,4:13:102-4:19:108",
"value": [
{
"string": "string",
"raw_string": "string"
"string": "string"
}
]
}
@ -225,8 +221,7 @@
"range": "d2/testdata/d2compiler/TestCompile/wrong_column_index.d2,5:7:116-5:10:119",
"value": [
{
"string": "int",
"raw_string": "int"
"string": "int"
}
]
}
@ -292,8 +287,7 @@
"range": "d2/testdata/d2compiler/TestCompile/wrong_column_index.d2,6:27:147-6:38:158",
"value": [
{
"string": "foreign_key",
"raw_string": "foreign_key"
"string": "foreign_key"
}
]
}
@ -364,8 +358,7 @@
"range": "d2/testdata/d2compiler/TestCompile/wrong_column_index.d2,7:30:190-7:41:201",
"value": [
{
"string": "foreign_key",
"raw_string": "foreign_key"
"string": "foreign_key"
}
]
}
@ -431,8 +424,7 @@
"range": "d2/testdata/d2compiler/TestCompile/wrong_column_index.d2,11:9:243-11:18:252",
"value": [
{
"string": "sql_table",
"raw_string": "sql_table"
"string": "sql_table"
}
]
}
@ -464,8 +456,7 @@
"range": "d2/testdata/d2compiler/TestCompile/wrong_column_index.d2,12:6:259-12:9:262",
"value": [
{
"string": "int",
"raw_string": "int"
"string": "int"
}
]
}
@ -531,8 +522,7 @@
"range": "d2/testdata/d2compiler/TestCompile/wrong_column_index.d2,13:31:294-13:42:305",
"value": [
{
"string": "foreign_key",
"raw_string": "foreign_key"
"string": "foreign_key"
}
]
}
@ -603,8 +593,7 @@
"range": "d2/testdata/d2compiler/TestCompile/wrong_column_index.d2,14:30:337-14:41:348",
"value": [
{
"string": "foreign_key",
"raw_string": "foreign_key"
"string": "foreign_key"
}
]
}

View file

@ -253,8 +253,7 @@
"range": "d2/testdata/d2compiler/TestCompile2/boards/isFolderOnly.d2,12:13:130-12:26:143",
"value": [
{
"string": "one two three",
"raw_string": "one two three"
"string": "one two three"
}
]
}
@ -608,8 +607,7 @@
"range": "d2/testdata/d2compiler/TestCompile2/boards/isFolderOnly.d2,12:13:130-12:26:143",
"value": [
{
"string": "one two three",
"raw_string": "one two three"
"string": "one two three"
}
]
}
@ -882,8 +880,7 @@
"range": "d2/testdata/d2compiler/TestCompile2/boards/isFolderOnly.d2,12:13:130-12:26:143",
"value": [
{
"string": "one two three",
"raw_string": "one two three"
"string": "one two three"
}
]
}

View file

@ -54,8 +54,7 @@
"range": "d2/testdata/d2compiler/TestCompile2/vars/basic/combined.d2,2:5:14-2:13:22",
"value": [
{
"string": "im a var",
"raw_string": "im a var"
"string": "im a var"
}
]
}
@ -92,31 +91,7 @@
"range": "d2/testdata/d2compiler/TestCompile2/vars/basic/combined.d2,4:4:29-4:12:37",
"value": [
{
"string": "1 ",
"raw_string": "1 "
},
{
"substitution": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/basic/combined.d2,4:6:31-4:10:35",
"spread": false,
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/basic/combined.d2,4:8:33-4:9:34",
"value": [
{
"string": "x",
"raw_string": "x"
}
]
}
}
]
}
},
{
"string": " 2",
"raw_string": "1 2"
"string": "1 im a var 2"
}
]
}
@ -177,7 +152,7 @@
],
"attributes": {
"label": {
"value": "1 "
"value": "1 im a var 2"
},
"labelDimensions": {
"width": 0,

View file

@ -0,0 +1,176 @@
{
"graph": {
"name": "",
"isFolderOnly": false,
"ast": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/basic/double-quoted.d2,0:0:0-5:0:40",
"nodes": [
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/basic/double-quoted.d2,1:0:1-3:1:24",
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/basic/double-quoted.d2,1:0:1-1:4:5",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/basic/double-quoted.d2,1:0:1-1:4:5",
"value": [
{
"string": "vars",
"raw_string": "vars"
}
]
}
}
]
},
"primary": {},
"value": {
"map": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/basic/double-quoted.d2,1:6:7-3:1:24",
"nodes": [
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/basic/double-quoted.d2,2:2:11-2:13:22",
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/basic/double-quoted.d2,2:2:11-2:3:12",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/basic/double-quoted.d2,2:2:11-2:3:12",
"value": [
{
"string": "x",
"raw_string": "x"
}
]
}
}
]
},
"primary": {},
"value": {
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/basic/double-quoted.d2,2:5:14-2:13:22",
"value": [
{
"string": "im a var"
}
]
}
}
}
}
]
}
}
}
},
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/basic/double-quoted.d2,4:0:25-4:14:39",
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/basic/double-quoted.d2,4:0:25-4:2:27",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/basic/double-quoted.d2,4:0:25-4:2:27",
"value": [
{
"string": "hi",
"raw_string": "hi"
}
]
}
}
]
},
"primary": {},
"value": {
"double_quoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/basic/double-quoted.d2,4:4:29-4:14:39",
"value": [
{
"string": "1 im a var 2"
}
]
}
}
}
}
]
},
"root": {
"id": "",
"id_val": "",
"attributes": {
"label": {
"value": ""
},
"labelDimensions": {
"width": 0,
"height": 0
},
"style": {},
"near_key": null,
"shape": {
"value": ""
},
"direction": {
"value": ""
},
"constraint": null
},
"zIndex": 0
},
"edges": null,
"objects": [
{
"id": "hi",
"id_val": "hi",
"references": [
{
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/basic/double-quoted.d2,4:0:25-4:2:27",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/basic/double-quoted.d2,4:0:25-4:2:27",
"value": [
{
"string": "hi",
"raw_string": "hi"
}
]
}
}
]
},
"key_path_index": 0,
"map_key_edge_index": -1
}
],
"attributes": {
"label": {
"value": "1 im a var 2"
},
"labelDimensions": {
"width": 0,
"height": 0
},
"style": {},
"near_key": null,
"shape": {
"value": "rectangle"
},
"direction": {
"value": ""
},
"constraint": null
},
"zIndex": 0
}
]
},
"err": null
}

View file

@ -54,8 +54,7 @@
"range": "d2/testdata/d2compiler/TestCompile2/vars/basic/edge_label.d2,2:5:14-2:13:22",
"value": [
{
"string": "im a var",
"raw_string": "im a var"
"string": "im a var"
}
]
}
@ -111,20 +110,11 @@
],
"primary": {},
"value": {
"substitution": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/basic/edge_label.d2,4:8:33-4:12:37",
"spread": false,
"path": [
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/basic/edge_label.d2,2:5:14-2:13:22",
"value": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/basic/edge_label.d2,4:10:35-4:11:36",
"value": [
{
"string": "x",
"raw_string": "x"
}
]
}
"string": "im a var"
}
]
}

View file

@ -54,8 +54,7 @@
"range": "d2/testdata/d2compiler/TestCompile2/vars/basic/label.d2,2:5:14-2:13:22",
"value": [
{
"string": "im a var",
"raw_string": "im a var"
"string": "im a var"
}
]
}
@ -88,20 +87,11 @@
},
"primary": {},
"value": {
"substitution": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/basic/label.d2,4:4:29-4:8:33",
"spread": false,
"path": [
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/basic/label.d2,2:5:14-2:13:22",
"value": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/basic/label.d2,4:6:31-4:7:32",
"value": [
{
"string": "x",
"raw_string": "x"
}
]
}
"string": "im a var"
}
]
}

View file

@ -102,8 +102,7 @@
"range": "d2/testdata/d2compiler/TestCompile2/vars/basic/nested.d2,4:14:49-4:17:52",
"value": [
{
"string": "red",
"raw_string": "red"
"string": "red"
}
]
}
@ -181,42 +180,11 @@
},
"primary": {},
"value": {
"substitution": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/basic/nested.d2,9:14:85-9:38:109",
"spread": false,
"path": [
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/basic/nested.d2,4:14:49-4:17:52",
"value": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/basic/nested.d2,9:16:87-9:22:93",
"value": [
{
"string": "colors",
"raw_string": "colors"
}
]
}
},
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/basic/nested.d2,9:23:94-9:30:101",
"value": [
{
"string": "primary",
"raw_string": "primary"
}
]
}
},
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/basic/nested.d2,9:31:102-9:37:108",
"value": [
{
"string": "button",
"raw_string": "button"
}
]
}
"string": "red"
}
]
}

View file

@ -108,22 +108,10 @@
},
"primary": {},
"value": {
"substitution": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/basic/number.d2,5:15:44-5:25:54",
"spread": false,
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/basic/number.d2,5:17:46-5:24:53",
"value": [
{
"string": "columns",
"raw_string": "columns"
}
]
}
}
]
"number": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/basic/number.d2,2:10:19-2:11:20",
"raw": "2",
"value": "2"
}
}
}

View file

@ -0,0 +1,173 @@
{
"graph": {
"name": "",
"isFolderOnly": false,
"ast": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/basic/single-quoted.d2,0:0:0-5:0:40",
"nodes": [
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/basic/single-quoted.d2,1:0:1-3:1:24",
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/basic/single-quoted.d2,1:0:1-1:4:5",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/basic/single-quoted.d2,1:0:1-1:4:5",
"value": [
{
"string": "vars",
"raw_string": "vars"
}
]
}
}
]
},
"primary": {},
"value": {
"map": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/basic/single-quoted.d2,1:6:7-3:1:24",
"nodes": [
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/basic/single-quoted.d2,2:2:11-2:13:22",
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/basic/single-quoted.d2,2:2:11-2:3:12",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/basic/single-quoted.d2,2:2:11-2:3:12",
"value": [
{
"string": "x",
"raw_string": "x"
}
]
}
}
]
},
"primary": {},
"value": {
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/basic/single-quoted.d2,2:5:14-2:13:22",
"value": [
{
"string": "im a var"
}
]
}
}
}
}
]
}
}
}
},
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/basic/single-quoted.d2,4:0:25-4:14:39",
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/basic/single-quoted.d2,4:0:25-4:2:27",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/basic/single-quoted.d2,4:0:25-4:2:27",
"value": [
{
"string": "hi",
"raw_string": "hi"
}
]
}
}
]
},
"primary": {},
"value": {
"single_quoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/basic/single-quoted.d2,4:4:29-4:14:39",
"raw": "",
"value": "1 ${x} 2"
}
}
}
}
]
},
"root": {
"id": "",
"id_val": "",
"attributes": {
"label": {
"value": ""
},
"labelDimensions": {
"width": 0,
"height": 0
},
"style": {},
"near_key": null,
"shape": {
"value": ""
},
"direction": {
"value": ""
},
"constraint": null
},
"zIndex": 0
},
"edges": null,
"objects": [
{
"id": "hi",
"id_val": "hi",
"references": [
{
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/basic/single-quoted.d2,4:0:25-4:2:27",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/basic/single-quoted.d2,4:0:25-4:2:27",
"value": [
{
"string": "hi",
"raw_string": "hi"
}
]
}
}
]
},
"key_path_index": 0,
"map_key_edge_index": -1
}
],
"attributes": {
"label": {
"value": "1 ${x} 2"
},
"labelDimensions": {
"width": 0,
"height": 0
},
"style": {},
"near_key": null,
"shape": {
"value": "rectangle"
},
"direction": {
"value": ""
},
"constraint": null
},
"zIndex": 0
}
]
},
"err": null
}

View file

@ -54,8 +54,7 @@
"range": "d2/testdata/d2compiler/TestCompile2/vars/basic/style.d2,2:17:26-2:20:29",
"value": [
{
"string": "red",
"raw_string": "red"
"string": "red"
}
]
}
@ -123,20 +122,11 @@
},
"primary": {},
"value": {
"substitution": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/basic/style.d2,5:14:52-5:30:68",
"spread": false,
"path": [
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/basic/style.d2,2:17:26-2:20:29",
"value": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/basic/style.d2,5:16:54-5:29:67",
"value": [
{
"string": "primary-color",
"raw_string": "primary-color"
}
]
}
"string": "red"
}
]
}

View file

@ -54,8 +54,7 @@
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/layer.d2,2:5:14-2:13:22",
"value": [
{
"string": "im a var",
"raw_string": "im a var"
"string": "im a var"
}
]
}
@ -136,20 +135,11 @@
},
"primary": {},
"value": {
"substitution": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/layer.d2,7:8:51-7:12:55",
"spread": false,
"path": [
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/layer.d2,2:5:14-2:13:22",
"value": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/layer.d2,7:10:53-7:11:54",
"value": [
{
"string": "x",
"raw_string": "x"
}
]
}
"string": "im a var"
}
]
}
@ -246,8 +236,7 @@
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/layer.d2,2:5:14-2:13:22",
"value": [
{
"string": "im a var",
"raw_string": "im a var"
"string": "im a var"
}
]
}
@ -283,8 +272,7 @@
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/layer.d2,2:5:14-2:13:22",
"value": [
{
"string": "im a var",
"raw_string": "im a var"
"string": "im a var"
}
]
}

View file

@ -54,8 +54,7 @@
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/overlay.d2,2:5:14-2:13:22",
"value": [
{
"string": "im x var",
"raw_string": "im x var"
"string": "im x var"
}
]
}
@ -164,8 +163,7 @@
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/overlay.d2,8:9:67-8:17:75",
"value": [
{
"string": "im y var",
"raw_string": "im y var"
"string": "im y var"
}
]
}
@ -198,20 +196,11 @@
},
"primary": {},
"value": {
"substitution": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/overlay.d2,10:7:89-10:11:93",
"spread": false,
"path": [
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/overlay.d2,2:5:14-2:13:22",
"value": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/overlay.d2,10:9:91-10:10:92",
"value": [
{
"string": "x",
"raw_string": "x"
}
]
}
"string": "im x var"
}
]
}
@ -239,20 +228,11 @@
},
"primary": {},
"value": {
"substitution": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/overlay.d2,11:7:101-11:11:105",
"spread": false,
"path": [
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/overlay.d2,8:9:67-8:17:75",
"value": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/overlay.d2,11:9:103-11:10:104",
"value": [
{
"string": "y",
"raw_string": "y"
}
]
}
"string": "im y var"
}
]
}
@ -366,8 +346,7 @@
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/overlay.d2,17:9:151-17:17:159",
"value": [
{
"string": "im y var",
"raw_string": "im y var"
"string": "im y var"
}
]
}
@ -400,20 +379,11 @@
},
"primary": {},
"value": {
"substitution": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/overlay.d2,19:7:173-19:11:177",
"spread": false,
"path": [
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/overlay.d2,2:5:14-2:13:22",
"value": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/overlay.d2,19:9:175-19:10:176",
"value": [
{
"string": "x",
"raw_string": "x"
}
]
}
"string": "im x var"
}
]
}
@ -441,20 +411,11 @@
},
"primary": {},
"value": {
"substitution": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/overlay.d2,20:7:185-20:11:189",
"spread": false,
"path": [
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/overlay.d2,17:9:151-17:17:159",
"value": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/overlay.d2,20:9:187-20:10:188",
"value": [
{
"string": "y",
"raw_string": "y"
}
]
}
"string": "im y var"
}
]
}
@ -551,8 +512,7 @@
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/overlay.d2,2:5:14-2:13:22",
"value": [
{
"string": "im x var",
"raw_string": "im x var"
"string": "im x var"
}
]
}
@ -583,8 +543,7 @@
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/overlay.d2,17:9:151-17:17:159",
"value": [
{
"string": "im y var",
"raw_string": "im y var"
"string": "im y var"
}
]
}
@ -620,8 +579,7 @@
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/overlay.d2,2:5:14-2:13:22",
"value": [
{
"string": "im x var",
"raw_string": "im x var"
"string": "im x var"
}
]
}
@ -652,8 +610,7 @@
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/overlay.d2,17:9:151-17:17:159",
"value": [
{
"string": "im y var",
"raw_string": "im y var"
"string": "im y var"
}
]
}
@ -834,8 +791,7 @@
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/overlay.d2,2:5:14-2:13:22",
"value": [
{
"string": "im x var",
"raw_string": "im x var"
"string": "im x var"
}
]
}
@ -866,8 +822,7 @@
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/overlay.d2,8:9:67-8:17:75",
"value": [
{
"string": "im y var",
"raw_string": "im y var"
"string": "im y var"
}
]
}
@ -903,8 +858,7 @@
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/overlay.d2,2:5:14-2:13:22",
"value": [
{
"string": "im x var",
"raw_string": "im x var"
"string": "im x var"
}
]
}
@ -935,8 +889,7 @@
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/overlay.d2,8:9:67-8:17:75",
"value": [
{
"string": "im y var",
"raw_string": "im y var"
"string": "im y var"
}
]
}

View file

@ -3,7 +3,7 @@
"name": "",
"isFolderOnly": false,
"ast": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/replace.d2,0:0:0-21:0:190",
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/replace.d2,0:0:0-13:0:109",
"nodes": [
{
"map_key": {
@ -54,8 +54,7 @@
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/replace.d2,2:5:14-2:13:22",
"value": [
{
"string": "im x var",
"raw_string": "im x var"
"string": "im x var"
}
]
}
@ -164,8 +163,7 @@
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/replace.d2,8:9:67-8:26:84",
"value": [
{
"string": "im replaced x var",
"raw_string": "im replaced x var"
"string": "im replaced x var"
}
]
}
@ -198,181 +196,11 @@
},
"primary": {},
"value": {
"substitution": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/replace.d2,10:7:98-10:11:102",
"spread": false,
"path": [
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/replace.d2,8:9:67-8:26:84",
"value": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/replace.d2,10:9:100-10:10:101",
"value": [
{
"string": "x",
"raw_string": "x"
}
]
}
}
]
}
}
}
}
]
}
}
}
}
]
}
}
}
},
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/replace.d2,13:0:109-20:1:189",
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/replace.d2,13:0:109-13:6:115",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/replace.d2,13:0:109-13:6:115",
"value": [
{
"string": "layers",
"raw_string": "layers"
}
]
}
}
]
},
"primary": {},
"value": {
"map": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/replace.d2,13:8:117-20:1:189",
"nodes": [
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/replace.d2,14:2:121-19:3:187",
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/replace.d2,14:2:121-14:4:123",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/replace.d2,14:2:121-14:4:123",
"value": [
{
"string": "l2",
"raw_string": "l2"
}
]
}
}
]
},
"primary": {},
"value": {
"map": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/replace.d2,14:6:125-19:3:187",
"nodes": [
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/replace.d2,15:4:131-17:5:171",
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/replace.d2,15:4:131-15:8:135",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/replace.d2,15:4:131-15:8:135",
"value": [
{
"string": "vars",
"raw_string": "vars"
}
]
}
}
]
},
"primary": {},
"value": {
"map": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/replace.d2,15:10:137-17:5:171",
"nodes": [
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/replace.d2,16:6:145-16:26:165",
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/replace.d2,16:6:145-16:7:146",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/replace.d2,16:6:145-16:7:146",
"value": [
{
"string": "x",
"raw_string": "x"
}
]
}
}
]
},
"primary": {},
"value": {
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/replace.d2,16:9:148-16:26:165",
"value": [
{
"string": "im replaced x var",
"raw_string": "im replaced x var"
}
]
}
}
}
}
]
}
}
}
},
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/replace.d2,18:4:176-18:11:183",
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/replace.d2,18:4:176-18:5:177",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/replace.d2,18:4:176-18:5:177",
"value": [
{
"string": "x",
"raw_string": "x"
}
]
}
}
]
},
"primary": {},
"value": {
"substitution": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/replace.d2,18:7:179-18:11:183",
"spread": false,
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/replace.d2,18:9:181-18:10:182",
"value": [
{
"string": "x",
"raw_string": "x"
}
]
}
"string": "im replaced x var"
}
]
}
@ -416,180 +244,6 @@
},
"edges": null,
"objects": null,
"layers": [
{
"name": "l2",
"isFolderOnly": false,
"ast": {
"range": ",1:0:0-2:0:0",
"nodes": [
{
"map_key": {
"range": ",0:0:0-0:0:0",
"key": {
"range": ",0:0:0-0:0:0",
"path": [
{
"unquoted_string": {
"range": ",0:0:0-0:0:0",
"value": [
{
"string": "vars"
}
]
}
}
]
},
"primary": {},
"value": {
"map": {
"range": ",1:0:0-2:0:0",
"nodes": [
{
"map_key": {
"range": ",0:0:0-0:0:0",
"key": {
"range": ",0:0:0-0:0:0",
"path": [
{
"unquoted_string": {
"range": ",0:0:0-0:0:0",
"value": [
{
"string": "x"
}
]
}
}
]
},
"primary": {
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/replace.d2,16:9:148-16:26:165",
"value": [
{
"string": "im replaced x var",
"raw_string": "im replaced x var"
}
]
}
},
"value": {}
}
}
]
}
}
}
},
{
"map_key": {
"range": ",0:0:0-0:0:0",
"key": {
"range": ",0:0:0-0:0:0",
"path": [
{
"unquoted_string": {
"range": ",0:0:0-0:0:0",
"value": [
{
"string": "x"
}
]
}
}
]
},
"primary": {
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/replace.d2,16:9:148-16:26:165",
"value": [
{
"string": "im replaced x var",
"raw_string": "im replaced x var"
}
]
}
},
"value": {}
}
}
]
},
"root": {
"id": "",
"id_val": "",
"attributes": {
"label": {
"value": ""
},
"labelDimensions": {
"width": 0,
"height": 0
},
"style": {},
"near_key": null,
"shape": {
"value": ""
},
"direction": {
"value": ""
},
"constraint": null
},
"zIndex": 0
},
"edges": null,
"objects": [
{
"id": "x",
"id_val": "x",
"references": [
{
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/replace.d2,18:4:176-18:5:177",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/replace.d2,18:4:176-18:5:177",
"value": [
{
"string": "x",
"raw_string": "x"
}
]
}
}
]
},
"key_path_index": 0,
"map_key_edge_index": -1
}
],
"attributes": {
"label": {
"value": "im replaced x var"
},
"labelDimensions": {
"width": 0,
"height": 0
},
"style": {},
"near_key": null,
"shape": {
"value": "rectangle"
},
"direction": {
"value": ""
},
"constraint": null
},
"zIndex": 0
}
]
}
],
"scenarios": [
{
"name": "l",
@ -643,8 +297,7 @@
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/replace.d2,8:9:67-8:26:84",
"value": [
{
"string": "im replaced x var",
"raw_string": "im replaced x var"
"string": "im replaced x var"
}
]
}
@ -680,8 +333,7 @@
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/replace.d2,8:9:67-8:26:84",
"value": [
{
"string": "im replaced x var",
"raw_string": "im replaced x var"
"string": "im replaced x var"
}
]
}

View file

@ -54,8 +54,7 @@
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/scenario.d2,2:5:14-2:13:22",
"value": [
{
"string": "im a var",
"raw_string": "im a var"
"string": "im a var"
}
]
}
@ -136,20 +135,11 @@
},
"primary": {},
"value": {
"substitution": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/scenario.d2,7:8:54-7:12:58",
"spread": false,
"path": [
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/scenario.d2,2:5:14-2:13:22",
"value": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/scenario.d2,7:10:56-7:11:57",
"value": [
{
"string": "x",
"raw_string": "x"
}
]
}
"string": "im a var"
}
]
}
@ -246,8 +236,7 @@
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/scenario.d2,2:5:14-2:13:22",
"value": [
{
"string": "im a var",
"raw_string": "im a var"
"string": "im a var"
}
]
}
@ -283,8 +272,7 @@
"range": "d2/testdata/d2compiler/TestCompile2/vars/boards/scenario.d2,2:5:14-2:13:22",
"value": [
{
"string": "im a var",
"raw_string": "im a var"
"string": "im a var"
}
]
}

View file

@ -54,8 +54,7 @@
"range": "d2/testdata/d2compiler/TestCompile2/vars/override/label.d2,2:5:14-2:13:22",
"value": [
{
"string": "im a var",
"raw_string": "im a var"
"string": "im a var"
}
]
}
@ -88,20 +87,11 @@
},
"primary": {},
"value": {
"substitution": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/override/label.d2,4:4:29-4:8:33",
"spread": false,
"path": [
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/override/label.d2,2:5:14-2:13:22",
"value": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/vars/override/label.d2,4:6:31-4:7:32",
"value": [
{
"string": "x",
"raw_string": "x"
}
]
}
"string": "im a var"
}
]
}
@ -133,8 +123,7 @@
"range": "d2/testdata/d2compiler/TestCompile2/vars/override/label.d2,5:4:38-5:13:47",
"value": [
{
"string": "not a var",
"raw_string": "not a var"
"string": "not a var"
}
]
}