{
  "displayName": "SQL",
  "fileTypes": [
    "sql"
  ],
  "name": "sql",
  "patterns": [
    {
      "include": "#comments"
    },
    {
      "include": "#strings"
    },
    {
      "include": "#quoted-identifiers"
    },
    {
      "include": "#numbers"
    },
    {
      "include": "#constants"
    },
    {
      "include": "#functions"
    },
    {
      "include": "#data-types"
    },
    {
      "include": "#keywords"
    },
    {
      "include": "#operators"
    },
    {
      "include": "#punctuation"
    }
  ],
  "repository": {
    "comments": {
      "patterns": [
        {
          "begin": "/\\*",
          "beginCaptures": {
            "0": {
              "name": "punctuation.definition.comment.begin.sql"
            }
          },
          "end": "\\*/",
          "endCaptures": {
            "0": {
              "name": "punctuation.definition.comment.end.sql"
            }
          },
          "name": "comment.block.sql"
        },
        {
          "match": "--.*$",
          "name": "comment.line.double-dash.sql"
        }
      ]
    },
    "constants": {
      "patterns": [
        {
          "match": "\\b(?i:(true|false|null|unknown))\\b",
          "name": "constant.language.sql"
        },
        {
          "match": "\\b(?i:(current_date|current_time|current_timestamp|localtime|localtimestamp|session_user|system_user|user))\\b",
          "name": "constant.language.sql"
        }
      ]
    },
    "data-types": {
      "patterns": [
        {
          "match": "\\b(?i:(bigint|binary|bit|blob|boolean|char|character|clob|date|decimal|double|float|int|integer|interval|json|jsonb|numeric|real|serial|smallint|text|time|timestamp|uuid|varbinary|varchar|varying|xml))\\b",
          "name": "storage.type.sql"
        }
      ]
    },
    "functions": {
      "patterns": [
        {
          "match": "\\b(?i:(avg|cast|coalesce|count|date_part|date_trunc|extract|lower|max|min|nullif|round|string_agg|sum|upper))\\b(?=\\s*\\()",
          "name": "support.function.sql"
        }
      ]
    },
    "keywords": {
      "patterns": [
        {
          "match": "\\b(?i:(add|alter|analyze|asc|begin|by|cascade|column|commit|constraint|create|database|default|delete|desc|distinct|drop|exists|explain|foreign|from|grant|group|having|index|insert|into|join|key|limit|not|offset|on|order|primary|references|returning|rollback|schema|select|set|table|temporary|truncate|union|unique|update|values|view|where|with))\\b",
          "name": "keyword.other.sql"
        },
        {
          "match": "\\b(?i:(all|and|any|as|between|case|else|end|except|for|full|if|in|inner|intersect|is|left|like|or|outer|over|right|then|when))\\b",
          "name": "keyword.control.sql"
        }
      ]
    },
    "numbers": {
      "patterns": [
        {
          "match": "\\b[+-]?(?:\\d+\\.\\d+|\\d+|\\.\\d+)(?:[eE][+-]?\\d+)?\\b",
          "name": "constant.numeric.sql"
        }
      ]
    },
    "operators": {
      "patterns": [
        {
          "match": "(<>|!=|<=|>=|:=|[-+*/%<>=])",
          "name": "keyword.operator.sql"
        }
      ]
    },
    "punctuation": {
      "patterns": [
        {
          "match": "[(),.;]",
          "name": "punctuation.separator.sql"
        }
      ]
    },
    "quoted-identifiers": {
      "patterns": [
        {
          "begin": "\"",
          "beginCaptures": {
            "0": {
              "name": "punctuation.definition.string.begin.sql"
            }
          },
          "end": "\"",
          "endCaptures": {
            "0": {
              "name": "punctuation.definition.string.end.sql"
            }
          },
          "name": "string.quoted.double.sql",
          "patterns": [
            {
              "match": "\"\"",
              "name": "constant.character.escape.sql"
            }
          ]
        },
        {
          "begin": "`",
          "beginCaptures": {
            "0": {
              "name": "punctuation.definition.string.begin.sql"
            }
          },
          "end": "`",
          "endCaptures": {
            "0": {
              "name": "punctuation.definition.string.end.sql"
            }
          },
          "name": "string.quoted.other.sql",
          "patterns": [
            {
              "match": "``",
              "name": "constant.character.escape.sql"
            }
          ]
        }
      ]
    },
    "strings": {
      "patterns": [
        {
          "begin": "'",
          "beginCaptures": {
            "0": {
              "name": "punctuation.definition.string.begin.sql"
            }
          },
          "end": "'",
          "endCaptures": {
            "0": {
              "name": "punctuation.definition.string.end.sql"
            }
          },
          "name": "string.quoted.single.sql",
          "patterns": [
            {
              "match": "''",
              "name": "constant.character.escape.sql"
            }
          ]
        }
      ]
    }
  },
  "scopeName": "source.sql"
}
