{
  "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
  "name": "bicep",
  "scopeName": "source.bicep",
  "fileTypes": [".bicep"],
  "patterns": [
    {
      "include": "#expression"
    },
    {
      "include": "#comments"
    }
  ],
  "repository": {
    "array-literal": {
      "name": "meta.array-literal.bicep",
      "begin": "\\[(?!(?:[ \\t\\r\\n]|\\/\\*(?:\\*(?!\\/)|[^*])*\\*\\/)*\\bfor\\b)",
      "end": "]",
      "patterns": [
        {
          "include": "#expression"
        },
        {
          "include": "#comments"
        }
      ]
    },
    "block-comment": {
      "name": "comment.block.bicep",
      "begin": "/\\*",
      "end": "\\*/"
    },
    "comments": {
      "patterns": [
        {
          "include": "#line-comment"
        },
        {
          "include": "#block-comment"
        }
      ]
    },
    "decorator": {
      "name": "meta.decorator.bicep",
      "begin": "@(?:[ \\t\\r\\n]|\\/\\*(?:\\*(?!\\/)|[^*])*\\*\\/)*(?=\\b[_$[:alpha:]][_$[:alnum:]]*\\b)",
      "end": "",
      "patterns": [
        {
          "include": "#expression"
        },
        {
          "include": "#comments"
        }
      ]
    },
    "directive": {
      "name": "meta.directive.bicep",
      "begin": "#\\b[_a-zA-Z-0-9]+\\b",
      "end": "$",
      "patterns": [
        {
          "include": "#directive-variable"
        },
        {
          "include": "#comments"
        }
      ]
    },
    "directive-variable": {
      "name": "keyword.control.declaration.bicep",
      "match": "\\b[_a-zA-Z-0-9]+\\b"
    },
    "escape-character": {
      "name": "constant.character.escape.bicep",
      "match": "\\\\(u{[0-9A-Fa-f]+}|n|r|t|\\\\|'|\\${)"
    },
    "expression": {
      "patterns": [
        {
          "include": "#string-literal"
        },
        {
          "include": "#string-verbatim"
        },
        {
          "include": "#numeric-literal"
        },
        {
          "include": "#named-literal"
        },
        {
          "include": "#object-literal"
        },
        {
          "include": "#array-literal"
        },
        {
          "include": "#keyword"
        },
        {
          "include": "#identifier"
        },
        {
          "include": "#function-call"
        },
        {
          "include": "#decorator"
        },
        {
          "include": "#lambda-start"
        },
        {
          "include": "#directive"
        }
      ]
    },
    "function-call": {
      "name": "meta.function-call.bicep",
      "begin": "(\\b[_$[:alpha:]][_$[:alnum:]]*\\b)(?:[ \\t\\r\\n]|\\/\\*(?:\\*(?!\\/)|[^*])*\\*\\/)*\\(",
      "beginCaptures": {
        "1": {
          "name": "entity.name.function.bicep"
        }
      },
      "end": "\\)",
      "patterns": [
        {
          "include": "#expression"
        },
        {
          "include": "#comments"
        }
      ]
    },
    "identifier": {
      "name": "variable.other.readwrite.bicep",
      "match": "\\b[_$[:alpha:]][_$[:alnum:]]*\\b(?!(?:[ \\t\\r\\n]|\\/\\*(?:\\*(?!\\/)|[^*])*\\*\\/)*\\()"
    },
    "keyword": {
      "name": "keyword.control.declaration.bicep",
      "match": "\\b(metadata|targetScope|resource|module|param|var|output|for|in|if|existing|import|as|type|with|using|func|assert|provider)\\b"
    },
    "lambda-start": {
      "name": "meta.lambda-start.bicep",
      "begin": "(\\((?:[ \\t\\r\\n]|\\/\\*(?:\\*(?!\\/)|[^*])*\\*\\/)*\\b[_$[:alpha:]][_$[:alnum:]]*\\b(?:[ \\t\\r\\n]|\\/\\*(?:\\*(?!\\/)|[^*])*\\*\\/)*(,(?:[ \\t\\r\\n]|\\/\\*(?:\\*(?!\\/)|[^*])*\\*\\/)*\\b[_$[:alpha:]][_$[:alnum:]]*\\b(?:[ \\t\\r\\n]|\\/\\*(?:\\*(?!\\/)|[^*])*\\*\\/)*)*\\)|\\((?:[ \\t\\r\\n]|\\/\\*(?:\\*(?!\\/)|[^*])*\\*\\/)*\\)|(?:[ \\t\\r\\n]|\\/\\*(?:\\*(?!\\/)|[^*])*\\*\\/)*\\b[_$[:alpha:]][_$[:alnum:]]*\\b(?:[ \\t\\r\\n]|\\/\\*(?:\\*(?!\\/)|[^*])*\\*\\/)*)(?=(?:[ \\t\\r\\n]|\\/\\*(?:\\*(?!\\/)|[^*])*\\*\\/)*=>)",
      "beginCaptures": {
        "1": {
          "name": "meta.undefined.bicep",
          "patterns": [
            {
              "include": "#identifier"
            },
            {
              "include": "#comments"
            }
          ]
        }
      },
      "end": "(?:[ \\t\\r\\n]|\\/\\*(?:\\*(?!\\/)|[^*])*\\*\\/)*=>"
    },
    "line-comment": {
      "name": "comment.line.double-slash.bicep",
      "match": "//.*(?=$)"
    },
    "named-literal": {
      "name": "constant.language.bicep",
      "match": "\\b(true|false|null)\\b"
    },
    "numeric-literal": {
      "name": "constant.numeric.bicep",
      "match": "[0-9]+"
    },
    "object-literal": {
      "name": "meta.object-literal.bicep",
      "begin": "{",
      "end": "}",
      "patterns": [
        {
          "include": "#object-property-key"
        },
        {
          "include": "#expression"
        },
        {
          "include": "#comments"
        }
      ]
    },
    "object-property-key": {
      "name": "variable.other.property.bicep",
      "match": "\\b[_$[:alpha:]][_$[:alnum:]]*\\b(?=(?:[ \\t\\r\\n]|\\/\\*(?:\\*(?!\\/)|[^*])*\\*\\/)*:)"
    },
    "string-literal": {
      "name": "string.quoted.single.bicep",
      "begin": "'(?!'')",
      "end": "'",
      "patterns": [
        {
          "include": "#escape-character"
        },
        {
          "include": "#string-literal-subst"
        }
      ]
    },
    "string-literal-subst": {
      "name": "meta.string-literal-subst.bicep",
      "begin": "(?<!\\\\)(\\${)",
      "beginCaptures": {
        "1": {
          "name": "punctuation.definition.template-expression.begin.bicep"
        }
      },
      "end": "(})",
      "endCaptures": {
        "1": {
          "name": "punctuation.definition.template-expression.end.bicep"
        }
      },
      "patterns": [
        {
          "include": "#expression"
        },
        {
          "include": "#comments"
        }
      ]
    },
    "string-verbatim": {
      "name": "string.quoted.multi.bicep",
      "begin": "'''",
      "end": "'''",
      "patterns": []
    }
  }
}
