{
  "name": "Fig",
  "scopeName": "source.fig",
  "patterns": [
    { "include": "#comments" },
    { "include": "#strings" },
    { "include": "#numbers" },
    { "include": "#keywords" },
    { "include": "#operators" },
    { "include": "#functions" },
    { "include": "#identifiers" }
  ],
  "repository": {
    "comments": {
      "patterns": [
        { "name": "comment.line.double-slash.fig", "match": "//.*$" },
        { "name": "comment.block.fig", "begin": "/\\*", "end": "\\*/" }
      ]
    },
    "strings": {
      "patterns": [
        {
          "name": "string.quoted.double.fig",
          "begin": "\"\"\"",
          "end": "\"\"\"",
          "patterns": [{ "match": ".", "name": "string.content.fig" }]
        },
        {
          "name": "string.quoted.double.fig",
          "begin": "\"",
          "end": "\"",
          "patterns": [
            { "match": "\\\\.", "name": "constant.character.escape.fig" }
          ]
        },
        {
          "name": "string.quoted.raw.fig",
          "begin": "r\"",
          "end": "\"",
          "patterns": [{ "match": ".", "name": "string.content.fig" }]
        }
      ]
    },
    "numbers": {
      "patterns": [
        {
          "name": "constant.numeric.float.fig",
          "match": "\\d*\\.\\d+([eE][+-]?\\d+)?"
        },
        {
          "name": "constant.numeric.integer.fig",
          "match": "\\d+([eE][+-]?\\d+)?"
        }
      ]
    },
    "keywords": {
      "patterns": [
        {
          "name": "keyword.control.fig",
          "match": "\\b(and|or|not|import|func|var|const|final|while|for|if|else|struct|interface|impl|public|return|break|continue|try|catch|throw)\\b"
        },
        { "name": "constant.language.fig", "match": "\\b(true|false|null)\\b" }
      ]
    },
    "operators": {
      "patterns": [
        {
          "name": "keyword.operator.arithmetic.fig",
          "match": "(\\+|\\-|\\*|/|%|\\*\\*)"
        },
        {
          "name": "keyword.operator.assignment.fig",
          "match": "(=|\\+=|\\-=|\\*=|/=|%=|\\^=|:=)"
        },
        {
          "name": "keyword.operator.logical.fig",
          "match": "(&&|\\|\\||\\b(and|or|not)\\b)"
        },
        {
          "name": "keyword.operator.comparison.fig",
          "match": "(==|!=|<=|>=|<|>|is)"
        },
        {
          "name": "punctuation.separator.fig",
          "match": "[\\(\\)\\[\\]\\{\\},;:.]"
        },
        {
          "name": "keyword.operator.other.fig",
          "match": "(\\+\\+|--|->|=>|<<|>>|\\^|&|\\||~)"
        }
      ]
    },
    "functions": {
      "patterns": [
        {
          "name": "entity.name.function.fig",
          "begin": "\\bfunc\\s+([a-zA-Z_][a-zA-Z0-9_]*)",
          "beginCaptures": {
            "1": { "name": "entity.name.function.fig" }
          },
          "end": "(?=;)"
        }
      ]
    },
    "identifiers": {
      "patterns": [
        {
          "name": "variable.other.fig",
          "match": "(?!\\bfunc\\b)[a-zA-Z_][a-zA-Z0-9_]*"
        }
      ]
    }
  }
}
