-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding snakemake to language (#11858)
* feat: snakemake language * feat: snakemake syntax highlighting * doc: xtask docgen - snakemake * Addressed feedback: removed redundant grammar * fixed indentation * removed has-ancestor predicate --------- Co-authored-by: “SebastianDall” <“[email protected]”>
- Loading branch information
1 parent
855a43a
commit a145335
Showing
8 changed files
with
152 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Copyright (c) 2016 Max Brunsfeld | ||
Copyright (c) 2023 Oliver Thomas | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
this software and associated documentation files (the "Software"), to deal in | ||
the Software without restriction, including without limitation the rights to | ||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies | ||
of the Software, and to permit persons to whom the Software is furnished to do | ||
so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
; inherits: python | ||
|
||
[ | ||
(rule_definition) | ||
(rule_inheritance) | ||
(module_definition) | ||
(checkpoint_definition) | ||
] @fold |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
; inherits: python | ||
|
||
; Compound directives | ||
[ | ||
"rule" | ||
"checkpoint" | ||
"module" | ||
] @keyword | ||
|
||
; Top level directives (eg. configfile, include) | ||
(module | ||
(directive | ||
name: _ @keyword)) | ||
|
||
; Subordinate directives (eg. input, output) | ||
((_) | ||
body: (_ | ||
(directive | ||
name: _ @label))) | ||
|
||
; rule/module/checkpoint names | ||
(rule_definition | ||
name: (identifier) @type) | ||
|
||
(module_definition | ||
name: (identifier) @type) | ||
|
||
(checkpoint_definition | ||
name: (identifier) @type) | ||
|
||
; Rule imports | ||
(rule_import | ||
"use" @keyword.import | ||
"rule" @keyword.import | ||
"from" @keyword.import | ||
"exclude"? @keyword.import | ||
"as"? @keyword.import | ||
"with"? @keyword.import) | ||
|
||
; Rule inheritance | ||
(rule_inheritance | ||
"use" @keyword | ||
"rule" @keyword | ||
"with" @keyword) | ||
|
||
; Wildcard names | ||
(wildcard (identifier) @variable) | ||
(wildcard (flag) @variable.parameter.builtin) | ||
|
||
; builtin variables | ||
((identifier) @variable.builtin | ||
(#any-of? @variable.builtin "checkpoints" "config" "gather" "rules" "scatter" "workflow")) | ||
|
||
; References to directive labels in wildcard interpolations | ||
; the #any-of? queries are moved above the #has-ancestor? queries to | ||
; short-circuit the potentially expensive tree traversal, if possible | ||
; see: | ||
; https://github.com/nvim-treesitter/nvim-treesitter/pull/4302#issuecomment-1685789790 | ||
; directive labels in wildcard context | ||
((wildcard | ||
(identifier) @label) | ||
(#any-of? @label "input" "log" "output" "params" "resources" "threads" "wildcards")) | ||
|
||
((wildcard | ||
(attribute | ||
object: (identifier) @label)) | ||
(#any-of? @label "input" "log" "output" "params" "resources" "threads" "wildcards")) | ||
|
||
((wildcard | ||
(subscript | ||
value: (identifier) @label)) | ||
(#any-of? @label "input" "log" "output" "params" "resources" "threads" "wildcards")) | ||
|
||
; directive labels in block context (eg. within 'run:') | ||
((identifier) @label | ||
(#any-of? @label "input" "log" "output" "params" "resources" "threads" "wildcards")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
; inherits: python | ||
|
||
|
||
[ | ||
(rule_definition) | ||
(checkpoint_definition) | ||
(rule_inheritance) | ||
(module_definition) | ||
] @indent | ||
|
||
[ | ||
(rule_definition) | ||
(checkpoint_definition) | ||
(rule_inheritance) | ||
(module_definition) | ||
] @extend | ||
|
||
|
||
(directive) @indent | ||
(directive) @extend | ||
|
||
(rule_import | ||
"with" | ||
":") @indent | ||
(rule_import | ||
"with" | ||
":") @extend |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
; inherits: python | ||
|
||
(wildcard | ||
(constraint) @injection.content | ||
(#set! injection.language "regex")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
; inherits: python |