diff --git a/grammars/arm-expression-string.tmLanguage.json b/grammars/arm-expression-string.tmLanguage.json index fa510c519..20973f4fd 100644 --- a/grammars/arm-expression-string.tmLanguage.json +++ b/grammars/arm-expression-string.tmLanguage.json @@ -6,6 +6,8 @@ "$preprocessComment2": "The 'builtin' key/value are special - they're created during build from our function metadata", "$preprocessComment3": "Currently you need to run 'build grammars' after changing this file", "preprocess": { + "escaped-json-character": "(?:\\\\(?:[\"\\\\/bfnrt]|u[0-9a-fA-F]{4}))", + "escaped-apostrophe": "(?:[']['])", "idchar": "[_$[:alnum:]]", "id": "(?:[_$[:alpha:]]{{idchar}}*)", "ns-userfunc": "(?:({{id}})\\s*(\\.)\\s*({{id}}))", @@ -42,8 +44,9 @@ "repository": { "expressionstring": { "name": "meta.expression.tle.arm", - "begin": "\"\\[(?!\\[)", - "$beginComment": "A string that starts with [[ is not an expression", + "$begin": "(?x) \"\\[(?!\\[) (?= .*) \\]\"", + "begin": "(?x) \"\\[(?!\\[) (?= ([^\"]|{{escaped-json-character}}|5)* \\]\" )", + "$beginComment": "An expression must start with [ (no whitespace before), not start with [[, and end with ] (no whitespace after)", "end": "\\]\"", "beginCaptures": { "0": {