{ "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json", "name": "Rex", "scopeName": "source.rex", "patterns": [ { "include": "#comments" }, { "include": "#strings" }, { "include": "#chars" }, { "include": "#declarations" }, { "include": "#keywords" }, { "include": "#constants" }, { "include": "#numbers" }, { "include": "#types" }, { "include": "#calls" }, { "include": "#operators" } ], "repository": { "comments": { "patterns": [ { "name": "comment.line.double-slash.rex", "match": "//.*$" }, { "name": "comment.block.rex", "begin": "/\\*", "end": "\\*/" } ] }, "strings": { "name": "string.quoted.double.rex", "begin": "\"", "end": "\"", "patterns": [ { "name": "constant.character.escape.rex", "match": "\\\\." }, { "name": "meta.interpolation.rex", "begin": "\\{", "end": "\\}", "beginCaptures": { "0": { "name": "punctuation.section.interpolation.begin.rex" } }, "endCaptures": { "0": { "name": "punctuation.section.interpolation.end.rex" } }, "patterns": [{ "include": "$self" }] } ] }, "chars": { "name": "string.quoted.single.rex", "match": "'(?:\\\\.|[^'\\\\])'", "captures": {} }, "declarations": { "patterns": [ { "match": "\\b(func)\\s+([A-Za-z_][A-Za-z0-9_]*)", "captures": { "1": { "name": "keyword.declaration.function.rex" }, "2": { "name": "entity.name.function.rex" } } }, { "match": "\\b(struct|enum|interface)\\s+([A-Za-z_][A-Za-z0-9_]*)", "captures": { "1": { "name": "keyword.declaration.type.rex" }, "2": { "name": "entity.name.type.rex" } } } ] }, "keywords": { "patterns": [ { "name": "keyword.control.rex", "match": "\\b(if|else|for|in|step|match|return|break|continue)\\b" }, { "name": "keyword.declaration.rex", "match": "\\b(func|var|const|import|struct|enum|interface|pub)\\b" }, { "name": "storage.modifier.rex", "match": "\\b(shared|weak)\\b" } ] }, "constants": { "name": "constant.language.rex", "match": "\\b(true|false|nil)\\b" }, "numbers": { "name": "constant.numeric.rex", "match": "\\b[0-9][0-9_]*(?:\\.[0-9][0-9_]*)?\\b" }, "types": { "patterns": [ { "name": "support.type.builtin.rex", "match": "\\b(int|float|bool|char|string|error|map|i8|i16|i32|i64|u8|u16|u32|u64|f32|f64)\\b" }, { "name": "entity.name.type.rex", "match": "\\b[A-Z][A-Za-z0-9_]*\\b" } ] }, "calls": { "name": "entity.name.function.call.rex", "match": "\\b[a-z_][A-Za-z0-9_]*(?=\\s*\\()" }, "operators": { "patterns": [ { "name": "keyword.operator.arrow.rex", "match": "=>" }, { "name": "keyword.operator.range.rex", "match": "\\.\\." }, { "name": "keyword.operator.comparison.rex", "match": "==|!=|<=|>=|<|>" }, { "name": "keyword.operator.logical.rex", "match": "&&|\\|\\||!" }, { "name": "keyword.operator.assignment.rex", "match": "[-+*/%]?=" }, { "name": "keyword.operator.arithmetic.rex", "match": "[-+*/%]" }, { "name": "keyword.operator.optional.rex", "match": "\\?" } ] } } }