1+ ;; Nextflow treesitter highlight queries
2+ ;; Based on the nextflow-io/tree-sitter-nextflow grammar
3+
4+ ;; Keywords
5+ [
6+ "process"
7+ "workflow"
8+ "function"
9+ "include"
10+ "from"
11+ "params"
12+ "nextflow"
13+ "manifest"
14+ "docker"
15+ "singularity"
16+ "conda"
17+ "env"
18+ "executor"
19+ "queue"
20+ "memory"
21+ "cpus"
22+ "time"
23+ "disk"
24+ "attempt"
25+ "tag"
26+ "publishDir"
27+ "cache"
28+ "container"
29+ "module"
30+ "conda"
31+ "spack"
32+ "beforeScript"
33+ "afterScript"
34+ "shell"
35+ "script"
36+ "exec"
37+ "stub"
38+ "when"
39+ "input"
40+ "output"
41+ "take"
42+ "emit"
43+ "main"
44+ ] @keyword
45+
46+ ;; Operators
47+ [
48+ "="
49+ "+="
50+ "-="
51+ "*="
52+ "/="
53+ "%="
54+ "=="
55+ "!="
56+ "<"
57+ "<="
58+ ">"
59+ ">="
60+ "&&"
61+ "||"
62+ "!"
63+ "+"
64+ "-"
65+ "*"
66+ "/"
67+ "%"
68+ "~"
69+ "=~"
70+ "!~"
71+ "<<"
72+ ">>"
73+ "&"
74+ "|"
75+ "^"
76+ "?"
77+ ":"
78+ "?:"
79+ "?."
80+ "*."
81+ ".&"
82+ ".@"
83+ "*.@"
84+ "++"
85+ "--"
86+ "**"
87+ "<=>"
88+ "in"
89+ "as"
90+ "instanceof"
91+ ] @operator
92+
93+ ;; Punctuation
94+ [
95+ "("
96+ ")"
97+ "["
98+ "]"
99+ "{"
100+ "}"
101+ ";"
102+ ","
103+ "."
104+ "->"
105+ "=>"
106+ ] @punctuation.delimiter
107+
108+ ;; Literals
109+ (boolean_literal) @boolean
110+ (null_literal) @constant.builtin
111+ (number_literal) @number
112+ (string_literal) @string
113+ (gstring_literal) @string
114+ (multiline_string_literal) @string
115+
116+ ;; Regular expressions
117+ (regex_literal) @string.regex
118+
119+ ;; Comments
120+ (line_comment) @comment
121+ (block_comment) @comment
122+
123+ ;; Identifiers
124+ (identifier) @variable
125+
126+ ;; Function calls
127+ (method_call
128+ object: (identifier) @variable
129+ method: (identifier) @function.method )
130+
131+ (function_call
132+ function: (identifier) @function.call )
133+
134+ ;; Type annotations
135+ (type_annotation
136+ type: (identifier) @type )
137+
138+ ;; Channel operations
139+ (method_call
140+ object: (identifier) @variable (#match? @variable "^Channel$")
141+ method: (identifier) @function.builtin )
142+
143+ ;; Process directives
144+ (assignment
145+ left: (identifier) @keyword.directive
146+ (#match? @keyword.directive "^(cpus|memory|time|disk|queue|container|publishDir|tag|cache|executor|conda|module|beforeScript|afterScript|shell|script|exec|stub|when|input|output)$"))
147+
148+ ;; Variable definitions
149+ (assignment
150+ left: (identifier) @variable.definition )
151+
152+ ;; Parameters
153+ (params_declaration
154+ (identifier) @parameter )
155+
156+ ;; Include statements
157+ (include_statement
158+ module: (string_literal) @string.special )
159+
160+ ;; Process names
161+ (process_declaration
162+ name: (identifier) @function.definition )
163+
164+ ;; Workflow names
165+ (workflow_declaration
166+ name: (identifier) @function.definition )
167+
168+ ;; Function names
169+ (function_declaration
170+ name: (identifier) @function.definition )
171+
172+ ;; Groovy-style closures
173+ (closure) @function.definition
174+
175+ ;; Error handling
176+ (try_statement) @keyword
177+ (catch_clause) @keyword
178+ (finally_clause) @keyword
179+ (throw_statement) @keyword
180+
181+ ;; Control flow
182+ [
183+ "if"
184+ "else"
185+ "while"
186+ "for"
187+ "do"
188+ "switch"
189+ "case"
190+ "default"
191+ "break"
192+ "continue"
193+ "return"
194+ "try"
195+ "catch"
196+ "finally"
197+ "throw"
198+ ] @keyword.control
199+
200+ ;; Built-in types
201+ [
202+ "int"
203+ "long"
204+ "float"
205+ "double"
206+ "boolean"
207+ "char"
208+ "byte"
209+ "short"
210+ "String"
211+ "def"
212+ "var"
213+ "void"
214+ ] @type.builtin
215+
216+ ;; Access modifiers
217+ [
218+ "public"
219+ "private"
220+ "protected"
221+ "static"
222+ "final"
223+ "abstract"
224+ "synchronized"
225+ "volatile"
226+ "transient"
227+ "native"
228+ "strictfp"
229+ ] @keyword.modifier
230+
231+ ;; Annotations
232+ (annotation
233+ name: (identifier) @attribute )
234+
235+ ;; Class and interface definitions
236+ (class_declaration
237+ name: (identifier) @type.definition )
238+ (interface_declaration
239+ name: (identifier) @type.definition )
240+
241+ ;; Import statements
242+ (import_statement) @keyword.import
243+
244+ ;; Package declarations
245+ (package_declaration) @keyword.import
246+
247+ ;; Special Nextflow variables
248+ ((identifier) @constant.builtin
249+ (#match? @constant.builtin "^(params|workflow|nextflow|launchDir|workDir|projectDir|baseDir)$"))
250+
251+ ;; File paths and globs
252+ (string_literal) @string.special
253+ (#match? @string.special "\\*\\*?|\\?|\\[.*\\]")
254+
255+ ;; Environment variables
256+ (gstring_literal
257+ (gstring_expression
258+ (identifier) @variable.builtin
259+ (#match? @variable.builtin "^[A-Z_][A-Z0-9_]*$")))
260+
261+ ;; Special method calls
262+ (method_call
263+ method: (identifier) @function.builtin
264+ (#match? @function.builtin "^(collect|map|filter|flatten|unique|groupTuple|combine|join|mix|merge|splitText|splitCsv|splitFasta|view|subscribe|into|set)$"))
265+
266+ ;; Error highlighting for common mistakes
267+ (ERROR) @error
0 commit comments