qamp/Qrakhen.Qamp.VsCode/syntaxes/qamp.tmLanguage.json

124 lines
3.0 KiB
JSON

{
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "qamp",
"scopeName": "source.qamp",
"patterns": [
{ "include": "#comments" },
{ "include": "#strings" },
{ "include": "#keywords" },
{ "include": "#operators" },
{ "include": "#numbers" },
{ "include": "#functions" },
{ "include": "#globals" }
],
"repository": {
"globals": {
"patterns": [
{
"name": "support.function.qamp",
"match": "\\b(sin|cos|read|write|fread|fwrite|time|ftime)\\b"
},
{
"name": "support.string.qamp",
"match": "\\b(SubString|IndexOf|Split|Length)\\b"
}
]
},
"comments": {
"patterns": [
{
"name": "comment.line.double-slash.qamp",
"match": "#.*$"
}
]
},
"strings": {
"patterns": [
{
"name": "string.quoted.double.qamp",
"begin": "\"",
"end": "\"",
"patterns": [{ "name": "constant.character.escape.qamp", "match": "\\\\." }]
},
{
"name": "string.quoted.single.qamp",
"begin": "'",
"end": "'"
}
]
},
"keywords": {
"patterns": [
{
"name": "keyword.control.qamp",
"match": "\\b(if|else|for|while|var|do)\\b"
},
{
"name": "storage.type.function.qamp",
"match": "\\b(fq|funq)\\b"
},
{
"name": "keyword.class.qamp",
"match": "\\b(qlass|class|this|base)\\b"
},
{
"name": "keyword.control.flow.return.qamp",
"match": "<:|\\breturn\\b"
},
{
"name": "support.function.print.qamp",
"match": "\\bprint\\b|::"
}
]
},
"operators": {
"patterns": [
{
"name": "keyword.operator.assignment.qamp",
"match": "<~|=|<\\+|<&"
},
{
"name": "keyword.operator.comparison.qamp",
"match": "==|!=|<=|>=|<|>"
},
{
"name": "keyword.operator.arithmetic.qamp",
"match": "\\+|\\-|\\*|/"
},
{
"name": "keyword.operator.binary.qamp",
"match": "&|\\^|\\||~"
}
]
},
"numbers": {
"patterns": [
{
"name": "constant.numeric.hex.qamp",
"match": "\\b0x[0-9a-fA-F]+\\b"
},
{
"name": "constant.numeric.decimal.qamp",
"match": "\\b[0-9]+\\.[0-9]+\\b|\\.[0-9]+\\b|\\b[0-9]+\\b"
}
]
},
"functions": {
"patterns": [
{
"match": "\\b(fq|funq|function)\\s+([a-zA-Z_][a-zA-Z0-9_]*)",
"captures": {
"1": { "name": "storage.type.function.qamp" },
"2": { "name": "entity.name.function.qamp" }
}
},
{
"match": "([a-zA-Z_][a-zA-Z0-9_]*)\\(",
"captures": {
"1": { "name": "entity.name.function.qamp" }
}
}
]
}
}
}