{
  "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
  "name": "pit",
  "scopeName": "source.pit",
  "patterns": [
    { "include": "#comment-line" },
    { "include": "#comment-block" },
    { "include": "#string-template" },
    { "include": "#string-double" },
    { "include": "#regexp" },
    { "include": "#keyword-control" },
    { "include": "#keyword-error" },
    { "include": "#storage-type" },
    { "include": "#constant-language" },
    { "include": "#variable-language" },
    { "include": "#actor-intrinsic" },
    { "include": "#keyword-operator" },
    { "include": "#arrow-function" },
    { "include": "#support-function" },
    { "include": "#constant-numeric-hex" },
    { "include": "#constant-numeric-binary" },
    { "include": "#constant-numeric-octal" },
    { "include": "#constant-numeric" },
    { "include": "#punctuation" }
  ],
  "repository": {
    "comment-line": {
      "name": "comment.line.double-slash.pit",
      "match": "//.*$"
    },
    "comment-block": {
      "name": "comment.block.pit",
      "begin": "/\\*",
      "end": "\\*/",
      "beginCaptures": { "0": { "name": "punctuation.definition.comment.begin.pit" } },
      "endCaptures": { "0": { "name": "punctuation.definition.comment.end.pit" } }
    },
    "string-double": {
      "name": "string.quoted.double.pit",
      "begin": "\"",
      "end": "\"",
      "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.pit" } },
      "endCaptures": { "0": { "name": "punctuation.definition.string.end.pit" } },
      "patterns": [
        {
          "name": "constant.character.escape.pit",
          "match": "\\\\(?:[\"\\\\bfnrt/]|u[0-9a-fA-F]{4})"
        }
      ]
    },
    "string-template": {
      "name": "string.template.pit",
      "begin": "`",
      "end": "`",
      "beginCaptures": { "0": { "name": "punctuation.definition.string.template.begin.pit" } },
      "endCaptures": { "0": { "name": "punctuation.definition.string.template.end.pit" } },
      "patterns": [
        {
          "name": "constant.character.escape.pit",
          "match": "\\\\(?:[`\\\\bfnrt/$]|u[0-9a-fA-F]{4})"
        },
        {
          "name": "meta.template.expression.pit",
          "begin": "\\$\\{",
          "end": "\\}",
          "beginCaptures": { "0": { "name": "punctuation.definition.template-expression.begin.pit" } },
          "endCaptures": { "0": { "name": "punctuation.definition.template-expression.end.pit" } },
          "patterns": [
            { "include": "source.pit" }
          ]
        }
      ]
    },
    "regexp": {
      "name": "string.regexp.pit",
      "begin": "(?<=[=(:,;!&|?~^>]|^|return|disrupt)\\s*(/(?![/*]))",
      "end": "/([gimsuvy]*)",
      "beginCaptures": { "1": { "name": "punctuation.definition.string.begin.pit" } },
      "endCaptures": { "1": { "name": "keyword.other.pit" } },
      "patterns": [
        {
          "name": "constant.character.escape.pit",
          "match": "\\\\."
        }
      ]
    },
    "keyword-control": {
      "name": "keyword.control.pit",
      "match": "\\b(if|else|for|while|do|break|continue|return|go)\\b"
    },
    "keyword-error": {
      "name": "keyword.control.error.pit",
      "match": "\\b(disrupt|disruption)\\b"
    },
    "storage-type": {
      "patterns": [
        {
          "name": "storage.type.pit",
          "match": "\\b(var|def)\\b"
        },
        {
          "name": "storage.type.function.pit",
          "match": "\\bfunction\\b"
        }
      ]
    },
    "constant-language": {
      "name": "constant.language.pit",
      "match": "\\b(null|true|false)\\b"
    },
    "variable-language": {
      "name": "variable.language.this.pit",
      "match": "\\bthis\\b"
    },
    "actor-intrinsic": {
      "name": "variable.language.actor.pit",
      "match": "\\$[a-zA-Z_][a-zA-Z0-9_]*"
    },
    "keyword-operator": {
      "name": "keyword.operator.pit",
      "match": "\\b(delete|in|typeof)\\b"
    },
    "arrow-function": {
      "name": "storage.type.function.arrow.pit",
      "match": "=>"
    },
    "support-function": {
      "name": "support.function.pit",
      "match": "\\b(abs|apply|array|ceiling|character|codepoint|ends_with|every|extract|fallback|filter|find|floor|for|format|fraction|is_array|is_blob|is_character|is_data|is_digit|is_false|is_fit|is_function|is_integer|is_letter|is_logical|is_lower|is_null|is_number|is_object|is_pattern|is_stone|is_text|is_true|is_upper|is_whitespace|length|logical|lower|max|min|modulo|neg|normalize|not|number|parallel|print|race|record|reduce|remainder|replace|reverse|round|search|sequence|sign|some|sort|starts_with|stone|text|trim|trunc|upper|whole|meme|proto|isa|splat|use)(?=\\s*\\()"
    },
    "constant-numeric-hex": {
      "name": "constant.numeric.hex.pit",
      "match": "\\b0[xX][0-9a-fA-F]+\\b"
    },
    "constant-numeric-binary": {
      "name": "constant.numeric.binary.pit",
      "match": "\\b0[bB][01]+\\b"
    },
    "constant-numeric-octal": {
      "name": "constant.numeric.octal.pit",
      "match": "\\b0[oO][0-7]+\\b"
    },
    "constant-numeric": {
      "name": "constant.numeric.pit",
      "match": "\\b[0-9]+(\\.[0-9]+)?([eE][+-]?[0-9]+)?\\b"
    },
    "punctuation": {
      "patterns": [
        {
          "name": "punctuation.separator.comma.pit",
          "match": ","
        },
        {
          "name": "punctuation.terminator.statement.pit",
          "match": ";"
        }
      ]
    }
  }
}
