mocha-vscode/config/languages/zql.tmLanguage.json

597 lines
16 KiB
JSON

{
"information_for_contributors": [
"This file has been converted from https://github.com/Microsoft/vscode-mssql/blob/master/syntaxes/SQL.plist",
"If you want to provide a fix or improvement, please create a pull request against the original repository.",
"Once accepted there, we are happy to receive an update request."
],
"version": "https://github.com/Microsoft/vscode-mssql/commit/cd754662e5607c62ecdc51d2a2dc844546a0bbb6",
"name": "Mocha ZQL",
"scopeName": "source.zql",
"patterns": [
{
"match": "^[ \\t]*-{2,}\\s+(@[\\w_]+)\\s+(.+)?$",
"captures":{
"1": {
"name": "text.variable"
},
"2": {
"name": "entity.name.type.instance.metadata"
}
}
},
{
"match": "((?<!@)@)\\b(\\w+)\\b",
"name": "text.variable"
},
{
"match": "(\\[)[^\\]]*(\\])",
"name": "text.bracketed"
},
{
"match": "^\\s*(public|private|root|protected)\\s?+(static\\s*)?+(class|function)\\b",
"name": "storage.modifier.zql"
},
{
"match": "\\b(?i)(class|static|stub|published|function|extends|if|then|else|let|optional|token|update|create|yield|set|override|this)\\b",
"name": "keyword.basic.zql"
},
{
"match": "\\b(test|case|assert)\\b",
"name": "keyword.testing.zql"
},
{
"include": "#comments"
},
{
"include": "#type-operators"
},
{
"captures": {
"1": {
"name": "keyword.other.create.sql"
},
"2": {
"name": "keyword.other.sql"
},
"5": {
"name": "entity.name.function.sql"
}
},
"match": "(?i:^\\s*(create(?:\\s+or\\s+replace)?)\\s+(aggregate|conversion|database|domain|function|group|(unique\\s+)?index|language|operator class|operator|rule|schema|sequence|table|tablespace|trigger|type|user|view)\\s+)(['\"`]?)(\\w+)\\4",
"name": "meta.create.sql"
},
{
"captures": {
"1": {
"name": "keyword.other.create.sql"
},
"2": {
"name": "keyword.other.sql"
}
},
"match": "(?i:^\\s*(drop)\\s+(aggregate|conversion|database|domain|function|group|index|language|operator class|operator|rule|schema|sequence|table|tablespace|trigger|type|user|view))",
"name": "meta.drop.sql"
},
{
"captures": {
"1": {
"name": "keyword.other.create.sql"
},
"2": {
"name": "keyword.other.table.sql"
},
"3": {
"name": "entity.name.function.sql"
},
"4": {
"name": "keyword.other.cascade.sql"
}
},
"match": "(?i:\\s*(drop)\\s+(table)\\s+(\\w+)(\\s+cascade)?\\b)",
"name": "meta.drop.sql"
},
{
"captures": {
"1": {
"name": "keyword.other.create.sql"
},
"2": {
"name": "keyword.other.table.sql"
}
},
"match": "(?i:^\\s*(alter)\\s+(aggregate|conversion|database|domain|function|group|index|language|operator class|operator|proc(edure)?|rule|schema|sequence|table|tablespace|trigger|type|user|view)\\s+)",
"name": "meta.alter.sql"
},
{
"match": "(boolean|date|numeric|text|xml|file)",
"name": "support.class"
},
{
"match": "functions:",
"name": "markup.bold"
},
{
"match": "\\b\\d+\\b",
"name": "constant.numeric.sql"
},
{
"match": "(?i:\\b(select(\\s+distinct)?|insert\\s+(ignore\\s+)?into|update|delete|from|set|where|group\\sby|or|like|and|union(\\s+all)?|having|order\\sby|limit|(inner|cross)\\s+join|join|straight_join|full\\s+outer\\s+join|(left|right)(\\s+outer)?\\s+join|natural(\\s+(left|right)(\\s+outer)?)?\\s+join)\\b)",
"name": "keyword.other.DML.sql"
},
{
"match": "(?i:\\b(on|off|((is\\s+)?not\\s+)?null)\\b)",
"name": "keyword.other.DDL.create.II.sql"
},
{
"match": "(?i:\\bvalues\\b)",
"name": "keyword.other.DML.II.sql"
},
{
"match": "(?i:\\b(begin(\\s+work)?|start\\s+transaction|commit(\\s+work)?|rollback(\\s+work)?)\\b)",
"name": "keyword.other.LUW.sql"
},
{
"match": "(?i:\\b(grant(\\swith\\sgrant\\soption)?|revoke)\\b)",
"name": "keyword.other.authorization.sql"
},
{
"match": "(?i:\\bin\\b)",
"name": "keyword.other.data-integrity.sql"
},
{
"match": "(?i:^\\s*(comment\\s+on\\s+(table|column|aggregate|constraint|database|domain|function|index|operator|rule|schema|sequence|trigger|type|view))\\s+.*?\\s+(is)\\s+)",
"name": "keyword.other.object-comments.sql"
},
{
"match": "(?i)\\bAS\\b",
"name": "keyword.other.alias.sql"
},
{
"match": "(?i)\\b(DESC|ASC)\\b",
"name": "keyword.other.order.sql"
},
{
"match": "\\*",
"name": "keyword.operator.star.sql"
},
{
"match": "[!<>]?=|<>|<|>",
"name": "keyword.operator.comparison.sql"
},
{
"match": "-|\\+|/",
"name": "keyword.operator.math.sql"
},
{
"match": "\\|\\|",
"name": "keyword.operator.concatenator.sql"
},
{
"match": "(?i)\\b(avg|checksum_agg|count|count_big|grouping|grouping_id|max|min|sum|stdev|stdevp|var|varp)\\b",
"name": "support.function.aggregate.sql"
},
{
"match": "(?i)\\b(cast|convert|parse|try_cast|try_convert|try_parse)\\b",
"name": "support.function.conversion.sql"
},
{
"match": "(?i)\\b(cursor_status)\\b",
"name": "support.function.cursor.sql"
},
{
"match": "(?i)\\b(sysdatetime|sysdatetimeoffset|sysutcdatetime|current_time(stamp)?|getdate|getutcdate|datename|datepart|day|month|year|datefromparts|datetime2fromparts|datetimefromparts|datetimeoffsetfromparts|smalldatetimefromparts|timefromparts|datediff|dateadd|eomonth|switchoffset|todatetimeoffset|isdate)\\b",
"name": "support.function.datetime.sql"
},
{
"match": "(?i)\\b(coalesce|nullif)\\b",
"name": "support.function.expression.sql"
},
{
"match": "(?<!@)@@(?i)\\b(cursor_rows|connections|cpu_busy|datefirst|dbts|error|fetch_status|identity|idle|io_busy|langid|language|lock_timeout|max_connections|max_precision|nestlevel|options|packet_errors|pack_received|pack_sent|procid|remserver|rowcount|servername|servicename|spid|textsize|timeticks|total_errors|total_read|total_write|trancount|version)\\b",
"name": "support.function.globalvar.sql"
},
{
"match": "(?i)\\b(choose|iif)\\b",
"name": "support.function.logical.sql"
},
{
"match": "(?i)\\b(abs|acos|asin|atan|atn2|ceiling|cos|cot|degrees|exp|floor|log|log10|pi|power|radians|rand|round|sign|sin|sqrt|square|tan)\\b",
"name": "support.function.mathematical.sql"
},
{
"match": "(?i)\\b(app_name|applock_mode|applock_test|assemblyproperty|col_length|col_name|columnproperty|database_principal_id|databasepropertyex|db_id|db_name|file_id|file_idex|file_name|filegroup_id|filegroup_name|filegroupproperty|fileproperty|fulltextcatalogproperty|fulltextserviceproperty|index_col|indexkey_property|indexproperty|object_definition|object_id|object_name|object_schema_name|objectproperty|objectpropertyex|original_db_name|parsename|schema_id|schema_name|scope_identity|serverproperty|stats_date|type_id|type_name|typeproperty)\\b",
"name": "support.function.metadata.sql"
},
{
"match": "(?i)\\b(rank|dense_rank|ntile|row_number)\\b",
"name": "support.function.ranking.sql"
},
{
"match": "(?i)\\b(opendatasource|openrowset|openquery|openxml)\\b",
"name": "support.function.rowset.sql"
},
{
"match": "(?i)\\b(certencoded|certprivatekey|current_user|database_principal_id|has_perms_by_name|is_member|is_rolemember|is_srvrolemember|original_login|permissions|pwdcompare|pwdencrypt|schema_id|schema_name|session_user|suser_id|suser_sid|suser_sname|system_user|suser_name|user_id|user_name)\\b",
"name": "support.function.security.sql"
},
{
"match": "(?i)\\b(ascii|char|charindex|concat|difference|format|left|len|lower|ltrim|nchar|patindex|quotename|replace|replicate|reverse|rtrim|soundex|space|str|string_agg|string_escape|string_split|stuff|substring|translate|trim|unicode|upper)\\b",
"name": "support.function.string.sql"
},
{
"match": "(?i)\\b(binary_checksum|checksum|compress|connectionproperty|context_info|current_request_id|current_transaction_id|decompress|error_line|error_message|error_number|error_procedure|error_severity|error_state|formatmessage|get_filestream_transaction_context|getansinull|host_id|host_name|isnull|isnumeric|min_active_rowversion|newid|newsequentialid|rowcount_big|session_context|session_id|xact_state)\\b",
"name": "support.function.system.sql"
},
{
"match": "(?i)\\b(patindex|textptr|textvalid)\\b",
"name": "support.function.textimage.sql"
},
{
"captures": {
"1": {
"name": "constant.other.database-name.sql"
},
"2": {
"name": "constant.other.table-name.sql"
}
},
"match": "(\\w+?)\\.(\\w+)"
},
{
"include": "#strings"
},
{
"include": "#regexps"
},
{
"captures": {
"1": {
"name": "punctuation.section.scope.begin.sql"
},
"2": {
"name": "punctuation.section.scope.end.sql"
}
},
"comment": "Allow for special ↩ behavior",
"match": "(\\()(\\))",
"name": "meta.block.sql"
}
],
"repository": {
"comments": {
"patterns": [
{
"name": "meta.return.type.colon.zql",
"begin": ":\\s*(\\w*)",
"beginCaptures": {
"1": {
"name": "support.class"
}
},
"end": "\\s"
},
{
"name": "meta.return.value.equals.zql",
"begin": "=\\s*(\\w*)",
"beginCaptures": {
"1": {
"name": "support.variable"
}
},
"end": "\\n"
},
{
"name": "section.instances",
"begin": "instances:\\s*",
"end": "\\n",
"beginCaptures": {
"0": {
"name": "markup.bold"
}
},
"patterns": [
{
"match": "\\s*(\\w*)\\s*,\\s*(\\d*\\$\\d*)\\s*",
"captures": {
"1": {
"name": "support.variable"
},
"2": {
"name": "markup.italic"
}
}
}
]
},
{
"name": "section.attributes",
"begin": "attributes:\\s*",
"end": "\\n",
"beginCaptures": {
"0": {
"name": "markup.bold"
}
},
"patterns": [
{
"match": "\\s*(\\w*)\\s*,\\s*(\\d*\\$\\d*)\\s*:\\s*(\\w*)\\s*",
"captures": {
"1": {
"name": "support.variable"
},
"2": {
"name": "markup.italic"
},
"3": {
"name": "support.class"
}
}
}
]
},
{
"name": "section.relationships",
"begin": "relationships:\\s*",
"end": "\\n",
"beginCaptures": {
"0": {
"name": "markup.bold"
}
},
"patterns": [
{
"match": "\\s*(\\w*)\\s*,\\s*(\\d*\\$\\d*)\\s*",
"captures": {
"1": {
"name": "support.variable"
},
"2": {
"name": "markup.italic"
}
}
}
]
},
{
"begin": "//",
"beginCaptures": {
"0": {
"name": "punctuation.definition.comment.zql"
}
},
"end": "\\n",
"name": "comment.line.double-slash.zql"
},
{
"begin": "(^[ \\t]+)?(?=--)",
"beginCaptures": {
"1": {
"name": "punctuation.whitespace.comment.leading.zql"
}
},
"end": "(?!\\G)",
"patterns": [
{
"begin": "//",
"beginCaptures": {
"0": {
"name": "punctuation.definition.comment.zql"
}
},
"end": "\\n",
"name": "comment.line.double-dash.zql"
}
]
},
{
"begin": "(^[ \\t]+)?(?=#)",
"beginCaptures": {
"1": {
"name": "punctuation.whitespace.comment.leading.zql"
}
},
"end": "(?!\\G)",
"patterns": []
},
{
"begin": "/\\*",
"captures": {
"0": {
"name": "punctuation.definition.comment.zql"
}
},
"end": "\\*/",
"name": "comment.block.zql"
}
]
},
"regexps": {
"patterns": [
{
"begin": "/(?=\\S.*/)",
"beginCaptures": {
"0": {
"name": "punctuation.definition.string.begin.sql"
}
},
"end": "/",
"endCaptures": {
"0": {
"name": "punctuation.definition.string.end.sql"
}
},
"name": "string.regexp.sql",
"patterns": [
{
"include": "#string_interpolation"
},
{
"match": "\\\\/",
"name": "constant.character.escape.slash.sql"
}
]
},
{
"begin": "%r\\{",
"beginCaptures": {
"0": {
"name": "punctuation.definition.string.begin.sql"
}
},
"comment": "We should probably handle nested bracket pairs!?! -- Allan",
"end": "\\}",
"endCaptures": {
"0": {
"name": "punctuation.definition.string.end.sql"
}
},
"name": "string.regexp.modr.sql",
"patterns": [
{
"include": "#string_interpolation"
}
]
}
]
},
"string_escape": {
"match": "\\\\.",
"name": "constant.character.escape.sql"
},
"string_interpolation": {
"captures": {
"1": {
"name": "punctuation.definition.string.begin.sql"
},
"3": {
"name": "punctuation.definition.string.end.sql"
}
},
"match": "(#\\{)([^\\}]*)(\\})",
"name": "string.interpolated.sql"
},
"strings": {
"patterns": [
{
"captures": {
"1": {
"name": "punctuation.definition.string.begin.sql"
},
"2": {
"name": "punctuation.definition.string.end.sql"
}
},
"comment": "this is faster than the next begin/end rule since sub-pattern will match till end-of-line and SQL files tend to have very long lines.",
"match": "(N)?(')[^']*(')",
"name": "string.quoted.single.sql"
},
{
"begin": "'",
"beginCaptures": {
"0": {
"name": "punctuation.definition.string.begin.sql"
}
},
"end": "'",
"endCaptures": {
"0": {
"name": "punctuation.definition.string.end.sql"
}
},
"name": "string.quoted.single.sql",
"patterns": [
{
"include": "#string_escape"
}
]
},
{
"captures": {
"1": {
"name": "punctuation.definition.string.begin.sql"
},
"2": {
"name": "punctuation.definition.string.end.sql"
}
},
"comment": "this is faster than the next begin/end rule since sub-pattern will match till end-of-line and SQL files tend to have very long lines.",
"match": "(`)[^`\\\\]*(`)",
"name": "string.quoted.other.backtick.sql"
},
{
"begin": "`",
"beginCaptures": {
"0": {
"name": "punctuation.definition.string.begin.sql"
}
},
"end": "`",
"endCaptures": {
"0": {
"name": "punctuation.definition.string.end.sql"
}
},
"name": "string.quoted.other.backtick.sql",
"patterns": [
{
"include": "#string_escape"
}
]
},
{
"captures": {
"1": {
"name": "punctuation.definition.string.begin.sql"
},
"2": {
"name": "punctuation.definition.string.end.sql"
}
},
"comment": "this is faster than the next begin/end rule since sub-pattern will match till end-of-line and SQL files tend to have very long lines.",
"match": "(\")[^\"#]*(\")",
"name": "string.quoted.double.sql"
},
{
"begin": "\"",
"beginCaptures": {
"0": {
"name": "punctuation.definition.string.begin.sql"
}
},
"end": "\"",
"endCaptures": {
"0": {
"name": "punctuation.definition.string.end.sql"
}
},
"name": "string.quoted.double.sql",
"patterns": [
{
"include": "#string_interpolation"
}
]
},
{
"begin": "%\\{",
"beginCaptures": {
"0": {
"name": "punctuation.definition.string.begin.sql"
}
},
"end": "\\}",
"endCaptures": {
"0": {
"name": "punctuation.definition.string.end.sql"
}
},
"name": "string.other.quoted.brackets.sql",
"patterns": [
{
"include": "#string_interpolation"
}
]
}
]
}
}
}