tree-sitter-nextflow 0.4.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- tree_sitter_nextflow-0.4.1/LICENSE +21 -0
- tree_sitter_nextflow-0.4.1/PKG-INFO +70 -0
- tree_sitter_nextflow-0.4.1/README.md +51 -0
- tree_sitter_nextflow-0.4.1/bindings/python/tree_sitter_nextflow/__init__.py +37 -0
- tree_sitter_nextflow-0.4.1/bindings/python/tree_sitter_nextflow/__init__.pyi +7 -0
- tree_sitter_nextflow-0.4.1/bindings/python/tree_sitter_nextflow/binding.c +35 -0
- tree_sitter_nextflow-0.4.1/bindings/python/tree_sitter_nextflow/py.typed +0 -0
- tree_sitter_nextflow-0.4.1/bindings/python/tree_sitter_nextflow.egg-info/PKG-INFO +70 -0
- tree_sitter_nextflow-0.4.1/bindings/python/tree_sitter_nextflow.egg-info/SOURCES.txt +17 -0
- tree_sitter_nextflow-0.4.1/bindings/python/tree_sitter_nextflow.egg-info/dependency_links.txt +1 -0
- tree_sitter_nextflow-0.4.1/bindings/python/tree_sitter_nextflow.egg-info/not-zip-safe +1 -0
- tree_sitter_nextflow-0.4.1/bindings/python/tree_sitter_nextflow.egg-info/requires.txt +3 -0
- tree_sitter_nextflow-0.4.1/bindings/python/tree_sitter_nextflow.egg-info/top_level.txt +2 -0
- tree_sitter_nextflow-0.4.1/pyproject.toml +34 -0
- tree_sitter_nextflow-0.4.1/queries/highlights.scm +252 -0
- tree_sitter_nextflow-0.4.1/queries/injections.scm +26 -0
- tree_sitter_nextflow-0.4.1/queries/tags.scm +42 -0
- tree_sitter_nextflow-0.4.1/setup.cfg +4 -0
- tree_sitter_nextflow-0.4.1/setup.py +78 -0
- tree_sitter_nextflow-0.4.1/src/parser.c +122472 -0
- tree_sitter_nextflow-0.4.1/src/scanner.c +277 -0
- tree_sitter_nextflow-0.4.1/src/tree_sitter/alloc.h +54 -0
- tree_sitter_nextflow-0.4.1/src/tree_sitter/array.h +330 -0
- tree_sitter_nextflow-0.4.1/src/tree_sitter/parser.h +286 -0
- tree_sitter_nextflow-0.4.1/test/test_resolve_changelog.py +46 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Edmund Miller
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tree-sitter-nextflow
|
|
3
|
+
Version: 0.4.1
|
|
4
|
+
Summary: Nextflow grammar for tree-sitter
|
|
5
|
+
Author-email: Edmund Miller <edmund@nf-co.re>, Ben Sherman <bentshermann@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/nextflow-io/tree-sitter-nextflow
|
|
8
|
+
Keywords: incremental,parsing,tree-sitter,nextflow
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: Topic :: Software Development :: Compilers
|
|
11
|
+
Classifier: Topic :: Text Processing :: Linguistic
|
|
12
|
+
Classifier: Typing :: Typed
|
|
13
|
+
Requires-Python: >=3.10
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
Provides-Extra: core
|
|
17
|
+
Requires-Dist: tree-sitter~=0.25; extra == "core"
|
|
18
|
+
Dynamic: license-file
|
|
19
|
+
|
|
20
|
+
# tree-sitter-nextflow
|
|
21
|
+
|
|
22
|
+
[](https://github.com/nextflow-io/tree-sitter-nextflow/actions/workflows/parse-rate.yml)
|
|
23
|
+
|
|
24
|
+
Nextflow grammar for [tree-sitter](https://github.com/tree-sitter/tree-sitter). Mirrors the official [Nextflow ANTLR grammar](https://github.com/nextflow-io/nextflow/tree/master/modules/nf-lang/src/main/antlr).
|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
|
|
28
|
+
Install the Python binding and tree-sitter runtime from PyPI after the first release:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
pip install "tree-sitter-nextflow[core]"
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Use the grammar in Python tools:
|
|
35
|
+
|
|
36
|
+
```python
|
|
37
|
+
from tree_sitter import Language, Parser
|
|
38
|
+
import tree_sitter_nextflow
|
|
39
|
+
|
|
40
|
+
parser = Parser(Language(tree_sitter_nextflow.language()))
|
|
41
|
+
tree = parser.parse(b'workflow {\n println "Hello"\n}\n')
|
|
42
|
+
assert not tree.root_node.has_error
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
The parser produces a syntax tree for your lint rules. It does not run Nextflow's semantic checks.
|
|
46
|
+
Python 3.10 or later is required. Releases provide wheels for Linux and macOS on x86-64 and ARM64,
|
|
47
|
+
plus a source distribution for platforms with a C compiler.
|
|
48
|
+
|
|
49
|
+
To build the Python, Rust, or C binding from source:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
git clone https://github.com/nextflow-io/tree-sitter-nextflow.git
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
- **Python:** `pip install .`
|
|
56
|
+
- **Rust:** add a path or git dependency on this repo in `Cargo.toml`.
|
|
57
|
+
- **C:** `make` builds the shared library.
|
|
58
|
+
|
|
59
|
+
See [editor and tool integrations](docs/integrations/README.md) for the query files
|
|
60
|
+
and the requirements for Bash highlighting inside process scripts.
|
|
61
|
+
|
|
62
|
+
## ast-grep
|
|
63
|
+
|
|
64
|
+
The repo includes an [ast-grep](https://ast-grep.github.io/) setup for searching, linting, and outlining Nextflow code by syntax tree:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
ast-grep -l nextflow -p 'Channel.from($$$)' .
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
See [`docs/ast-grep/`](docs/ast-grep/) for setup, the bundled lint rules, and the pattern library.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# tree-sitter-nextflow
|
|
2
|
+
|
|
3
|
+
[](https://github.com/nextflow-io/tree-sitter-nextflow/actions/workflows/parse-rate.yml)
|
|
4
|
+
|
|
5
|
+
Nextflow grammar for [tree-sitter](https://github.com/tree-sitter/tree-sitter). Mirrors the official [Nextflow ANTLR grammar](https://github.com/nextflow-io/nextflow/tree/master/modules/nf-lang/src/main/antlr).
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
Install the Python binding and tree-sitter runtime from PyPI after the first release:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pip install "tree-sitter-nextflow[core]"
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Use the grammar in Python tools:
|
|
16
|
+
|
|
17
|
+
```python
|
|
18
|
+
from tree_sitter import Language, Parser
|
|
19
|
+
import tree_sitter_nextflow
|
|
20
|
+
|
|
21
|
+
parser = Parser(Language(tree_sitter_nextflow.language()))
|
|
22
|
+
tree = parser.parse(b'workflow {\n println "Hello"\n}\n')
|
|
23
|
+
assert not tree.root_node.has_error
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
The parser produces a syntax tree for your lint rules. It does not run Nextflow's semantic checks.
|
|
27
|
+
Python 3.10 or later is required. Releases provide wheels for Linux and macOS on x86-64 and ARM64,
|
|
28
|
+
plus a source distribution for platforms with a C compiler.
|
|
29
|
+
|
|
30
|
+
To build the Python, Rust, or C binding from source:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
git clone https://github.com/nextflow-io/tree-sitter-nextflow.git
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
- **Python:** `pip install .`
|
|
37
|
+
- **Rust:** add a path or git dependency on this repo in `Cargo.toml`.
|
|
38
|
+
- **C:** `make` builds the shared library.
|
|
39
|
+
|
|
40
|
+
See [editor and tool integrations](docs/integrations/README.md) for the query files
|
|
41
|
+
and the requirements for Bash highlighting inside process scripts.
|
|
42
|
+
|
|
43
|
+
## ast-grep
|
|
44
|
+
|
|
45
|
+
The repo includes an [ast-grep](https://ast-grep.github.io/) setup for searching, linting, and outlining Nextflow code by syntax tree:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
ast-grep -l nextflow -p 'Channel.from($$$)' .
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
See [`docs/ast-grep/`](docs/ast-grep/) for setup, the bundled lint rules, and the pattern library.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"""Nextflow grammar for tree-sitter"""
|
|
2
|
+
|
|
3
|
+
from importlib.resources import files as _files
|
|
4
|
+
|
|
5
|
+
from ._binding import language
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def _get_query(name, file):
|
|
9
|
+
query = _files(f"{__package__}.queries") / file
|
|
10
|
+
globals()[name] = query.read_text()
|
|
11
|
+
return globals()[name]
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def __getattr__(name):
|
|
15
|
+
if name == "HIGHLIGHTS_QUERY":
|
|
16
|
+
return _get_query("HIGHLIGHTS_QUERY", "highlights.scm")
|
|
17
|
+
if name == "INJECTIONS_QUERY":
|
|
18
|
+
return _get_query("INJECTIONS_QUERY", "injections.scm")
|
|
19
|
+
if name == "TAGS_QUERY":
|
|
20
|
+
return _get_query("TAGS_QUERY", "tags.scm")
|
|
21
|
+
|
|
22
|
+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
__all__ = [
|
|
26
|
+
"language",
|
|
27
|
+
"HIGHLIGHTS_QUERY",
|
|
28
|
+
"INJECTIONS_QUERY",
|
|
29
|
+
"TAGS_QUERY",
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def __dir__():
|
|
34
|
+
return sorted(__all__ + [
|
|
35
|
+
"__all__", "__builtins__", "__cached__", "__doc__", "__file__",
|
|
36
|
+
"__loader__", "__name__", "__package__", "__path__", "__spec__",
|
|
37
|
+
])
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
#include <Python.h>
|
|
2
|
+
|
|
3
|
+
typedef struct TSLanguage TSLanguage;
|
|
4
|
+
|
|
5
|
+
TSLanguage *tree_sitter_nextflow(void);
|
|
6
|
+
|
|
7
|
+
static PyObject* _binding_language(PyObject *Py_UNUSED(self), PyObject *Py_UNUSED(args)) {
|
|
8
|
+
return PyCapsule_New(tree_sitter_nextflow(), "tree_sitter.Language", NULL);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
static struct PyModuleDef_Slot slots[] = {
|
|
12
|
+
#ifdef Py_GIL_DISABLED
|
|
13
|
+
{Py_mod_gil, Py_MOD_GIL_NOT_USED},
|
|
14
|
+
#endif
|
|
15
|
+
{0, NULL}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
static PyMethodDef methods[] = {
|
|
19
|
+
{"language", _binding_language, METH_NOARGS,
|
|
20
|
+
"Get the tree-sitter language for this grammar."},
|
|
21
|
+
{NULL, NULL, 0, NULL}
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
static struct PyModuleDef module = {
|
|
25
|
+
.m_base = PyModuleDef_HEAD_INIT,
|
|
26
|
+
.m_name = "_binding",
|
|
27
|
+
.m_doc = NULL,
|
|
28
|
+
.m_size = 0,
|
|
29
|
+
.m_methods = methods,
|
|
30
|
+
.m_slots = slots,
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
PyMODINIT_FUNC PyInit__binding(void) {
|
|
34
|
+
return PyModuleDef_Init(&module);
|
|
35
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tree-sitter-nextflow
|
|
3
|
+
Version: 0.4.1
|
|
4
|
+
Summary: Nextflow grammar for tree-sitter
|
|
5
|
+
Author-email: Edmund Miller <edmund@nf-co.re>, Ben Sherman <bentshermann@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/nextflow-io/tree-sitter-nextflow
|
|
8
|
+
Keywords: incremental,parsing,tree-sitter,nextflow
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: Topic :: Software Development :: Compilers
|
|
11
|
+
Classifier: Topic :: Text Processing :: Linguistic
|
|
12
|
+
Classifier: Typing :: Typed
|
|
13
|
+
Requires-Python: >=3.10
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
Provides-Extra: core
|
|
17
|
+
Requires-Dist: tree-sitter~=0.25; extra == "core"
|
|
18
|
+
Dynamic: license-file
|
|
19
|
+
|
|
20
|
+
# tree-sitter-nextflow
|
|
21
|
+
|
|
22
|
+
[](https://github.com/nextflow-io/tree-sitter-nextflow/actions/workflows/parse-rate.yml)
|
|
23
|
+
|
|
24
|
+
Nextflow grammar for [tree-sitter](https://github.com/tree-sitter/tree-sitter). Mirrors the official [Nextflow ANTLR grammar](https://github.com/nextflow-io/nextflow/tree/master/modules/nf-lang/src/main/antlr).
|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
|
|
28
|
+
Install the Python binding and tree-sitter runtime from PyPI after the first release:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
pip install "tree-sitter-nextflow[core]"
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Use the grammar in Python tools:
|
|
35
|
+
|
|
36
|
+
```python
|
|
37
|
+
from tree_sitter import Language, Parser
|
|
38
|
+
import tree_sitter_nextflow
|
|
39
|
+
|
|
40
|
+
parser = Parser(Language(tree_sitter_nextflow.language()))
|
|
41
|
+
tree = parser.parse(b'workflow {\n println "Hello"\n}\n')
|
|
42
|
+
assert not tree.root_node.has_error
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
The parser produces a syntax tree for your lint rules. It does not run Nextflow's semantic checks.
|
|
46
|
+
Python 3.10 or later is required. Releases provide wheels for Linux and macOS on x86-64 and ARM64,
|
|
47
|
+
plus a source distribution for platforms with a C compiler.
|
|
48
|
+
|
|
49
|
+
To build the Python, Rust, or C binding from source:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
git clone https://github.com/nextflow-io/tree-sitter-nextflow.git
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
- **Python:** `pip install .`
|
|
56
|
+
- **Rust:** add a path or git dependency on this repo in `Cargo.toml`.
|
|
57
|
+
- **C:** `make` builds the shared library.
|
|
58
|
+
|
|
59
|
+
See [editor and tool integrations](docs/integrations/README.md) for the query files
|
|
60
|
+
and the requirements for Bash highlighting inside process scripts.
|
|
61
|
+
|
|
62
|
+
## ast-grep
|
|
63
|
+
|
|
64
|
+
The repo includes an [ast-grep](https://ast-grep.github.io/) setup for searching, linting, and outlining Nextflow code by syntax tree:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
ast-grep -l nextflow -p 'Channel.from($$$)' .
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
See [`docs/ast-grep/`](docs/ast-grep/) for setup, the bundled lint rules, and the pattern library.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
setup.py
|
|
5
|
+
bindings/python/tree_sitter_nextflow/__init__.py
|
|
6
|
+
bindings/python/tree_sitter_nextflow/__init__.pyi
|
|
7
|
+
bindings/python/tree_sitter_nextflow/binding.c
|
|
8
|
+
bindings/python/tree_sitter_nextflow/py.typed
|
|
9
|
+
bindings/python/tree_sitter_nextflow.egg-info/PKG-INFO
|
|
10
|
+
bindings/python/tree_sitter_nextflow.egg-info/SOURCES.txt
|
|
11
|
+
bindings/python/tree_sitter_nextflow.egg-info/dependency_links.txt
|
|
12
|
+
bindings/python/tree_sitter_nextflow.egg-info/not-zip-safe
|
|
13
|
+
bindings/python/tree_sitter_nextflow.egg-info/requires.txt
|
|
14
|
+
bindings/python/tree_sitter_nextflow.egg-info/top_level.txt
|
|
15
|
+
src/parser.c
|
|
16
|
+
src/scanner.c
|
|
17
|
+
test/test_resolve_changelog.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=62.4.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "tree-sitter-nextflow"
|
|
7
|
+
description = "Nextflow grammar for tree-sitter"
|
|
8
|
+
version = "0.4.1"
|
|
9
|
+
keywords = ["incremental", "parsing", "tree-sitter", "nextflow"]
|
|
10
|
+
classifiers = [
|
|
11
|
+
"Intended Audience :: Developers",
|
|
12
|
+
"Topic :: Software Development :: Compilers",
|
|
13
|
+
"Topic :: Text Processing :: Linguistic",
|
|
14
|
+
"Typing :: Typed",
|
|
15
|
+
]
|
|
16
|
+
authors = [
|
|
17
|
+
{ name = "Edmund Miller", email = "edmund@nf-co.re" },
|
|
18
|
+
{ name = "Ben Sherman", email = "bentshermann@gmail.com" },
|
|
19
|
+
]
|
|
20
|
+
requires-python = ">=3.10"
|
|
21
|
+
license.text = "MIT"
|
|
22
|
+
readme = "README.md"
|
|
23
|
+
|
|
24
|
+
[project.urls]
|
|
25
|
+
Homepage = "https://github.com/nextflow-io/tree-sitter-nextflow"
|
|
26
|
+
|
|
27
|
+
[project.optional-dependencies]
|
|
28
|
+
core = ["tree-sitter~=0.25"]
|
|
29
|
+
|
|
30
|
+
[tool.cibuildwheel]
|
|
31
|
+
build = "cp310-*"
|
|
32
|
+
build-frontend = "build"
|
|
33
|
+
test-requires = ["tree-sitter~=0.25"]
|
|
34
|
+
test-command = "python -m unittest discover -s {project}/bindings/python/tests -v"
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
;; Syntax highlighting for Nextflow.
|
|
2
|
+
;; The tree-sitter CLI gives later patterns precedence, so general captures
|
|
3
|
+
;; come first and specific ones override them.
|
|
4
|
+
|
|
5
|
+
(identifier) @variable
|
|
6
|
+
|
|
7
|
+
((identifier) @variable.builtin
|
|
8
|
+
(#any-of? @variable.builtin
|
|
9
|
+
"params" "task" "workflow" "nextflow" "log" "launchDir" "moduleDir"
|
|
10
|
+
"projectDir" "workDir" "baseDir" "secrets"))
|
|
11
|
+
|
|
12
|
+
((identifier) @type.builtin
|
|
13
|
+
(#any-of? @type.builtin "Channel" "channel"))
|
|
14
|
+
|
|
15
|
+
;; ========================================
|
|
16
|
+
;; KEYWORDS
|
|
17
|
+
;; ========================================
|
|
18
|
+
|
|
19
|
+
[
|
|
20
|
+
"process"
|
|
21
|
+
"workflow"
|
|
22
|
+
"agent"
|
|
23
|
+
"include"
|
|
24
|
+
"from"
|
|
25
|
+
"import"
|
|
26
|
+
"nextflow"
|
|
27
|
+
"params"
|
|
28
|
+
"record"
|
|
29
|
+
"enum"
|
|
30
|
+
"tuple"
|
|
31
|
+
"def"
|
|
32
|
+
"as"
|
|
33
|
+
"new"
|
|
34
|
+
] @keyword
|
|
35
|
+
|
|
36
|
+
[
|
|
37
|
+
"if"
|
|
38
|
+
"else"
|
|
39
|
+
"for"
|
|
40
|
+
"try"
|
|
41
|
+
"catch"
|
|
42
|
+
"finally"
|
|
43
|
+
"return"
|
|
44
|
+
"throw"
|
|
45
|
+
"assert"
|
|
46
|
+
] @keyword.control
|
|
47
|
+
|
|
48
|
+
[
|
|
49
|
+
"in"
|
|
50
|
+
"!in"
|
|
51
|
+
"instanceof"
|
|
52
|
+
"!instanceof"
|
|
53
|
+
] @keyword.operator
|
|
54
|
+
|
|
55
|
+
;; Section labels
|
|
56
|
+
[
|
|
57
|
+
"input"
|
|
58
|
+
"output"
|
|
59
|
+
"stage"
|
|
60
|
+
"topic"
|
|
61
|
+
"when"
|
|
62
|
+
"script"
|
|
63
|
+
"shell"
|
|
64
|
+
"exec"
|
|
65
|
+
"stub"
|
|
66
|
+
"prompt"
|
|
67
|
+
"take"
|
|
68
|
+
"main"
|
|
69
|
+
"emit"
|
|
70
|
+
"publish"
|
|
71
|
+
"onComplete"
|
|
72
|
+
"onError"
|
|
73
|
+
] @label
|
|
74
|
+
|
|
75
|
+
(output_definition "output" @keyword)
|
|
76
|
+
|
|
77
|
+
(labeled_statement label: (identifier) @label)
|
|
78
|
+
|
|
79
|
+
;; ========================================
|
|
80
|
+
;; DEFINITIONS
|
|
81
|
+
;; ========================================
|
|
82
|
+
|
|
83
|
+
(process_definition name: (identifier) @function)
|
|
84
|
+
(workflow_definition name: (identifier) @function)
|
|
85
|
+
(agent_definition name: (identifier) @function)
|
|
86
|
+
(function_definition name: (identifier) @function)
|
|
87
|
+
(include_item name: (identifier) @function)
|
|
88
|
+
(include_item alias: (identifier) @function)
|
|
89
|
+
|
|
90
|
+
(parameter name: (identifier) @variable.parameter)
|
|
91
|
+
(workflow_take name: (identifier) @variable.parameter)
|
|
92
|
+
(process_input name: (identifier) @variable.parameter)
|
|
93
|
+
|
|
94
|
+
(param_declaration name: (identifier) @property)
|
|
95
|
+
(param_assignment (identifier) @property)
|
|
96
|
+
(feature_flag (identifier) @property)
|
|
97
|
+
(record_field name: (identifier) @property)
|
|
98
|
+
(workflow_emit name: (identifier) @property)
|
|
99
|
+
(workflow_publish name: (identifier) @property)
|
|
100
|
+
(process_output name: (identifier) @property)
|
|
101
|
+
(output_declaration name: (identifier) @property)
|
|
102
|
+
|
|
103
|
+
(record_definition name: (identifier) @type)
|
|
104
|
+
(enum_definition name: (identifier) @type)
|
|
105
|
+
(enum_constant) @constant
|
|
106
|
+
(type (identifier) @type)
|
|
107
|
+
|
|
108
|
+
;; ========================================
|
|
109
|
+
;; CALLS AND PROPERTIES
|
|
110
|
+
;; ========================================
|
|
111
|
+
|
|
112
|
+
(member_expression property: (identifier) @property)
|
|
113
|
+
(named_argument name: (identifier) @property)
|
|
114
|
+
|
|
115
|
+
(call_expression function: (identifier) @function.call)
|
|
116
|
+
(call_expression function: (member_expression property: (identifier) @function.method))
|
|
117
|
+
(command_expression function: (identifier) @function.call)
|
|
118
|
+
(command_expression function: (member_expression property: (identifier) @function.method))
|
|
119
|
+
|
|
120
|
+
;; Process directives: tag "x", cpus 4, memory { 2.GB * task.attempt }
|
|
121
|
+
(process_definition
|
|
122
|
+
(expression_statement
|
|
123
|
+
[
|
|
124
|
+
(command_expression function: (identifier) @keyword.directive)
|
|
125
|
+
(call_expression function: (identifier) @keyword.directive)
|
|
126
|
+
]))
|
|
127
|
+
|
|
128
|
+
;; Agent directives: model 'openai/gpt-5-mini', tools 'fs:*', tools()
|
|
129
|
+
(agent_definition
|
|
130
|
+
(expression_statement
|
|
131
|
+
[
|
|
132
|
+
(command_expression function: (identifier) @keyword.directive)
|
|
133
|
+
(call_expression function: (identifier) @keyword.directive)
|
|
134
|
+
]))
|
|
135
|
+
|
|
136
|
+
;; Legacy input/output qualifiers: val x, path "*.bam", tuple val(meta), path(x)
|
|
137
|
+
(input_section
|
|
138
|
+
(expression_statement
|
|
139
|
+
(command_expression function: (identifier) @type.builtin)))
|
|
140
|
+
(output_section
|
|
141
|
+
(expression_statement
|
|
142
|
+
(command_expression function: (identifier) @type.builtin)))
|
|
143
|
+
(input_section
|
|
144
|
+
(expression_statement
|
|
145
|
+
(command_expression
|
|
146
|
+
arguments: (argument_list (call_expression function: (identifier) @type.builtin)))))
|
|
147
|
+
(output_section
|
|
148
|
+
(expression_statement
|
|
149
|
+
(command_expression
|
|
150
|
+
arguments: (argument_list (call_expression function: (identifier) @type.builtin)))))
|
|
151
|
+
((output_section (process_output name: (identifier) @type.builtin))
|
|
152
|
+
(#any-of? @type.builtin "stdout" "stdin"))
|
|
153
|
+
|
|
154
|
+
;; ========================================
|
|
155
|
+
;; OPERATORS AND PUNCTUATION
|
|
156
|
+
;; ========================================
|
|
157
|
+
|
|
158
|
+
[
|
|
159
|
+
"="
|
|
160
|
+
"+="
|
|
161
|
+
"-="
|
|
162
|
+
"*="
|
|
163
|
+
"/="
|
|
164
|
+
"%="
|
|
165
|
+
"**="
|
|
166
|
+
"<<="
|
|
167
|
+
">>="
|
|
168
|
+
">>>="
|
|
169
|
+
"&="
|
|
170
|
+
"|="
|
|
171
|
+
"^="
|
|
172
|
+
"?="
|
|
173
|
+
] @operator.assignment
|
|
174
|
+
|
|
175
|
+
[
|
|
176
|
+
"=="
|
|
177
|
+
"!="
|
|
178
|
+
"<"
|
|
179
|
+
">"
|
|
180
|
+
"<="
|
|
181
|
+
">="
|
|
182
|
+
"&&"
|
|
183
|
+
"||"
|
|
184
|
+
"=~"
|
|
185
|
+
"==~"
|
|
186
|
+
"<=>"
|
|
187
|
+
"?:"
|
|
188
|
+
"?"
|
|
189
|
+
"!"
|
|
190
|
+
"+"
|
|
191
|
+
"-"
|
|
192
|
+
"*"
|
|
193
|
+
"/"
|
|
194
|
+
"%"
|
|
195
|
+
"**"
|
|
196
|
+
".."
|
|
197
|
+
"..<"
|
|
198
|
+
"<<"
|
|
199
|
+
">>"
|
|
200
|
+
">>>"
|
|
201
|
+
"&"
|
|
202
|
+
"^"
|
|
203
|
+
"~"
|
|
204
|
+
"?."
|
|
205
|
+
"*."
|
|
206
|
+
] @operator
|
|
207
|
+
|
|
208
|
+
;; Channel pipes and closure arrows
|
|
209
|
+
[
|
|
210
|
+
"|"
|
|
211
|
+
"->"
|
|
212
|
+
] @operator.channel
|
|
213
|
+
|
|
214
|
+
[
|
|
215
|
+
"("
|
|
216
|
+
")"
|
|
217
|
+
"["
|
|
218
|
+
"]"
|
|
219
|
+
"{"
|
|
220
|
+
"}"
|
|
221
|
+
] @punctuation.bracket
|
|
222
|
+
|
|
223
|
+
[
|
|
224
|
+
","
|
|
225
|
+
":"
|
|
226
|
+
"."
|
|
227
|
+
] @punctuation.delimiter
|
|
228
|
+
|
|
229
|
+
;; ========================================
|
|
230
|
+
;; LITERALS
|
|
231
|
+
;; ========================================
|
|
232
|
+
|
|
233
|
+
(string) @string
|
|
234
|
+
(string_content) @string
|
|
235
|
+
(escape_sequence) @string.escape
|
|
236
|
+
(interpolation) @embedded
|
|
237
|
+
(slashy_string) @string.regex
|
|
238
|
+
|
|
239
|
+
(integer_literal) @number
|
|
240
|
+
(float_literal) @number.float
|
|
241
|
+
(boolean_literal) @constant.builtin
|
|
242
|
+
(null_literal) @constant.builtin
|
|
243
|
+
|
|
244
|
+
;; ========================================
|
|
245
|
+
;; COMMENTS
|
|
246
|
+
;; ========================================
|
|
247
|
+
|
|
248
|
+
(line_comment) @comment
|
|
249
|
+
(block_comment) @comment
|
|
250
|
+
(shebang) @comment
|
|
251
|
+
|
|
252
|
+
(ERROR) @error
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
;; Bash injection into process script/shell/stub bodies: the string that ends
|
|
2
|
+
;; the section. Only the content chunks are captured, so quote delimiters and
|
|
3
|
+
;; ${...} interpolations stay Nextflow. injection.combined merges the chunks
|
|
4
|
+
;; around interpolations into one bash document.
|
|
5
|
+
;;
|
|
6
|
+
;; exec: bodies are Groovy, so they are left alone.
|
|
7
|
+
|
|
8
|
+
(script_section
|
|
9
|
+
["script" "shell"]
|
|
10
|
+
(expression_statement
|
|
11
|
+
(string (string_content) @injection.content)) .
|
|
12
|
+
(#set! injection.language "bash")
|
|
13
|
+
(#set! injection.combined))
|
|
14
|
+
|
|
15
|
+
(stub_section
|
|
16
|
+
(expression_statement
|
|
17
|
+
(string (string_content) @injection.content)) .
|
|
18
|
+
(#set! injection.language "bash")
|
|
19
|
+
(#set! injection.combined))
|
|
20
|
+
|
|
21
|
+
;; A process with no section labels: the body is an implicit script.
|
|
22
|
+
(process_definition
|
|
23
|
+
(expression_statement
|
|
24
|
+
(string (string_content) @injection.content)) .
|
|
25
|
+
(#set! injection.language "bash")
|
|
26
|
+
(#set! injection.combined))
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
;; Code navigation for Nextflow: definitions and references.
|
|
2
|
+
|
|
3
|
+
;; ========================================
|
|
4
|
+
;; DEFINITIONS
|
|
5
|
+
;; ========================================
|
|
6
|
+
|
|
7
|
+
(process_definition name: (identifier) @name) @definition.method
|
|
8
|
+
|
|
9
|
+
(workflow_definition name: (identifier) @name) @definition.function
|
|
10
|
+
|
|
11
|
+
(agent_definition name: (identifier) @name) @definition.function
|
|
12
|
+
|
|
13
|
+
(function_definition name: (identifier) @name) @definition.function
|
|
14
|
+
|
|
15
|
+
(record_definition name: (identifier) @name) @definition.class
|
|
16
|
+
|
|
17
|
+
(enum_definition name: (identifier) @name) @definition.class
|
|
18
|
+
|
|
19
|
+
(param_declaration name: (identifier) @name) @definition.variable
|
|
20
|
+
|
|
21
|
+
(param_assignment . (identifier) @name) @definition.variable
|
|
22
|
+
|
|
23
|
+
;; ========================================
|
|
24
|
+
;; REFERENCES
|
|
25
|
+
;; ========================================
|
|
26
|
+
|
|
27
|
+
(call_expression function: (identifier) @name) @reference.call
|
|
28
|
+
|
|
29
|
+
(call_expression
|
|
30
|
+
function: (member_expression property: (identifier) @name)) @reference.call
|
|
31
|
+
|
|
32
|
+
(command_expression function: (identifier) @name) @reference.call
|
|
33
|
+
|
|
34
|
+
(command_expression
|
|
35
|
+
function: (member_expression property: (identifier) @name)) @reference.call
|
|
36
|
+
|
|
37
|
+
;; Process/workflow outputs: FOO.out, FOO.out.bam. Tags queries cannot use
|
|
38
|
+
;; helper captures, so this relies on the upper-case naming convention.
|
|
39
|
+
((member_expression object: (identifier) @name) @reference.call
|
|
40
|
+
(#match? @name "^[A-Z][A-Z0-9_]*$"))
|
|
41
|
+
|
|
42
|
+
(include_declaration source: (string) @name) @reference.implementation
|