Files
clide/app/assets/queries/r.scm
T
jpmschweitzerandClaude ce8529e424 add tree-sitter syntax highlighting via dart:ffi
Vendor libtree-sitter.so (v0.26.8, wasmtime 44.0 statically linked)
and call its C API through dart:ffi. Grammar WASM files are loaded by
tree-sitter's embedded wasmtime engine via ts_wasm_store_load_language.

48 grammars compiled with tree-sitter build --wasm, 48 highlight
queries (42 from upstream repos, 6 written in-house for comment,
erlang, gdscript, gitignore, hcl, hlsl, swift). SQLite grammar
replaces full SQL (974K-line parser exhausted RAM at compile time).

Removes wasm_run and wasm_run_flutter — they downloaded a 22 MB
binary from GitHub at first launch, violating the no-network-on-
default-launch-path policy.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-04-22 22:08:00 +02:00

113 lines
1.4 KiB
Scheme

; highlights.scm
; Literals
(integer) @number
(float) @number
(complex) @number
(string) @string
(string (string_content (escape_sequence) @string.escape))
; Comments
(comment) @comment
; Operators
[
"?" ":=" "=" "<-" "<<-" "->" "->>"
"~" "|>" "||" "|" "&&" "&"
"<" "<=" ">" ">=" "==" "!="
"+" "-" "*" "/" "::" ":::"
"**" "^" "$" "@" ":" "!"
"special"
] @operator
; Punctuation
[
"(" ")"
"{" "}"
"[" "]"
"[[" "]]"
] @punctuation.bracket
(comma) @punctuation.delimiter
; Variables
(identifier) @variable
; Functions
(binary_operator
lhs: (identifier) @function
operator: "<-"
rhs: (function_definition)
)
(binary_operator
lhs: (identifier) @function
operator: "="
rhs: (function_definition)
)
; Calls
(call function: (identifier) @function)
; Parameters
(parameters (parameter name: (identifier) @variable.parameter))
(arguments (argument name: (identifier) @variable.parameter))
; Namespace
(namespace_operator lhs: (identifier) @namespace)
(call
function: (namespace_operator rhs: (identifier) @function)
)
; Keywords
(function_definition name: "function" @keyword.function)
(function_definition name: "\\" @operator)
[
"in"
(return)
(next)
(break)
] @keyword
[
"if"
"else"
] @conditional
[
"while"
"repeat"
"for"
] @repeat
[
(true)
(false)
] @boolean
[
(null)
(inf)
(nan)
(na)
(dots)
(dot_dot_i)
] @constant.builtin
; Error
(ERROR) @error