{ "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json", "name": "sx", "scopeName": "source.sx", "patterns": [ { "include": "#comments" }, { "include": "#strings" }, { "include": "#directives" }, { "include": "#keywords" }, { "include": "#types" }, { "include": "#type-declaration" }, { "include": "#type-annotation" }, { "include": "#constants" }, { "include": "#numbers" }, { "include": "#operators" }, { "include": "#function-declaration" }, { "include": "#enum-literal" }, { "include": "#identifiers" } ], "repository": { "comments": { "patterns": [ { "name": "comment.line.double-slash.sx", "match": "//.*$" } ] }, "strings": { "patterns": [ { "begin": "\"", "end": "\"", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.sx" } }, "endCaptures": { "0": { "name": "punctuation.definition.string.end.sx" } }, "patterns": [ { "name": "constant.character.escape.sx", "match": "\\\\[ntr\"\\\\{}]" }, { "begin": "\\{", "end": "\\}", "beginCaptures": { "0": { "name": "punctuation.definition.template-expression.begin.sx" } }, "endCaptures": { "0": { "name": "punctuation.definition.template-expression.end.sx" } }, "patterns": [ { "include": "$self" } ] }, { "name": "string.quoted.double.sx", "match": "[^\"\\\\{}]+" } ] } ] }, "directives": { "patterns": [ { "name": "keyword.other.directive.sx", "match": "#run" } ] }, "keywords": { "patterns": [ { "name": "keyword.control.sx", "match": "\\b(if|else|then|return|case|break|defer)\\b" }, { "name": "keyword.other.sx", "match": "\\b(enum|struct)\\b" }, { "name": "keyword.operator.cast.sx", "match": "\\bxx\\b" } ] }, "types": { "patterns": [ { "name": "storage.type.sx", "match": "\\b(s[0-9]+|u[0-9]+|f32|f64|bool|string)\\b" } ] }, "type-declaration": { "patterns": [ { "match": "([A-Z][a-zA-Z0-9_]*)\\s*(::)\\s*(?=struct\\b|enum\\b)", "captures": { "1": { "name": "entity.name.type.sx" }, "2": { "name": "keyword.operator.declaration.sx" } } } ] }, "type-annotation": { "patterns": [ { "match": "(?|=>" }, { "name": "keyword.operator.comparison.sx", "match": "==|!=|<=|>=" }, { "name": "keyword.operator.assignment.sx", "match": "[+\\-*/]=" }, { "name": "keyword.operator.sx", "match": "[+\\-*/=<>!]" } ] }, "function-declaration": { "patterns": [ { "match": "([a-zA-Z_][a-zA-Z0-9_]*)\\s*(::)\\s*(?=\\(|\\{)", "captures": { "1": { "name": "entity.name.function.sx" }, "2": { "name": "keyword.operator.declaration.sx" } } } ] }, "enum-literal": { "patterns": [ { "match": "\\.([a-zA-Z_][a-zA-Z0-9_]*)", "captures": { "1": { "name": "variable.other.enummember.sx" } } } ] }, "identifiers": { "patterns": [ { "name": "variable.other.generic-type.sx", "match": "\\$([a-zA-Z_][a-zA-Z0-9_]*)", "captures": { "1": { "name": "entity.name.type.parameter.sx" } } }, { "match": "\\b(io)\\b", "name": "support.module.sx" } ] } } }