mirror of
https://github.com/Nexoniarz/Finch.git
synced 2026-11-03 08:54:25 +00:00
- technicians' guides: section 31 rewritten around kernels (masks, the end of a list, moving lanes, int8 dot products, choosing instructions at build and at run time) - cheat sheets and engineers' guides: the new operations and their IR; how features are found - Kate and VS Code: @cpu, boolxN and the new built-ins highlighted Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Psc42moPLwP43Cmb9oZqSR
318 lines
7.6 KiB
JSON
318 lines
7.6 KiB
JSON
{
|
|
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
|
|
"name": "Finch",
|
|
"scopeName": "source.finch",
|
|
"fileTypes": [
|
|
"fch"
|
|
],
|
|
"patterns": [
|
|
{
|
|
"include": "#comments"
|
|
},
|
|
{
|
|
"include": "#imports"
|
|
},
|
|
{
|
|
"include": "#struct"
|
|
},
|
|
{
|
|
"include": "#function"
|
|
},
|
|
{
|
|
"include": "#statements"
|
|
}
|
|
],
|
|
"repository": {
|
|
"comments": {
|
|
"patterns": [
|
|
{
|
|
"name": "comment.line.double-slash.finch",
|
|
"match": "//.*$"
|
|
},
|
|
{
|
|
"name": "comment.block.finch",
|
|
"begin": "/\\*",
|
|
"end": "\\*/"
|
|
}
|
|
]
|
|
},
|
|
"imports": {
|
|
"patterns": [
|
|
{
|
|
"match": "^\\s*(import)\\s+(\"[^\"]*\")",
|
|
"captures": {
|
|
"1": {
|
|
"name": "keyword.control.import.finch"
|
|
},
|
|
"2": {
|
|
"name": "string.quoted.double.include.finch"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"match": "^\\s*(import)\\s+([A-Za-z_][A-Za-z0-9_]*)",
|
|
"captures": {
|
|
"1": {
|
|
"name": "keyword.control.import.finch"
|
|
},
|
|
"2": {
|
|
"name": "entity.name.namespace.finch"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"match": "^\\s*(link)\\s+(\"[^\"]*\")",
|
|
"captures": {
|
|
"1": {
|
|
"name": "keyword.control.import.finch"
|
|
},
|
|
"2": {
|
|
"name": "string.quoted.double.finch"
|
|
}
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"struct": {
|
|
"match": "\\b(struct|enum)\\s+([A-Za-z_][A-Za-z0-9_]*)",
|
|
"captures": {
|
|
"1": {
|
|
"name": "storage.type.struct.finch"
|
|
},
|
|
"2": {
|
|
"name": "entity.name.type.struct.finch"
|
|
}
|
|
}
|
|
},
|
|
"function": {
|
|
"match": "\\b(fn)\\s+(?:([A-Za-z_][A-Za-z0-9_]*)(\\.))?([A-Za-z_][A-Za-z0-9_]*)",
|
|
"captures": {
|
|
"1": {
|
|
"name": "storage.type.function.finch"
|
|
},
|
|
"2": {
|
|
"name": "entity.name.type.finch"
|
|
},
|
|
"3": {
|
|
"name": "punctuation.accessor.finch"
|
|
},
|
|
"4": {
|
|
"name": "entity.name.function.finch"
|
|
}
|
|
}
|
|
},
|
|
"statements": {
|
|
"patterns": [
|
|
{
|
|
"name": "keyword.other.test.finch",
|
|
"match": "\\btest(?=\\s*\")"
|
|
},
|
|
{
|
|
"include": "#comments"
|
|
},
|
|
{
|
|
"include": "#longstrings"
|
|
},
|
|
{
|
|
"include": "#strings"
|
|
},
|
|
{
|
|
"include": "#chars"
|
|
},
|
|
{
|
|
"include": "#numbers"
|
|
},
|
|
{
|
|
"name": "keyword.control.finch",
|
|
"match": "\\b(if|else|while|for|in|break|continue|return|defer|or|try|match)\\b"
|
|
},
|
|
{
|
|
"name": "storage.type.function.finch",
|
|
"match": "\\bfn\\b"
|
|
},
|
|
{
|
|
"name": "storage.type.struct.finch",
|
|
"match": "\\b(struct|enum|const)\\b"
|
|
},
|
|
{
|
|
"name": "storage.modifier.finch",
|
|
"match": "\\bexport\\b"
|
|
},
|
|
{
|
|
"name": "constant.language.finch",
|
|
"match": "\\b(true|false|null)\\b"
|
|
},
|
|
{
|
|
"name": "variable.language.self.finch",
|
|
"match": "\\bself\\b"
|
|
},
|
|
{
|
|
"name": "storage.modifier.attribute.finch",
|
|
"match": "@cpu\\b"
|
|
},
|
|
{
|
|
"name": "storage.type.primitive.finch",
|
|
"match": "\\b(int|float|bool|char|str|ptr|map|i8|i16|i32|i64|u8|u16|u32|u64|f32|f64|(?:[iuf](?:8|16|32|64)|bool)x(?:2|4|8|16|32|64))\\b"
|
|
},
|
|
{
|
|
"match": "\\b(print|input|read_file|write_file|file_exists|delete_file|shell|exit|addr|new|free|error|min|max|abs|clamp|assert|atomic_add|atomic_sub|atomic_load|atomic_store|atomic_swap|atomic_cas|select|concat|fma|muladd|cpu_has|f32_bits|f32_from_bits|f64_bits|f64_from_bits|f16_to_f32|f32_to_f16|bf16_to_f32|f32_to_bf16)\\s*(?=\\()",
|
|
"captures": {
|
|
"1": {
|
|
"name": "support.function.builtin.finch"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"match": "(?<=\\.)(len|ptr|value)\\b(?!\\s*\\()",
|
|
"captures": {
|
|
"1": {
|
|
"name": "variable.other.property.finch"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"match": "\\b([A-Z][A-Za-z0-9_]*)\\s*(?=\\()",
|
|
"captures": {
|
|
"1": {
|
|
"name": "entity.name.type.finch"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"match": "\\b([a-z_][A-Za-z0-9_]*)\\s*(?=\\()",
|
|
"captures": {
|
|
"1": {
|
|
"name": "entity.name.function.call.finch"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"name": "entity.name.type.finch",
|
|
"match": "\\b[A-Z][A-Za-z0-9_]*\\b"
|
|
},
|
|
{
|
|
"name": "keyword.operator.assignment.finch",
|
|
"match": ":=|\\+=|-=|\\*=|/=|%=|(?<![=!<>])=(?!=)"
|
|
},
|
|
{
|
|
"name": "keyword.operator.comparison.finch",
|
|
"match": "==|!=|<=|>=|<|>"
|
|
},
|
|
{
|
|
"name": "keyword.operator.logical.finch",
|
|
"match": "&&|\\|\\||!"
|
|
},
|
|
{
|
|
"name": "keyword.operator.arrow.finch",
|
|
"match": "->"
|
|
},
|
|
{
|
|
"name": "keyword.operator.range.finch",
|
|
"match": "\\.\\."
|
|
},
|
|
{
|
|
"name": "keyword.operator.arithmetic.finch",
|
|
"match": "<<|>>|[-+*/%&|^~]"
|
|
},
|
|
{
|
|
"name": "variable.other.finch",
|
|
"match": "\\b[a-z_][A-Za-z0-9_]*\\b"
|
|
}
|
|
]
|
|
},
|
|
"strings": {
|
|
"name": "string.quoted.double.finch",
|
|
"begin": "\"",
|
|
"end": "\"|$",
|
|
"patterns": [
|
|
{
|
|
"include": "#interpolation"
|
|
},
|
|
{
|
|
"name": "constant.character.escape.finch",
|
|
"match": "\\\\[ntr0\\\\\"']"
|
|
},
|
|
{
|
|
"name": "invalid.illegal.escape.finch",
|
|
"match": "\\\\."
|
|
}
|
|
]
|
|
},
|
|
"chars": {
|
|
"name": "string.quoted.single.finch",
|
|
"begin": "'",
|
|
"end": "'|$",
|
|
"patterns": [
|
|
{
|
|
"name": "constant.character.escape.finch",
|
|
"match": "\\\\[ntr0\\\\\"']"
|
|
}
|
|
]
|
|
},
|
|
"numbers": {
|
|
"patterns": [
|
|
{
|
|
"name": "constant.numeric.hex.finch",
|
|
"match": "\\b0[xX][0-9A-Fa-f_]+\\b"
|
|
},
|
|
{
|
|
"name": "constant.numeric.float.finch",
|
|
"match": "\\b\\d[\\d_]*(\\.\\d[\\d_]*([eE][+-]?\\d+)?|[eE][+-]?\\d+)\\b"
|
|
},
|
|
{
|
|
"name": "constant.numeric.integer.finch",
|
|
"match": "\\b\\d[\\d_]*\\b"
|
|
}
|
|
]
|
|
},
|
|
"longstrings": {
|
|
"name": "string.quoted.triple.finch",
|
|
"begin": "\"\"\"",
|
|
"end": "\"\"\"",
|
|
"patterns": [
|
|
{
|
|
"include": "#interpolation"
|
|
},
|
|
{
|
|
"name": "constant.character.escape.finch",
|
|
"match": "\\\\[ntr0\\\\\"']"
|
|
}
|
|
]
|
|
},
|
|
"interpolation": {
|
|
"name": "meta.embedded.line.finch",
|
|
"begin": "\\\\\\(",
|
|
"end": "\\)",
|
|
"beginCaptures": {
|
|
"0": {
|
|
"name": "punctuation.section.embedded.begin.finch"
|
|
}
|
|
},
|
|
"endCaptures": {
|
|
"0": {
|
|
"name": "punctuation.section.embedded.end.finch"
|
|
}
|
|
},
|
|
"patterns": [
|
|
{
|
|
"include": "#interpolation-parens"
|
|
},
|
|
{
|
|
"include": "$self"
|
|
}
|
|
]
|
|
},
|
|
"interpolation-parens": {
|
|
"begin": "\\(",
|
|
"end": "\\)",
|
|
"patterns": [
|
|
{
|
|
"include": "#interpolation-parens"
|
|
},
|
|
{
|
|
"include": "$self"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
}
|