JSON 137 lines
{
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "Flash",
"scopeName": "source.flash",
"fileTypes": ["flash"],
"patterns": [
{ "include": "#comments" },
{ "include": "#strings" },
{ "include": "#multiline-strings" },
{ "include": "#char" },
{ "include": "#builtins" },
{ "include": "#function-decl" },
{ "include": "#keywords" },
{ "include": "#constants" },
{ "include": "#types" },
{ "include": "#numbers" },
{ "include": "#function-call" },
{ "include": "#operators" }
],
"repository": {
"comments": {
"patterns": [
{
"name": "comment.line.documentation.flash",
"match": "///(?!/).*$"
},
{
"name": "comment.line.double-slash.flash",
"match": "//.*$"
}
]
},
"strings": {
"name": "string.quoted.double.flash",
"begin": "\"",
"end": "\"",
"patterns": [
{ "include": "#escapes" }
]
},
"multiline-strings": {
"name": "string.quoted.multi.flash",
"match": "\\\\\\\\.*$"
},
"char": {
"name": "string.quoted.single.flash",
"match": "'([^'\\\\]|\\\\.)'",
"patterns": [
{ "include": "#escapes" }
]
},
"escapes": {
"name": "constant.character.escape.flash",
"match": "\\\\(n|t|r|0|\\\\|\"|'|x[0-9a-fA-F]{2}|u\\{[0-9a-fA-F]{1,6}\\})"
},
"builtins": {
"name": "support.function.builtin.flash",
"match": "#[A-Za-z_][A-Za-z0-9_]*"
},
"function-decl": {
"match": "\\b(fn)\\s+([A-Za-z_][A-Za-z0-9_]*)",
"captures": {
"1": { "name": "storage.type.function.flash" },
"2": { "name": "entity.name.function.flash" }
}
},
"keywords": {
"patterns": [
{
"name": "keyword.control.import.flash",
"match": "\\b(use|as|link)\\b"
},
{
"name": "keyword.control.flash",
"match": "\\b(if|else|while|for|in|break|continue|return|switch|asm)\\b"
},
{
"name": "keyword.control.exception.flash",
"match": "\\b(try|catch|defer|errdefer|orelse)\\b"
},
{
"name": "storage.type.function.flash",
"match": "\\bfn\\b"
},
{
"name": "storage.type.flash",
"match": "\\b(struct|enum|union|error|test)\\b"
},
{
"name": "storage.modifier.flash",
"match": "\\b(const|var|pub|inline|comptime|extern|export|callconv|align|linksection|packed)\\b"
}
]
},
"constants": {
"name": "constant.language.flash",
"match": "\\b(true|false|null|undefined|unreachable)\\b"
},
"types": {
"name": "support.type.primitive.flash",
"match": "\\b(u[0-9]+|i[0-9]+|f16|f32|f64|f80|f128|usize|isize|bool|void|anyopaque|anyerror|anytype|type|noreturn|comptime_int|comptime_float|c_int|c_uint|c_char|c_short|c_ushort|c_long|c_ulong|c_longlong|c_ulonglong|c_longdouble)\\b"
},
"numbers": {
"patterns": [
{
"name": "constant.numeric.hex.flash",
"match": "\\b0x[0-9a-fA-F_]+\\b"
},
{
"name": "constant.numeric.binary.flash",
"match": "\\b0b[01_]+\\b"
},
{
"name": "constant.numeric.octal.flash",
"match": "\\b0o[0-7_]+\\b"
},
{
"name": "constant.numeric.float.flash",
"match": "\\b[0-9][0-9_]*\\.[0-9][0-9_]*([eE][+-]?[0-9_]+)?\\b"
},
{
"name": "constant.numeric.decimal.flash",
"match": "\\b[0-9][0-9_]*\\b"
}
]
},
"function-call": {
"name": "entity.name.function.flash",
"match": "\\b([A-Za-z_][A-Za-z0-9_]*)\\s*(?=\\()"
},
"operators": {
"name": "keyword.operator.flash",
"match": "(\\+%=|-%=|\\*%=|\\+\\+|\\*\\*|\\+%|-%|\\*%|\\+=|-=|\\*=|/=|%=|&=|\\|=|\\^=|<<=|>>=|==|!=|<=|>=|<<|>>|&&|\\|\\||\\.\\.\\.|\\.\\.|->|=>|:=|[-+*/%<>=&|\\^~!?])"
}
}
}