slige/editors/vscode/syntaxes/slige.tmLanguage.json
2025-01-17 11:50:14 +01:00

130 lines
3.8 KiB
JSON

{
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "Slige",
"patterns": [
{ "include": "#comments" },
{ "include": "#keywords" },
{ "include": "#strings" },
{ "include": "#numbers" },
{ "include": "#operators" },
{ "include": "#punctuation" },
{ "include": "#functions" },
{ "include": "#idents" }
],
"repository": {
"comments": {
"patterns": [
{
"name": "comment.line.slige",
"begin": "//",
"end": "\\n"
},
{
"name": "comment.block.slige",
"begin": "/\\*",
"end": "\\*/"
}
]
},
"keywords": {
"patterns": [
{
"name": "keyword.control.slige",
"match": "\\b(break|return|let|fn|loop|if|else|struct|import|or|and|not|while|for|in)\\b"
},
{
"name": "constant.language.slige",
"match": "\\b(null|false|true)\\b"
},
{
"name": "storage.type.slige",
"match": "\\b(int|string|bool)\\b"
}
]
},
"strings": {
"name": "string.quoted.double.slige",
"begin": "\"",
"end": "\"",
"patterns": [
{
"name": "constant.character.escape.slige",
"match": "\\\\."
}
]
},
"chars": {
"name": "string.quoted.double.slige",
"begin": "'",
"end": "'",
"patterns": [
{
"name": "constant.character.escape.slige",
"match": "\\\\."
}
]
},
"numbers": {
"patterns": [
{
"name": "constant.numeric.slige",
"match": "\\b0\\b"
},
{
"name": "constant.numeric.slige",
"match": "\\b[1-9][0-9]*(\\.[0-9]+)?\\b"
},
{
"name": "constant.numeric.slige",
"match": "\\b0x[0-9a-fA-F]+?\\b"
},
{
"name": "constant.numeric.slige",
"match": "\\b0b[01]+?\\b"
}
]
},
"operators": {
"patterns": [
{
"match": "\\+|\\-|\\*|\\/|=|(\\+=)|(\\-=)|(==)|(!=)|<|>|(<=)|(>=)|\\.|:|(\\->)|(::)|(::<)",
"name": "keyword.operator.slige"
}
]
},
"punctuation": {
"patterns": [
{
"match": ";",
"name": "punctuation.terminator.statement.slige"
},
{
"match": ",",
"name": "punctuation.separator.delimiter.slige"
}
]
},
"functions": {
"patterns": [
{
"match": "(?>\\b[a-zA-Z_][a-zA-Z0-9_]*)\\s*(?=(?>\\:\\:<.*?>)?\\()",
"name": "entity.name.function.slige"
}
]
},
"idents": {
"patterns": [
{
"match": "\\b[a-z_][a-zA-Z0-9_]*\\b",
"name": "variable.other.slige"
},
{
"match": "\\b[A-Z][a-zA-Z0-9_]*\\b",
"name": "entity.name.type.slige"
}
]
}
},
"scopeName": "source.slige"
}