Files
squirrelVsis/syntaxes/squirrel.tmLanguage.json

139 lines
3.1 KiB
JSON
Raw Permalink Normal View History

2025-09-17 10:54:25 +08:00
{
"name": "Squirrel",
"scopeName": "source.squirrel",
"fileTypes": ["nut"],
"patterns": [
{
"include": "#keywords"
},
{
"include": "#strings"
},
{
"include": "#comments"
},
{
"include": "#numbers"
},
{
"include": "#operators"
},
{
"include": "#functions"
},
{
"include": "#classes"
},
{
"include": "#constants"
},
{
"include": "#variables"
}
],
"repository": {
"keywords": {
"patterns": [
{
"name": "keyword.control.squirrel",
"match": "\\b(if|else|while|for|foreach|do|switch|case|default|break|continue|return|yield|try|catch|throw|resume)\\b"
},
{
"name": "keyword.other.squirrel",
"match": "\\b(function|local|let|const|static|enum|class|extends|constructor|typeof|instanceof|in|delete|delegate|vargc|vargv|tailcall|clone|weakref|null|true|false)\\b"
}
]
},
"strings": {
"patterns": [
{
"name": "string.quoted.double.squirrel",
"begin": "\"",
"end": "\"",
"patterns": [
{
"name": "constant.character.escape.squirrel",
"match": "\\\\."
}
]
},
{
"name": "string.quoted.single.squirrel",
"begin": "'",
"end": "'",
"patterns": [
{
"name": "constant.character.escape.squirrel",
"match": "\\\\."
}
]
}
]
},
"comments": {
"patterns": [
{
"name": "comment.line.double-slash.squirrel",
"match": "//.*$"
},
{
"name": "comment.block.squirrel",
"begin": "/\\*",
"end": "\\*/"
}
]
},
"numbers": {
"patterns": [
{
"name": "constant.numeric.squirrel",
"match": "\\b(0[xX][0-9a-fA-F]+|\\d+\\.\\d+([eE][+-]?\\d+)?|\\d+)\\b"
}
]
},
"operators": {
"patterns": [
{
"name": "keyword.operator.squirrel",
"match": "(\\+\\+|--|<<|>>|<=|>=|==|!=|&&|\\|\\||\\+=|-=|\\*=|/=|%=|&=|\\|=|\\^=|<<=|>>=|\\+|-|\\*|/|%|&|\\||\\^|~|<|>|!|=|\\.|\\?|:|\\[|\\]|\\(|\\)|\\{|\\}|,|;)"
}
]
},
"functions": {
"patterns": [
{
"name": "entity.name.function.squirrel",
"match": "\\b([a-zA-Z_][a-zA-Z0-9_]*)\\s*(?=\\()"
}
]
},
"classes": {
"patterns": [
{
"name": "entity.name.type.class.squirrel",
"match": "\\b([A-Z][a-zA-Z0-9_]*)\\b"
}
]
},
"constants": {
"patterns": [
{
"name": "constant.language.squirrel",
"match": "\\b(null|true|false)\\b"
},
{
"name": "constant.numeric.squirrel",
"match": "\\b(PI|E|RAND_MAX)\\b"
}
]
},
"variables": {
"patterns": [
{
"name": "variable.other.squirrel",
"match": "\\b([a-zA-Z_][a-zA-Z0-9_]*)\\b"
}
]
}
}
}