From 0f45d2b08274ec9bc096d6b9204d28315b3b957d Mon Sep 17 00:00:00 2001 From: Anmol Sethi Date: Sat, 29 Jul 2023 17:50:40 -0700 Subject: [PATCH] d2ast: Fix RawString test with ampersand --- d2ast/d2ast.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/d2ast/d2ast.go b/d2ast/d2ast.go index 102429b7a..3f9c99ad1 100644 --- a/d2ast/d2ast.go +++ b/d2ast/d2ast.go @@ -1099,12 +1099,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 +1116,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, '"') {