{
  "name": "Azure logic apps expression language",
  "scopeName": "source.azLgcAppExp",
  "patterns": [
    {
      "include": "#expressionString"
    }
  ],
  "repository": {
    "expressionString": {
      "patterns": [
        {
          "include": "#atTemplateSubstitutionElement"
        },
        {
          "include": "#dualAtSymbol"
        },
        {
          "include": "#atRootFunctionCallExpression"
        },
        {
          "include": "#incompleteAtRootFunctionCallExpression"
        }
      ]
    },
    "incompleteAtRootFunctionCallExpression": {
      "$impostureLang": {
        "type": "incomplete-root-function-call-expression",
        "dataType": "incomplete-root-function-call-expression"
      },
      "applyEndPatternLast": true,
      "name": "meta.expression.function.call.incomplete.azLgcAppExp",
      "begin": "(?=((@([_$[:alpha:]][_$[:alnum:]]*)?(\\s*\\??\\.\\s*([_$[:alpha:]][_$[:alnum:]]*))*))\\s*(?:(\\?\\.\\s*)|(\\!)|(\\())?)",
      "end": "((?x)(\n\t(?=[^[:alnum:]\\.\\?\\(\\)])\n\t(?!(\n\t\t\t(\n\t\t\t\t(\n\t\t\t\t\t@([_$[:alpha:]][_$[:alnum:]]*)?\n\t\t\t\t\t(\n\t\t\t\t\t\t\\s*\\??\\.\\s*([_$[:alpha:]][_$[:alnum:]]*)\n\t\t\t\t\t)*\n\t\t\t\t)|\n\t\t\t\t(\n\t\t\t\t\t\\??\\.\\s*[_$[:alpha:]][_$[:alnum:]]*\n\t\t\t\t)\n\t\t\t)|\n\t\t\t(?<=[\\)])\n\t\t)\n\t\t\\s*\n\t\t(?:\n\t\t\t(\\?\\.\\s*)|\n\t\t\t(\\!)\n\t\t)?\n\t\t(\\()\n\t)\n))|\\Z",
      "patterns": [
        {
          "include": "#atSymbol"
        },
        {
          "include": "#function-call"
        },
        {
          "include": "#identifiers"
        }
      ]
    },
    "atRootFunctionCallExpression": {
      "$impostureLang": {
        "type": "root-function-call-expression",
        "dataType": "root-function-call-expression"
      },
      "applyEndPatternLast": true,
      "name": "meta.expression.function.call.azLgcAppExp",
      "begin": "(?=((@([_$[:alpha:]][_$[:alnum:]]*)(\\s*\\??\\.\\s*([_$[:alpha:]][_$[:alnum:]]*))*))\\s*(?:(\\?\\.\\s*)|(\\!))?(\\())",
      "end": "((?<=\\))(?!(((@([_$[:alpha:]][_$[:alnum:]]*)?(\\s*\\??\\.\\s*([_$[:alpha:]][_$[:alnum:]]*))*)|(\\??\\.\\s*[_$[:alpha:]][_$[:alnum:]]*))|(?<=[\\)]))\\s*(?:(\\?\\.\\s*)|(\\!))?(\\()))|\\Z",
      "patterns": [
        {
          "include": "#atTemplateSubstitutionElement"
        },
        {
          "include": "#atSymbol"
        },
        {
          "include": "#atExpression"
        }
      ]
    },
    "atTemplateSubstitutionElement": {
      "patterns": [
        {
          "$impostureLang": {
            "type": "atTemplateSubstitutionElement-p0",
            "dataType": "atTemplateSubstitutionElement"
          },
          "name": "meta.template.expression.azLgcAppExp",
          "begin": "(?=(@)(\\{))",
          "beginCaptures": {
            "0": {
              "name": "punctuation.definition.template.expression.begin.azLgcAppExp"
            },
            "1": {
              "name": "keyword.symbol.at.azLgcAppExp"
            }
          },
          "end": "\\}",
          "endCaptures": {
            "0": {
              "name": "punctuation.definition.template.expression.end.azLgcAppExp"
            }
          },
          "patterns": [
            {
              "include": "#atExpression"
            }
          ]
        }
      ]
    },
    "dualAtSymbol": {
      "$impostureLang": {
        "type": "dualAtSymbol",
        "dataType": "dualAtSymbol"
      },
      "name": "constant.character.escape.azLgcAppExp",
      "match": "[@]{2}"
    },
    "atSymbol": {
      "$impostureLang": {
        "type": "atSymbol",
        "dataType": "atSymbol"
      },
      "name": "keyword.symbol.at.azLgcAppExp",
      "match": "[@]{1}"
    },
    "atExpression": {
      "patterns": [
        {
          "include": "#expressionWithoutIdentifiers"
        },
        {
          "include": "#identifiers"
        },
        {
          "include": "#expressionPunctuations"
        }
      ]
    },
    "expressionWithoutIdentifiers": {
      "patterns": [
        {
          "include": "#string"
        },
        {
          "include": "#function-call"
        },
        {
          "include": "#literal"
        },
        {
          "include": "#paren-expression"
        }
      ]
    },
    "expressionPunctuations": {
      "patterns": [
        {
          "include": "#punctuation-comma"
        },
        {
          "include": "#punctuation-accessor"
        }
      ]
    },
    "function-call": {
      "$impostureLang": {
        "type": "function-call-complete",
        "dataType": "function-call-complete"
      },
      "begin": "(?=(((([_$[:alpha:]][_$[:alnum:]]*)(\\s*\\??\\.\\s*([_$[:alpha:]][_$[:alnum:]]*))*)|(\\??\\.\\s*[_$[:alpha:]][_$[:alnum:]]*))|(?<=[\\)]))\\s*(?:(\\?\\.\\s*)|(\\!))?(\\())",
      "end": "(?<=\\))(?!(((([_$[:alpha:]][_$[:alnum:]]*)(\\s*\\??\\.\\s*([_$[:alpha:]][_$[:alnum:]]*))*)|(\\??\\.\\s*[_$[:alpha:]][_$[:alnum:]]*))|(?<=[\\)]))\\s*(?:(\\?\\.\\s*)|(\\!))?(\\())",
      "patterns": [
        {
          "$impostureLang": {
            "type": "function-call-full-name",
            "dataType": "function-call"
          },
          "name": "meta.function-call.azLgcAppExp",
          "begin": "(?=(([_$[:alpha:]][_$[:alnum:]]*)(\\s*\\??\\.\\s*([_$[:alpha:]][_$[:alnum:]]*))*)|(\\??\\.\\s*[_$[:alpha:]][_$[:alnum:]]*))",
          "end": "(?=\\s*(?:(\\?\\.\\s*)|(\\!))?(\\())",
          "patterns": [
            {
              "include": "#function-call-target"
            }
          ]
        },
        {
          "include": "#paren-expression"
        }
      ]
    },
    "function-call-target": {
      "patterns": [
        {
          "include": "#support-function-call-identifiers"
        },
        {
          "$impostureLang": {
            "type": "function-call-target-name",
            "dataType": "function-call-target"
          },
          "name": "entity.name.function.azLgcAppExp",
          "match": "([_$[:alpha:]][_$[:alnum:]]*)"
        }
      ]
    },
    "support-function-call-identifiers": {
      "patterns": [
        {
          "include": "#literal"
        },
        {
          "include": "#object-identifiers"
        },
        {
          "include": "#punctuation-accessor"
        }
      ]
    },
    "paren-expression": {
      "$impostureLang": {
        "type": "paren-expression",
        "dataType": "parentheses"
      },
      "begin": "\\(",
      "beginCaptures": {
        "0": {
          "name": "meta.brace.round.azLgcAppExp"
        }
      },
      "end": "\\)",
      "endCaptures": {
        "0": {
          "name": "meta.brace.round.azLgcAppExp"
        }
      },
      "patterns": [
        {
          "include": "#atExpression"
        }
      ]
    },
    "literal": {
      "patterns": [
        {
          "include": "#numeric-literal"
        },
        {
          "include": "#boolean-literal"
        },
        {
          "include": "#null-literal"
        },
        {
          "include": "#array-literal"
        }
      ]
    },
    "array-literal": {
      "$impostureLang": {
        "type": "array-literal",
        "dataType": "array-literal"
      },
      "name": "meta.array.literal.azLgcAppExp",
      "begin": "\\s*(\\[)",
      "beginCaptures": {
        "1": {
          "name": "meta.brace.square.azLgcAppExp"
        }
      },
      "end": "\\]",
      "endCaptures": {
        "0": {
          "name": "meta.brace.square.azLgcAppExp"
        }
      },
      "patterns": [
        {
          "include": "#atExpression"
        },
        {
          "include": "#punctuation-comma"
        }
      ]
    },
    "numeric-literal": {
      "patterns": [
        {
          "$impostureLang": {
            "type": "numeric-literal",
            "dataType": "number"
          },
          "name": "constant.numeric.octal.azLgcAppExp",
          "match": "\\b(?<!\\$)0(?:O)?[0-7][0-7_]*(n)?\\b(?!\\$)",
          "captures": {
            "1": {
              "$impostureLang": {
                "type": "numeric-literal",
                "dataType": "number"
              },
              "name": "storage.type.numeric.bigint.azLgcAppExp"
            }
          }
        },
        {
          "$impostureLang": {
            "type": "numeric-literal",
            "dataType": "number"
          },
          "match": "(?x)\n(?<!\\$)(?:\n  (?:[+-]?\\b[0-9][0-9_]*(\\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\\b)| # 1.1E+3\n  (?:[+-]?\\b[0-9][0-9_]*(\\.)[eE][+-]?[0-9][0-9_]*(n)?\\b)|             # 1.E+3\n  (?:[+-]?\\B(\\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\\b)|             # .1E+3\n  (?:[+-]?\\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\\b)|                 # 1E+3\n  (?:[+-]?\\b[0-9][0-9_]*(\\.)[0-9][0-9_]*(n)?\\b)|                      # 1.1\n  (?:[+-]?\\b[0-9][0-9_]*(\\.)(n)?\\B)|                                  # 1.\n  (?:[+-]?\\B(\\.)[0-9][0-9_]*(n)?\\b)|                                  # .1\n  (?:[+-]?\\b[0-9][0-9_]*(n)?\\b(?!\\.))                                 # 1\n)(?!\\$)",
          "captures": {
            "0": {
              "$impostureLang": {
                "type": "numeric-literal",
                "dataType": "number"
              },
              "name": "constant.numeric.decimal.azLgcAppExp"
            },
            "1": {
              "$impostureLang": {
                "type": "numeric-literal",
                "dataType": "number"
              },
              "name": "meta.delimiter.decimal.period.azLgcAppExp"
            },
            "2": {
              "$impostureLang": {
                "type": "numeric-literal",
                "dataType": "number"
              },
              "name": "storage.type.numeric.bigint.azLgcAppExp"
            },
            "3": {
              "$impostureLang": {
                "type": "numeric-literal",
                "dataType": "number"
              },
              "name": "meta.delimiter.decimal.period.azLgcAppExp"
            },
            "4": {
              "$impostureLang": {
                "type": "numeric-literal",
                "dataType": "number"
              },
              "name": "storage.type.numeric.bigint.azLgcAppExp"
            },
            "5": {
              "$impostureLang": {
                "type": "numeric-literal",
                "dataType": "number"
              },
              "name": "meta.delimiter.decimal.period.azLgcAppExp"
            },
            "6": {
              "$impostureLang": {
                "type": "numeric-literal",
                "dataType": "number"
              },
              "name": "storage.type.numeric.bigint.azLgcAppExp"
            },
            "7": {
              "$impostureLang": {
                "type": "numeric-literal",
                "dataType": "number"
              },
              "name": "storage.type.numeric.bigint.azLgcAppExp"
            },
            "8": {
              "$impostureLang": {
                "type": "numeric-literal",
                "dataType": "number"
              },
              "name": "meta.delimiter.decimal.period.azLgcAppExp"
            },
            "9": {
              "$impostureLang": {
                "type": "numeric-literal",
                "dataType": "number"
              },
              "name": "storage.type.numeric.bigint.azLgcAppExp"
            },
            "10": {
              "$impostureLang": {
                "type": "numeric-literal",
                "dataType": "number"
              },
              "name": "meta.delimiter.decimal.period.azLgcAppExp"
            },
            "11": {
              "$impostureLang": {
                "type": "numeric-literal",
                "dataType": "number"
              },
              "name": "storage.type.numeric.bigint.azLgcAppExp"
            },
            "12": {
              "$impostureLang": {
                "type": "numeric-literal",
                "dataType": "number"
              },
              "name": "meta.delimiter.decimal.period.azLgcAppExp"
            },
            "13": {
              "$impostureLang": {
                "type": "numeric-literal",
                "dataType": "number"
              },
              "name": "storage.type.numeric.bigint.azLgcAppExp"
            },
            "14": {
              "$impostureLang": {
                "type": "numeric-literal",
                "dataType": "number"
              },
              "name": "storage.type.numeric.bigint.azLgcAppExp"
            }
          }
        }
      ]
    },
    "boolean-literal": {
      "patterns": [
        {
          "$impostureLang": {
            "type": "boolean-literal",
            "dataType": "boolean"
          },
          "name": "constant.language.boolean.true.azLgcAppExp",
          "match": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))true(?![_$[:alnum:]])(?:(?=\\.\\.\\.)|(?!\\.))"
        },
        {
          "$impostureLang": {
            "type": "boolean-literal",
            "dataType": "boolean"
          },
          "name": "constant.language.boolean.false.azLgcAppExp",
          "match": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))false(?![_$[:alnum:]])(?:(?=\\.\\.\\.)|(?!\\.))"
        }
      ]
    },
    "null-literal": {
      "$impostureLang": {
        "type": "null-literal",
        "dataType": "null"
      },
      "name": "constant.language.null.azLgcAppExp",
      "match": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))null(?![_$[:alnum:]])(?:(?=\\.\\.\\.)|(?!\\.))"
    },
    "punctuation-accessor": {
      "$impostureLang": {
        "type": "punctuation-accessor",
        "dataType": "punctuation"
      },
      "match": "(?:(\\.)|(\\?\\.(?!\\s*[[:digit:]])))",
      "captures": {
        "1": {
          "$impostureLang": {
            "type": "punctuation-accessor-c1",
            "dataType": "punctuation-capture"
          },
          "name": "punctuation.accessor.azLgcAppExp"
        },
        "2": {
          "$impostureLang": {
            "type": "punctuation-accessor-c2",
            "dataType": "punctuation-capture"
          },
          "name": "punctuation.accessor.optional.azLgcAppExp"
        }
      }
    },
    "identifiers": {
      "patterns": [
        {
          "include": "#object-identifiers"
        },
        {
          "$impostureLang": {
            "type": "identifiers-p1",
            "dataType": "identifiers:wPunctuation"
          },
          "match": "(?:(\\.)|(\\?\\.(?!\\s*[[:digit:]])))\\s*([[:upper:]][_$[:digit:][:upper:]]*)(?![_$[:alnum:]])",
          "captures": {
            "1": {
              "$impostureLang": {
                "type": "identifiers-p1-c1",
                "dataType": "identifiers-capture"
              },
              "name": "punctuation.accessor.azLgcAppExp"
            },
            "2": {
              "$impostureLang": {
                "type": "identifiers-p1-c2",
                "dataType": "identifiers-capture"
              },
              "name": "punctuation.accessor.optional.azLgcAppExp"
            },
            "3": {
              "$impostureLang": {
                "type": "identifiers-p1-c3",
                "dataType": "identifiers-capture"
              },
              "name": "variable.other.constant.property.azLgcAppExp"
            }
          }
        },
        {
          "$impostureLang": {
            "type": "identifiers-p2",
            "dataType": "identifiers:wPunctuation"
          },
          "match": "(?:(\\.)|(\\?\\.(?!\\s*[[:digit:]])))\\s*([_$[:alpha:]][_$[:alnum:]]*)",
          "captures": {
            "1": {
              "$impostureLang": {
                "type": "identifiers-p2-c1",
                "dataType": "identifiers-capture"
              },
              "name": "punctuation.accessor.azLgcAppExp"
            },
            "2": {
              "$impostureLang": {
                "type": "identifiers-p2-c2",
                "dataType": "identifiers-capture"
              },
              "name": "punctuation.accessor.optional.azLgcAppExp"
            },
            "3": {
              "$impostureLang": {
                "type": "identifiers-p2-c3",
                "dataType": "identifiers-capture"
              },
              "name": "variable.other.property.azLgcAppExp"
            }
          }
        },
        {
          "$impostureLang": {
            "type": "array-literal:wPunctuation",
            "dataType": "array-literal"
          },
          "name": "meta.array.literal.azLgcAppExp",
          "begin": "\\s*(\\?)(\\[)",
          "beginCaptures": {
            "1": {
              "name": "punctuation.accessor.optional.azLgcAppExp"
            },
            "2": {
              "name": "meta.brace.square.azLgcAppExp"
            }
          },
          "end": "\\]",
          "endCaptures": {
            "0": {
              "name": "meta.brace.square.azLgcAppExp"
            }
          },
          "patterns": [
            {
              "include": "#atExpression"
            },
            {
              "include": "#punctuation-comma"
            }
          ]
        },
        {
          "$impostureLang": {
            "type": "identifiers-p3",
            "dataType": "identifiers"
          },
          "name": "variable.other.constant.azLgcAppExp",
          "match": "([[:upper:]][_$[:digit:][:upper:]]*)(?![_$[:alnum:]])"
        },
        {
          "$impostureLang": {
            "type": "identifiers-p4",
            "dataType": "identifiers"
          },
          "name": "variable.other.readwrite.azLgcAppExp",
          "match": "[_$[:alpha:]][_$[:alnum:]]*"
        }
      ]
    },
    "object-identifiers": {
      "patterns": [
        {
          "$impostureLang": {
            "type": "object-identifiers-p0",
            "dataType": "object-identifiers:wPunctuation"
          },
          "match": "(?x)(?:(\\.)|(\\?\\.(?!\\s*[[:digit:]])))\\s*(?:\n  ([[:upper:]][_$[:digit:][:upper:]]*) |\n  ([_$[:alpha:]][_$[:alnum:]]*)\n)(?=\\s*\\??\\.\\s*[_$[:alpha:]][_$[:alnum:]]*)",
          "captures": {
            "1": {
              "$impostureLang": {
                "type": "object-identifiers-p0-c1",
                "dataType": "object-identifiers-captures"
              },
              "name": "punctuation.accessor.azLgcAppExp"
            },
            "2": {
              "$impostureLang": {
                "type": "object-identifiers-p0-c2",
                "dataType": "object-identifiers-captures"
              },
              "name": "punctuation.accessor.optional.azLgcAppExp"
            },
            "3": {
              "$impostureLang": {
                "type": "object-identifiers-p0-c3",
                "dataType": "object-identifiers-captures"
              },
              "name": "variable.other.constant.object.property.azLgcAppExp"
            },
            "4": {
              "$impostureLang": {
                "type": "object-identifiers-p0-c4",
                "dataType": "object-identifiers-captures"
              },
              "name": "variable.other.object.property.azLgcAppExp"
            }
          }
        },
        {
          "$impostureLang": {
            "type": "object-identifiers-p1",
            "dataType": "object-identifiers"
          },
          "match": "(?x)(?:\n  ([[:upper:]][_$[:digit:][:upper:]]*) |\n  ([_$[:alpha:]][_$[:alnum:]]*)\n)(?=\\s*\\??\\.\\s*[_$[:alpha:]][_$[:alnum:]]*)",
          "captures": {
            "1": {
              "$impostureLang": {
                "type": "object-identifiers-p1-c1",
                "dataType": "object-identifiers-captures"
              },
              "name": "variable.other.constant.object.azLgcAppExp"
            },
            "2": {
              "$impostureLang": {
                "type": "object-identifiers-p1-c1",
                "dataType": "object-identifiers-captures"
              },
              "name": "variable.other.object.azLgcAppExp"
            }
          }
        }
      ]
    },
    "string": {
      "patterns": [
        {
          "include": "#qstring-single"
        },
        {
          "include": "#qstring-double"
        }
      ]
    },
    "punctuation-comma": {
      "$impostureLang": {
        "type": "punctuation-comma",
        "dataType": "comma"
      },
      "name": "punctuation.separator.comma.azLgcAppExp",
      "match": ","
    },
    "qstring-double": {
      "$impostureLang": {
        "type": "qstring-double",
        "dataType": "string"
      },
      "name": "string.quoted.double.azLgcAppExp",
      "begin": "\"",
      "beginCaptures": {
        "0": {
          "name": "punctuation.definition.string.begin.azLgcAppExp"
        }
      },
      "end": "(\")|((?:[^\\\\\\n])$)",
      "endCaptures": {
        "1": {
          "name": "punctuation.definition.string.end.azLgcAppExp"
        },
        "2": {
          "name": "invalid.illegal.newline.azLgcAppExp"
        }
      },
      "patterns": [
        {
          "include": "#string-character-escape"
        }
      ]
    },
    "qstring-single": {
      "$impostureLang": {
        "type": "qstring-single",
        "dataType": "string"
      },
      "name": "string.quoted.single.azLgcAppExp",
      "begin": "'",
      "beginCaptures": {
        "0": {
          "name": "punctuation.definition.string.begin.azLgcAppExp"
        }
      },
      "end": "(\\')",
      "applyEndPatternLast": true,
      "endCaptures": {
        "1": {
          "name": "punctuation.definition.string.end.azLgcAppExp"
        }
      },
      "patterns": [
        {
          "include": "#string-character-escape"
        }
      ]
    },
    "string-character-escape": {
      "$impostureLang": {
        "type": "string-character-escape",
        "dataType": "string"
      },
      "name": "constant.character.escape.azLgcAppExp",
      "match": "\\'{2}"
    }
  }
}
