tm-grammars
Version:
Collecton of TextMate grammars in JSON
319 lines (318 loc) • 6.65 kB
JSON
{
"displayName": "RON",
"name": "ron",
"patterns": [
{
"include": "#expression"
}
],
"repository": {
"array": {
"begin": "\\[",
"beginCaptures": {
"0": {
"name": "punctuation.section.array.begin.ron"
}
},
"end": "]",
"endCaptures": {
"0": {
"name": "punctuation.section.array.end.ron"
}
},
"patterns": [
{
"include": "#value"
},
{
"include": "#struct-name"
},
{
"meta_scope": "meta.structure.array.ron"
}
]
},
"block_comment": {
"begin": "/\\*",
"end": "\\*/",
"name": "comment.block.ron",
"patterns": [
{
"include": "#block_comment"
}
]
},
"character": {
"begin": "'",
"contentName": "constant.character.ron",
"end": "'",
"name": "string.quoted.single",
"patterns": [
{
"include": "#escapes"
}
]
},
"constant": {
"match": "\\b(true|false)\\b",
"name": "constant.language.ron"
},
"dictionary": {
"begin": "\\{",
"beginCaptures": {
"0": {
"name": "punctuation.section.dictionary.begin.ron"
}
},
"end": "}",
"endCaptures": {
"0": {
"name": "punctuation.section.dictionary.end.ron"
}
},
"patterns": [
{
"include": "#value"
},
{
"include": "#struct-name"
},
{
"include": "#object"
},
{
"include": "#enum-variant"
},
{
"match": ",",
"name": "punctuation.separator.dictionary.ron"
},
{
"match": ":",
"name": "punctuation.separator.dictionary.key-value.ron"
}
]
},
"enum-variant": {
"match": "[_a-z][0-9A-Z_a-z]*",
"name": "entity.name.tag.ron"
},
"escapes": {
"captures": {
"1": {
"name": "constant.character.escape.backslash.ron"
},
"2": {
"name": "constant.character.escape.bit.ron"
},
"3": {
"name": "constant.character.escape.unicode.ron"
},
"4": {
"name": "constant.character.escape.unicode.punctuation.ron"
},
"5": {
"name": "constant.character.escape.unicode.punctuation.ron"
}
},
"match": "(\\\\)(?:(x[0-7][0-7A-Fa-f])|(u(\\{)[A-Fa-f\\d]{4,6}(}))|.)",
"name": "constant.character.escape.ron"
},
"expression": {
"patterns": [
{
"include": "#array"
},
{
"include": "#block_comment"
},
{
"include": "#constant"
},
{
"include": "#dictionary"
},
{
"include": "#line_comment"
},
{
"include": "#number"
},
{
"include": "#raw_string"
},
{
"include": "#struct-field"
},
{
"include": "#struct-name"
},
{
"include": "#object"
},
{
"include": "#string"
},
{
"include": "#character"
},
{
"include": "#enum-variant"
}
]
},
"line_comment": {
"begin": "//",
"end": "$",
"name": "comment.line.double-slash.ron"
},
"number": {
"patterns": [
{
"match": "-?\\b0x[_\\h]+\\b",
"name": "constant.numeric.hex.ron"
},
{
"match": "-?\\b0b[01_]+\\b",
"name": "constant.numeric.binary.ron"
},
{
"match": "-?\\b0o[0-7_]+\\b",
"name": "constant.numeric.octal.ron"
},
{
"match": "-?\\b[0-9][0-9_]*(?:\\.[0-9][0-9_]*)?(?:[Ee][-+]?[0-9_]+)?\\b",
"name": "constant.numeric.ron"
}
]
},
"object": {
"begin": "\\(",
"beginCaptures": {
"0": {
"name": "punctuation.section.parens.begin.ron"
}
},
"end": "\\)",
"endCaptures": {
"0": {
"name": "punctuation.section.parens.end.ron"
}
},
"patterns": [
{
"include": "#value"
},
{
"include": "#dictionary"
},
{
"include": "#struct-field"
},
{
"include": "#struct-name"
},
{
"include": "#enum-variant"
},
{
"include": "#object"
}
]
},
"raw_string": {
"patterns": [
{
"begin": "r#{5}\"",
"end": "\"#{5}",
"name": "string.quoted.other.raw.ron"
},
{
"begin": "r#{4}\"",
"end": "\"#{4}",
"name": "string.quoted.other.raw.ron"
},
{
"begin": "r#{3}\"",
"end": "\"#{3}",
"name": "string.quoted.other.raw.ron"
},
{
"begin": "r#{2}\"",
"end": "\"#{2}",
"name": "string.quoted.other.raw.ron"
},
{
"begin": "r#\"",
"end": "\"#",
"name": "string.quoted.other.raw.ron"
},
{
"begin": "r\"",
"end": "\"",
"name": "string.quoted.other.raw.ron"
}
]
},
"string": {
"begin": "(b?)(\")",
"end": "\"",
"name": "string.quoted.double",
"patterns": [
{
"include": "#escapes"
}
]
},
"struct-field": {
"captures": {
"1": {
"name": "variable.other.member.ron"
},
"2": {
"name": "punctuation.separator.key-value.ron"
}
},
"match": "([_a-z][0-9A-Z_a-z]*)\\s*(:)"
},
"struct-name": {
"match": "[A-Z][0-9A-Z_a-z]*",
"name": "entity.name.type.ron"
},
"value": {
"patterns": [
{
"include": "#array"
},
{
"include": "#block_comment"
},
{
"include": "#constant"
},
{
"include": "#dictionary"
},
{
"include": "#line_comment"
},
{
"include": "#number"
},
{
"include": "#object"
},
{
"include": "#raw_string"
},
{
"include": "#string"
},
{
"include": "#character"
}
]
}
},
"scopeName": "source.ron"
}