{
  "displayName": "Chapel",
  "fileTypes": [
    "chpl"
  ],
  "name": "chapel",
  "patterns": [
    {
      "include": "#extern_block"
    },
    {
      "include": "#comments"
    },
    {
      "include": "#strings"
    },
    {
      "include": "#keywords"
    },
    {
      "include": "#constants"
    },
    {
      "include": "#variables"
    },
    {
      "include": "#important_globals"
    },
    {
      "include": "#operators"
    },
    {
      "include": "#attributes"
    }
  ],
  "repository": {
    "attributes": {
      "patterns": [
        {
          "match": "(@[A-Z_a-z][0-9A-Z_a-z]*(?:\\.[A-Z_a-z][0-9A-Z_a-z]*)?)",
          "name": "storage.type.attribute.chapel"
        }
      ]
    },
    "blockcomments": {
      "patterns": [
        {
          "captures": {
            "1": {
              "name": "meta.toc-list.banner.block.chapel"
            }
          },
          "match": "^/\\* =(\\s*.*?)\\s*= \\*/$\\n?",
          "name": "comment.block.chapel"
        },
        {
          "begin": "/\\*",
          "captures": {
            "0": {
              "name": "punctuation.definition.comment.chapel"
            }
          },
          "end": "\\*/",
          "name": "comment.block.chapel",
          "patterns": [
            {
              "include": "#blockcomments"
            }
          ]
        }
      ]
    },
    "comments": {
      "patterns": [
        {
          "include": "#blockcomments"
        },
        {
          "match": "\\*/.*\\n",
          "name": "invalid.illegal.stray-comment-end.chapel"
        },
        {
          "captures": {
            "1": {
              "name": "meta.toc-list.banner.line.chapel"
            }
          },
          "match": "^// =(\\s*.*?)\\s*=\\s*$\\n?",
          "name": "comment.line.banner.c++"
        },
        {
          "begin": "//",
          "beginCaptures": {
            "0": {
              "name": "punctuation.definition.comment.chapel"
            }
          },
          "end": "$\\n?",
          "name": "comment.line.double-slash.chapel",
          "patterns": [
            {
              "match": "(?>\\\\\\s*\\n)",
              "name": "punctuation.separator.continuation.chapel"
            }
          ]
        }
      ]
    },
    "constants": {
      "patterns": [
        {
          "match": "\\b(true|false|nil|none)\\b",
          "name": "constant.language.chapel"
        },
        {
          "include": "#integers"
        },
        {
          "include": "#floats"
        }
      ]
    },
    "extern_block": {
      "patterns": [
        {
          "begin": "\\b(extern)\\s*(?<!\\{)\\{(?!\\{)",
          "beginCaptures": {
            "1": {
              "name": "keyword.control.chapel"
            }
          },
          "end": "(?<!})}(?!})",
          "name": "meta.extern.chapel",
          "patterns": [
            {
              "include": "source.c"
            }
          ]
        }
      ]
    },
    "floats": {
      "patterns": [
        {
          "match": "\\.([0-9][0-9_]*)([Ee]([-+])?([0-9][0-9_]*))?i?\\b",
          "name": "constant.numeric.chapel"
        },
        {
          "match": "\\b([0-9][0-9_]*)\\.([0-9][0-9_]*)([Ee]([-+])?([0-9][0-9_]*))?i?\\b",
          "name": "constant.numeric.chapel"
        },
        {
          "match": "\\b([0-9][0-9_]*)\\.([Ee]([-+])?([0-9][0-9_]*))i?\\b",
          "name": "constant.numeric.chapel"
        },
        {
          "match": "\\b([0-9][0-9_]*)([Ee]([-+])?([0-9][0-9_]*))i?\\b",
          "name": "constant.numeric.chapel"
        },
        {
          "match": "\\b0[Xx](\\h[_\\h]*)?\\.(\\h[_\\h]*)([Pp]([-+])?(\\h[_\\h]*))?i?\\b",
          "name": "constant.numeric.chapel"
        },
        {
          "match": "\\b0[Xx](\\h[_\\h]*)\\.([Pp]([-+])?(\\h[_\\h]*))i?\\b",
          "name": "constant.numeric.chapel"
        },
        {
          "match": "\\b0[Xx](\\h[_\\h]*)([Pp]([-+])?(\\h[_\\h]*))i?\\b",
          "name": "constant.numeric.chapel"
        }
      ]
    },
    "important_globals": {
      "patterns": [
        {
          "match": "\\b(here|LocaleSpace|Locales|numLocales)\\b",
          "name": "support.variable.chapel"
        }
      ]
    },
    "integers": {
      "patterns": [
        {
          "match": "\\b([0-9][0-9_]*)i?\\b",
          "name": "constant.numeric.chapel"
        },
        {
          "match": "\\b(0[Xx]\\h[_\\h]*)i?\\b",
          "name": "constant.numeric.chapel"
        },
        {
          "match": "\\b(0[Bb][01][01_]*)i?\\b",
          "name": "constant.numeric.chapel"
        },
        {
          "match": "\\b(0[Oo][0-7][0-7_]*)i?\\b",
          "name": "constant.numeric.chapel"
        }
      ]
    },
    "keywords": {
      "patterns": [
        {
          "match": "\\b(align|as|atomic|begin|break|by|catch|class|cobegin|coforall|deinit|continue|defer|delete|dmapped|do|else|enum|except|export|extern|for|forall|foreach|forwarding|if|import|in|include|index|init=??|inline|inout|interface|implements|iter|label|lambda|let|lifetime|local|manage|module|new|noinit|on|only|operator|otherwise|out|override|postinit|__primitive|pragma|private|proc|prototype|public|record|reduce|require|return|scan|select|serial|then|these|throws??|try|union|use|when|where|while|with|yield|zip)\\b",
          "name": "keyword.control.chapel"
        },
        {
          "match": "\\b(bool|bytes|complex|dmap|domain|imag|int|locale|nothing|opaque|range|real|string|subdomain|tuple|uint|void)\\b",
          "name": "storage.type.chapel"
        },
        {
          "match": "\\b(borrowed|config|const|owned|param|private|public|ref|shared|sparse|sync|type|unmanaged|var)\\b",
          "name": "storage.modifier.chapel"
        }
      ]
    },
    "operators": {
      "patterns": [
        {
          "match": "<=|>=|==|[<>]|!=",
          "name": "keyword.operator.comparison.chapel"
        },
        {
          "match": "\\+=|-=|\\*=|/=|%=|&=|(\\|=)|\\^=|>>=|<<=|\\*\\*=",
          "name": "keyword.operator.assignment.augmented.chapel"
        },
        {
          "match": "[-*+]|\\*\\*|[%/]|<<|>>|&|(\\|)|[\\^~]|<=>|\\.\\.<|#|\\.\\.\\.?",
          "name": "keyword.operator.arithmetic.chapel"
        },
        {
          "match": "=",
          "name": "keyword.operator.assignment.chapel"
        },
        {
          "match": "[!:?]|->",
          "name": "keyword.operator.others.chapel"
        },
        {
          "match": "[]\\[]|=>",
          "name": "keyword.operator.domain.chapel"
        }
      ]
    },
    "string_escapes": {
      "patterns": [
        {
          "match": "\\\\([\"'?\\\\abefnprtv]|[0-3]\\d{0,2}|[4-7]\\d?|x\\h{0,2}|u\\h{0,4}|U\\h{0,8})",
          "name": "constant.character.escape.chapel"
        },
        {
          "match": "\\\\.",
          "name": "invalid.illegal.unknown-escape.chapel"
        }
      ]
    },
    "string_format": {
      "patterns": [
        {
          "match": "(%\\?)",
          "name": "constant.other.placeholder.chapel"
        },
        {
          "match": "(%\\{(#+|#+\\.#*|#*\\.#+)})",
          "name": "constant.other.placeholder.chapel"
        },
        {
          "match": "(%\\{(.*?)})",
          "name": "constant.other.placeholder.chapel"
        },
        {
          "match": "(%([+0<>@^])*(\\*|[0-9]+)?(\\.[0-9]*)?(?:[Xbdhjox]|\\\\?[\"']S)?[Ee]?([Scimnrsuz]|(\\{(.S|\\*S|.S.)})|(/.*/)|(\\{/.*/[A-Za-z]+}))?)",
          "name": "constant.other.placeholder.chapel"
        },
        {
          "match": "(%%)",
          "name": "constant.other.placeholder.chapel"
        }
      ]
    },
    "strings": {
      "patterns": [
        {
          "begin": "\"\"\"",
          "beginCaptures": {
            "0": {
              "name": "punctuation.definition.string.begin.chapel"
            }
          },
          "end": "\"\"\"",
          "endCaptures": {
            "0": {
              "name": "punctuation.definition.string.end.chapel"
            }
          },
          "name": "string.quoted.double.multi.chapel",
          "patterns": [
            {
              "include": "#string_escapes"
            },
            {
              "include": "#string_format"
            }
          ]
        },
        {
          "begin": "'''",
          "beginCaptures": {
            "0": {
              "name": "punctuation.definition.string.begin.chapel"
            }
          },
          "end": "'''",
          "endCaptures": {
            "0": {
              "name": "punctuation.definition.string.end.chapel"
            }
          },
          "name": "string.quoted.single.multi.chapel",
          "patterns": [
            {
              "include": "#string_escapes"
            },
            {
              "include": "#string_format"
            }
          ]
        },
        {
          "begin": "\"",
          "beginCaptures": {
            "0": {
              "name": "punctuation.definition.string.begin.chapel"
            }
          },
          "end": "\"",
          "endCaptures": {
            "0": {
              "name": "punctuation.definition.string.end.chapel"
            }
          },
          "name": "string.quoted.double.chapel",
          "patterns": [
            {
              "include": "#string_escapes"
            },
            {
              "include": "#string_format"
            }
          ]
        },
        {
          "begin": "'",
          "beginCaptures": {
            "0": {
              "name": "punctuation.definition.string.begin.chapel"
            }
          },
          "end": "'",
          "endCaptures": {
            "0": {
              "name": "punctuation.definition.string.end.chapel"
            }
          },
          "name": "string.quoted.single.chapel",
          "patterns": [
            {
              "include": "#string_escapes"
            },
            {
              "include": "#string_format"
            }
          ]
        }
      ]
    },
    "variables": {
      "patterns": [
        {
          "match": "\\b(this|super)\\b",
          "name": "variable.language.chapel"
        }
      ]
    }
  },
  "scopeName": "source.chapel"
}
