203 lines
4.5 KiB
JSON
203 lines
4.5 KiB
JSON
{
|
|
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
|
|
"name": "Gotlin",
|
|
"scopeName": "source.gotlin",
|
|
"patterns": [
|
|
{
|
|
"include": "#comments"
|
|
},
|
|
{
|
|
"include": "#imports"
|
|
},
|
|
{
|
|
"include": "#package"
|
|
},
|
|
{
|
|
"include": "#functions"
|
|
},
|
|
{
|
|
"include": "#typesDecl"
|
|
},
|
|
{
|
|
"include": "#literals"
|
|
},
|
|
{
|
|
"include": "#keywords"
|
|
},
|
|
{
|
|
"include": "#types"
|
|
},
|
|
{
|
|
"include": "#strings"
|
|
},
|
|
{
|
|
"include": "#numbers"
|
|
},
|
|
{
|
|
"include": "#operators"
|
|
}
|
|
],
|
|
"repository": {
|
|
"comments": {
|
|
"patterns": [
|
|
{
|
|
"name": "comment.line.double-slash.gotlin",
|
|
"match": "//.*$"
|
|
}
|
|
]
|
|
},
|
|
"imports": {
|
|
"patterns": [
|
|
{
|
|
"name": "meta.import.gotlin",
|
|
"match": "\\b(import)\\b\\s+((?:[A-Za-z_][\\w-]*\\.)*[A-Za-z_][\\w-]*)(?:\\s+((?:[A-Za-z_][\\w-]*\\.)*[A-Za-z_][\\w-]*))?",
|
|
"captures": {
|
|
"1": {
|
|
"name": "keyword.control.import.gotlin"
|
|
},
|
|
"2": {
|
|
"name": "meta.path.gotlin"
|
|
},
|
|
"3": {
|
|
"name": "meta.path.gotlin"
|
|
}
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"package": {
|
|
"patterns": [
|
|
{
|
|
"name": "meta.package.gotlin",
|
|
"match": "\\b(package)\\b\\s+((?:[A-Za-z_][\\w-]*\\.)*[A-Za-z_][\\w-]*)",
|
|
"captures": {
|
|
"1": {
|
|
"name": "keyword.control.package.gotlin"
|
|
},
|
|
"2": {
|
|
"name": "meta.path.gotlin"
|
|
}
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"functions": {
|
|
"patterns": [
|
|
{
|
|
"name": "meta.function.gotlin",
|
|
"match": "\\b(?:(override)\\s+)?(fun)\\b\\s+([A-Za-z_][A-Za-z0-9_]*)",
|
|
"captures": {
|
|
"1": {
|
|
"name": "storage.modifier.gotlin"
|
|
},
|
|
"2": {
|
|
"name": "keyword.control.function.gotlin"
|
|
},
|
|
"3": {
|
|
"name": "entity.name.function.gotlin"
|
|
}
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"typesDecl": {
|
|
"patterns": [
|
|
{
|
|
"name": "meta.interface.gotlin",
|
|
"match": "\\b(interface)\\b\\s+([A-Za-z_][A-Za-z0-9_]*)",
|
|
"captures": {
|
|
"1": {
|
|
"name": "storage.type.interface.gotlin"
|
|
},
|
|
"2": {
|
|
"name": "entity.name.type.interface.gotlin"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"name": "meta.class.gotlin",
|
|
"match": "\\b(class)\\b\\s+([A-Za-z_][A-Za-z0-9_]*)",
|
|
"captures": {
|
|
"1": {
|
|
"name": "storage.type.class.gotlin"
|
|
},
|
|
"2": {
|
|
"name": "entity.name.type.class.gotlin"
|
|
}
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"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": "\\bthis\\b"
|
|
}
|
|
]
|
|
},
|
|
"keywords": {
|
|
"patterns": [
|
|
{
|
|
"name": "keyword.control.gotlin",
|
|
"match": "\\b(fun|val|var|override|if|else|while|return|try|catch|throw)\\b"
|
|
}
|
|
]
|
|
},
|
|
"types": {
|
|
"patterns": [
|
|
{
|
|
"name": "storage.type.gotlin",
|
|
"match": "\\b(Int|String|Boolean|Unit)\\b"
|
|
},
|
|
{
|
|
"name": "support.type.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"
|
|
}
|
|
]
|
|
},
|
|
"strings": {
|
|
"patterns": [
|
|
{
|
|
"name": "string.quoted.double.gotlin",
|
|
"begin": "\"",
|
|
"end": "\"",
|
|
"patterns": [
|
|
{
|
|
"name": "constant.character.escape.gotlin",
|
|
"match": "\\\\."
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
"numbers": {
|
|
"patterns": [
|
|
{
|
|
"name": "constant.numeric.gotlin",
|
|
"match": "\\b\\d+\\b"
|
|
}
|
|
]
|
|
},
|
|
"operators": {
|
|
"patterns": [
|
|
{
|
|
"name": "keyword.operator.gotlin",
|
|
"match": "->|==|!=|<=|>=|&&|\\|\\||[=+\\-*/%<>!:.,]"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
}
|