tm-grammars
Version:
Collecton of TextMate grammars in JSON
214 lines (213 loc) • 4.88 kB
JSON
{
"displayName": "KDL",
"name": "kdl",
"patterns": [
{
"include": "#forbidden_ident"
},
{
"include": "#null"
},
{
"include": "#boolean"
},
{
"include": "#float_keyword"
},
{
"include": "#float_fraction"
},
{
"include": "#float_exp"
},
{
"include": "#decimal"
},
{
"include": "#hexadecimal"
},
{
"include": "#octal"
},
{
"include": "#binary"
},
{
"include": "#raw-string"
},
{
"include": "#string_multi_line"
},
{
"include": "#string_single_line"
},
{
"include": "#block_comment"
},
{
"include": "#block_doc_comment"
},
{
"include": "#slashdash_block_comment"
},
{
"include": "#slashdash_comment"
},
{
"include": "#slashdash_node_comment"
},
{
"include": "#slashdash_node_with_children_comment"
},
{
"include": "#line_comment"
},
{
"include": "#attribute"
},
{
"include": "#node_name"
},
{
"include": "#ident_string"
}
],
"repository": {
"attribute": {
"captures": {
"1": {
"name": "punctuation.separator.key-value.kdl"
}
},
"match": "(?![]#/;=\\[\\\\{}])[!$-.:<>?@^_`|~\\w]+\\d*[!$-.:<>?@^_`|~\\w]*(=)",
"name": "entity.other.attribute-name.kdl"
},
"binary": {
"match": "\\b0b[01][01_]*\\b",
"name": "constant.numeric.integer.binary.rust"
},
"block_comment": {
"begin": "/\\*",
"end": "\\*/",
"name": "comment.block.kdl",
"patterns": [
{
"include": "#block_doc_comment"
},
{
"include": "#block_comment"
}
]
},
"block_doc_comment": {
"begin": "/\\*[!*](?![*/])",
"end": "\\*/",
"name": "comment.block.documentation.kdl",
"patterns": [
{
"include": "#block_doc_comment"
},
{
"include": "#block_comment"
}
]
},
"boolean": {
"match": "#(?:true|false)",
"name": "constant.language.boolean.kdl"
},
"decimal": {
"match": "\\b[-+0-9][0-9_]*\\b",
"name": "constant.numeric.integer.decimal.rust"
},
"float_exp": {
"match": "\\b[0-9][0-9_]*(\\.[0-9][0-9_]*)?[Ee][-+]?[0-9_]+\\b",
"name": "constant.numeric.float.rust"
},
"float_fraction": {
"match": "\\b([-+0-9])[0-9_]*\\.[0-9][0-9_]*([Ee][-+]?[0-9_]+)?\\b",
"name": "constant.numeric.float.rust"
},
"float_keyword": {
"match": "#(?:nan|inf|-inf)",
"name": "constant.language.other.kdl"
},
"forbidden_ident": {
"match": "(?<!#)(?:true|false|null|nan|-?inf)",
"name": "invalid.illegal.kdl.bad-ident"
},
"hexadecimal": {
"match": "\\b0x\\h[_\\h]*\\b",
"name": "constant.numeric.integer.hexadecimal.rust"
},
"ident_string": {
"match": "(?![]#/;=\\[\\\\{}])[!$-.:<>?@^_`|~\\w]+\\d*[!$-.:<>?@^_`|~\\w]*",
"name": "string.unquoted"
},
"line_comment": {
"begin": "//",
"end": "$",
"name": "comment.line.double-slash.kdl"
},
"node_name": {
"match": "((?<=[;{])|^)\\s*(?![]#/;=\\[\\\\{}])[!$-.:<>?@^_`|~\\w]+\\d*[!$-.:<>?@^_`|~\\w]*",
"name": "entity.name.tag"
},
"null": {
"match": "#null",
"name": "constant.language.null.kdl"
},
"octal": {
"match": "\\b0o[0-7][0-7_]*\\b",
"name": "constant.numeric.integer.octal.rust"
},
"raw-string": {
"begin": "(#+)(\"(?:\"\"|))",
"end": "\\2\\1",
"name": "string.quoted.other.raw.kdl"
},
"slashdash_block_comment": {
"begin": "/-\\s*\\{",
"end": "}",
"name": "comment.block.slashdash.kdl"
},
"slashdash_comment": {
"begin": "(?<!^)\\s*/-\\s*",
"end": "\\s",
"name": "comment.block.slashdash.kdl"
},
"slashdash_node_comment": {
"begin": "(?<=^)\\s*/-[^{]+$",
"end": ";|(?<!\\\\)$",
"name": "comment.block.slashdash.kdl"
},
"slashdash_node_with_children_comment": {
"begin": "(?<=^)\\s*/-[^{]+\\{",
"end": "}",
"name": "comment.block.slashdash.kdl"
},
"string_multi_line": {
"begin": "\"\"\"",
"end": "\"\"\"",
"name": "string.quoted.triple.kdl",
"patterns": [
{
"match": "\\\\(:?[\"\\\\bfnrst]|u\\{\\h{1,6}})",
"name": "constant.character.escape.kdl"
}
]
},
"string_single_line": {
"begin": "\"",
"end": "\"",
"name": "string.quoted.double.kdl",
"patterns": [
{
"match": "\\\\(:?[\"\\\\bfnrst]|u\\{\\h{1,6}})",
"name": "constant.character.escape.kdl"
}
]
}
},
"scopeName": "source.kdl"
}