{ "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json", "name": "Gotlin", "scopeName": "source.gotlin", "patterns": [ { "include": "#comments" }, { "include": "#imports" }, { "include": "#package" }, { "include": "#annotations" }, { "include": "#declarations" }, { "include": "#functions" }, { "include": "#strings" }, { "include": "#sql" }, { "include": "#generics" }, { "include": "#literals" }, { "include": "#keywords" }, { "include": "#types" }, { "include": "#numbers" }, { "include": "#typeOperators" }, { "include": "#operators" } ], "repository": { "comments": { "patterns": [ { "name": "comment.line.double-slash.gotlin", "match": "//.*$" } ] }, "imports": { "patterns": [ { "name": "meta.import.go.quoted.gotlin", "match": "^(\\s*)(import)\\s+([A-Za-z_][A-Za-z0-9_]*)\\s+(\"(?:\\\\.|[^\"\\\\])*\")\\s*;?", "captures": { "2": { "name": "keyword.control.import.gotlin" }, "3": { "name": "entity.name.namespace.alias.gotlin" }, "4": { "name": "string.quoted.double.import-path.gotlin" } } }, { "name": "meta.import.go.quoted.gotlin", "match": "^(\\s*)(import)\\s+(\"(?:\\\\.|[^\"\\\\])*\")\\s*;?", "captures": { "2": { "name": "keyword.control.import.gotlin" }, "3": { "name": "string.quoted.double.import-path.gotlin" } } }, { "name": "meta.import.go.bare.gotlin", "match": "^(\\s*)(import)\\s+(?:([A-Za-z_][A-Za-z0-9_]*)\\s+)?([A-Za-z_][A-Za-z0-9_]*(?:[.-][A-Za-z_][A-Za-z0-9_]*)*)\\s*;?\\s*(?://.*)?$", "captures": { "2": { "name": "keyword.control.import.gotlin" }, "3": { "name": "entity.name.namespace.alias.gotlin" }, "4": { "name": "entity.name.namespace.import-path.gotlin" } } } ] }, "package": { "patterns": [ { "name": "meta.package.gotlin", "match": "^(\\s*)(package)\\s+([A-Za-z_][A-Za-z0-9_]*(?:[.-][A-Za-z_][A-Za-z0-9_]*)*)\\s*;?", "captures": { "2": { "name": "keyword.control.package.gotlin" }, "3": { "name": "entity.name.namespace.gotlin" } } } ] }, "annotations": { "patterns": [ { "match": "(@)(jsonNaming)\\b", "captures": { "1": { "name": "punctuation.definition.annotation.gotlin" }, "2": { "name": "entity.other.attribute-name.annotation.json-naming.gotlin" } } }, { "match": "(@)(embed)\\b", "captures": { "1": { "name": "punctuation.definition.annotation.gotlin" }, "2": { "name": "entity.other.attribute-name.annotation.embed.gotlin" } } }, { "match": "(@)(table)\\b", "captures": { "1": { "name": "punctuation.definition.annotation.gotlin" }, "2": { "name": "entity.other.attribute-name.annotation.table.gotlin" } } }, { "match": "(@)(column)\\b", "captures": { "1": { "name": "punctuation.definition.annotation.gotlin" }, "2": { "name": "entity.other.attribute-name.annotation.column.gotlin" } } }, { "match": "(@)(id)\\b", "captures": { "1": { "name": "punctuation.definition.annotation.gotlin" }, "2": { "name": "entity.other.attribute-name.annotation.id.gotlin" } } }, { "match": "(@)(generated)\\b", "captures": { "1": { "name": "punctuation.definition.annotation.gotlin" }, "2": { "name": "entity.other.attribute-name.annotation.generated.gotlin" } } }, { "match": "(@)([A-Za-z_][A-Za-z0-9_]*)", "captures": { "1": { "name": "punctuation.definition.annotation.gotlin" }, "2": { "name": "entity.other.attribute-name.annotation.gotlin" } } } ] }, "declarations": { "patterns": [ { "name": "meta.class.data.gotlin", "match": "\\b(data)\\s+(class)\\s+([A-Za-z_][A-Za-z0-9_]*)", "captures": { "1": { "name": "storage.modifier.data.gotlin" }, "2": { "name": "storage.type.class.gotlin" }, "3": { "name": "entity.name.type.class.gotlin" } } }, { "name": "meta.interface.gotlin", "match": "\\b(interface)\\s+([A-Za-z_][A-Za-z0-9_]*)", "captures": { "1": { "name": "storage.type.interface.gotlin" }, "2": { "name": "entity.name.type.interface.gotlin" } } }, { "name": "meta.worker.gotlin", "match": "\\b(worker)\\s+([A-Za-z_][A-Za-z0-9_]*)", "captures": { "1": { "name": "storage.type.worker.gotlin" }, "2": { "name": "entity.name.type.worker.gotlin" } } }, { "name": "meta.enum.gotlin", "match": "\\b(enum)\\s+([A-Za-z_][A-Za-z0-9_]*)", "captures": { "1": { "name": "storage.type.enum.gotlin" }, "2": { "name": "entity.name.type.enum.gotlin" } } }, { "name": "meta.class.gotlin", "match": "\\b(class)\\s+([A-Za-z_][A-Za-z0-9_]*)", "captures": { "1": { "name": "storage.type.class.gotlin" }, "2": { "name": "entity.name.type.class.gotlin" } } } ] }, "functions": { "patterns": [ { "name": "meta.function.gotlin", "match": "\\b(?:(override)\\s+)?(fun)\\s+([A-Za-z_][A-Za-z0-9_]*)", "captures": { "1": { "name": "storage.modifier.override.gotlin" }, "2": { "name": "storage.type.function.gotlin" }, "3": { "name": "entity.name.function.gotlin" } } } ] }, "strings": { "patterns": [ { "name": "string.quoted.double.gotlin", "begin": "\"", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.gotlin" } }, "end": "\"", "endCaptures": { "0": { "name": "punctuation.definition.string.end.gotlin" } }, "patterns": [ { "name": "constant.character.escape.gotlin", "match": "\\\\." } ] } ] }, "sql": { "patterns": [ { "name": "support.type.namespace.sql.gotlin", "match": "\\bsql\\b(?=\\s*\\.)" }, { "name": "support.function.sql.query.gotlin", "match": "(?<=\\.)\\b(from|where|select|orderBy|orderByDescending|limit|forUpdate|skipLocked)\\b" }, { "name": "support.function.sql.mutation.gotlin", "match": "(?<=\\.)\\b(insert|update|delete|onConflict|doNothing|doUpdate|returning)\\b" }, { "name": "support.function.sql.execution.gotlin", "match": "(?<=\\.)\\b(build|fetch|single|iterator)\\b" }, { "name": "support.function.sql.helper.gotlin", "match": "\\b(set|now)\\b(?=\\s*\\()" }, { "name": "support.function.mapping.gotlin", "match": "(?<=\\.)\\bmapTo\\b" } ] }, "generics": { "patterns": [ { "name": "punctuation.definition.generic.begin.gotlin", "match": "(?<=\\w)<(?=\\s*[*A-Za-z_])" }, { "name": "punctuation.definition.generic.end.gotlin", "match": ">(?=\\??\\s*(?:[>,.()\\[\\]{}:=]|$))" } ] }, "literals": { "patterns": [ { "name": "constant.language.boolean.gotlin", "match": "\\b(true|false)\\b" }, { "name": "constant.language.null.gotlin", "match": "\\bnull\\b" }, { "name": "variable.language.this.gotlin", "match": "\\b(this|it)\\b" } ] }, "keywords": { "patterns": [ { "name": "keyword.control.declaration.gotlin", "match": "\\b(package|import|data|class|interface|worker|enum|fun)\\b" }, { "name": "storage.modifier.gotlin", "match": "\\b(private|override)\\b" }, { "name": "storage.type.variable.gotlin", "match": "\\b(val|var)\\b" }, { "name": "keyword.control.conditional.gotlin", "match": "\\b(if|else|match)\\b" }, { "name": "keyword.control.loop.gotlin", "match": "\\b(while|for|in)\\b" }, { "name": "keyword.control.concurrency.gotlin", "match": "\\b(select|go|defer)\\b" }, { "name": "keyword.control.exception.gotlin", "match": "\\b(try|catch|throw)\\b" }, { "name": "keyword.control.return.gotlin", "match": "\\breturn\\b" } ] }, "types": { "patterns": [ { "name": "support.type.builtin.gotlin", "match": "\\b(Int|String|Boolean|Unit|Double|Float|Any|ByteSlice|List|MutableList|Map|MutableMap|Channel|GotlinSQLQuery|GotlinSQLIterator)\\b" }, { "name": "support.type.qualified.gotlin", "match": "\\b[A-Za-z_][A-Za-z0-9_]*(?:\\.[A-Za-z_][A-Za-z0-9_]*)+\\b" }, { "name": "entity.name.type.gotlin", "match": "\\b[A-Z][A-Za-z0-9_]*\\b" } ] }, "numbers": { "patterns": [ { "name": "constant.numeric.float.gotlin", "match": "\\b[0-9]+\\.[0-9]+\\b" }, { "name": "constant.numeric.integer.gotlin", "match": "\\b[0-9]+\\b" } ] }, "typeOperators": { "patterns": [ { "name": "keyword.operator.type.nullable.gotlin", "match": "(?<=[A-Za-z0-9_>])\\?" }, { "name": "keyword.operator.address.gotlin", "match": "&(?=\\s*[A-Za-z_(])" }, { "name": "keyword.operator.pointer.dereference.spread.gotlin", "match": "\\*(?=\\s*[A-Za-z_(])" } ] }, "operators": { "patterns": [ { "name": "keyword.operator.assignment.gotlin", "match": "\\+=|=" }, { "name": "keyword.operator.comparison.gotlin", "match": "==|!=|<=|>=" }, { "name": "keyword.operator.logical.gotlin", "match": "&&|\\|\\||!" }, { "name": "keyword.operator.arrow.gotlin", "match": "->" }, { "name": "punctuation.accessor.enum.gotlin", "match": "::" }, { "name": "keyword.operator.arithmetic.gotlin", "match": "[+\\-*/%<>]" }, { "name": "punctuation.accessor.dot.gotlin", "match": "\\." }, { "name": "punctuation.separator.gotlin", "match": "[,;:]" } ] } } }