{
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "JSPL",
"scopeName": "source.jspl",
"patterns": [{ "include": "#all_expressions" }],
"repository": {
"all_expressions": {
"patterns": [
{ "include": "#comment" },
{ "include": "#param" },
{ "include": "#call" },
{ "include": "#type_primitive" },
{ "include": "#constant" },
{ "include": "#variable" },
{ "include": "#operator" },
{ "include": "#block" },
{ "include": "#array" }
]
},
"comment": {
"match": "\\s*#.*$",
"name": "comment.line.number-sign.jspl"
},
"operator": {
"patterns": [
{
"match": "\\+=|-=|\\*=|/=|%=|==|!=|<=|>=",
"name": "keyword.operator.jspl"
},
{
"match": "=|\\+|-|\\*|/|%|<|>",
"name": "keyword.operator.jspl"
}
]
},
"variable": {
"match": "[a-zA-Z_][a-zA-Z0-9_]*",
"name": "variable.name.jspl"
},
"constant": {
"patterns": [
{
"match": "\\b(true|false|null)\\b",
"name": "constant.language.jspl"
},
{
"match": "-?\\d+(\\.\\d+)?([eE][-+]?\\d+)?",
"name": "constant.numeric.jspl"
},
{
"begin": "\\\"",
"patterns": [
{ "match": "\\\\.", "name": "constant.character.escape.jspl" },
{ "match": "[^\\\"]", "name": "string.quoted.double.jspl" }
],
"end": "\\\"",
"name": "string.quoted.double.jspl"
}
]
},
"call": {
"begin": "(?:(define|let|global)|(main|import|export|while|ret|GUI|if|scope|break|continue)|(Int|Float|Bool|Str|Null)|([a-zA-Z_][a-zA-Z0-9_]*))\\s*\\(",
"beginCaptures": {
"1": { "name": "storage.type.jspl" },
"2": { "name": "keyword.control.jspl" },
"3": { "name": "support.type.primitive.jspl" },
"4": { "name": "support.function.jspl" }
},
"end": "\\)",
"patterns": [{ "include": "#all_expressions" }, { "match": "," }]
},
"block": {
"begin": "\\{",
"end": "\\}",
"patterns": [{ "include": "#all_expressions" }]
},
"param": {
"match": "([a-zA-Z_][a-zA-Z0-9_]*)\\s*:\\s*(Int|Float|Bool|Str|Null)",
"captures": {
"1": { "name": "variable.parameter.jspl" },
"2": { "name": "support.type.primitive.jspl" }
}
},
"key": {
"match": "([a-zA-Z_][a-zA-Z0-9_]*)\\s*:",
"captures": {
"1": { "name": "variable.parameter.jspl" }
}
},
"type_primitive": {
"match": "\\b(Int|Float|Bool|Str|Null)\\b",
"name": "support.type.primitive.jspl"
}
}
}