|
6 | 6 | ;; URL: https://git.kyleam.com/snakemake-mode/about
|
7 | 7 | ;; Keywords: tools
|
8 | 8 | ;; Version: 2.0.0
|
9 |
| -;; Package-Requires: ((emacs "26.1") (transient "0.3.0")) |
| 9 | +;; Package-Requires: ((emacs "27.1") (transient "0.3.0")) |
10 | 10 |
|
11 | 11 | ;; This program is free software; you can redistribute it and/or modify
|
12 | 12 | ;; it under the terms of the GNU General Public License as published by
|
|
73 | 73 |
|
74 | 74 | ;;; Regexp
|
75 | 75 |
|
76 |
| -(eval-and-compile |
77 |
| - (defconst snakemake-rx-constituents |
78 |
| - `((named-rule . ,(rx (and (group |
79 |
| - symbol-start |
80 |
| - (or "checkpoint" "module" "rule" "subworkflow")) |
81 |
| - " " |
82 |
| - (group (one-or-more |
83 |
| - (or (syntax word) (syntax symbol))))))) |
84 |
| - (anon-rule . ,(rx symbol-start "rule")) |
85 |
| - (field-key . ,(rx symbol-start |
86 |
| - (or "benchmark" |
87 |
| - "cache" |
88 |
| - "conda" |
89 |
| - "container" |
90 |
| - "cwl" |
91 |
| - "default_target" |
92 |
| - "envmodules" |
93 |
| - "group" |
94 |
| - "handover" |
95 |
| - "input" |
96 |
| - "localrule" |
97 |
| - "log" |
98 |
| - "message" |
99 |
| - "name" |
100 |
| - "notebook" |
101 |
| - "output" |
102 |
| - "params" |
103 |
| - "priority" |
104 |
| - "resources" |
105 |
| - "run" |
106 |
| - "script" |
107 |
| - "shadow" |
108 |
| - "shell" |
109 |
| - "singularity" |
110 |
| - "threads" |
111 |
| - "version" |
112 |
| - "wildcard_constraints" |
113 |
| - "wrapper" |
114 |
| - ;; Keys for subworkflow blocks |
115 |
| - "configfile" |
116 |
| - "snakefile" |
117 |
| - "workdir") |
118 |
| - symbol-end)) |
119 |
| - (sm-command . ,(rx symbol-start |
120 |
| - (or "configfile" |
121 |
| - "container" |
122 |
| - "containerized" |
123 |
| - "envvars" |
124 |
| - "include" |
125 |
| - "localrules" |
126 |
| - "onerror" |
127 |
| - "onsuccess" |
128 |
| - "report" |
129 |
| - "ruleorder" |
130 |
| - "singularity" |
131 |
| - "wildcard_constraints" |
132 |
| - "workdir") |
133 |
| - symbol-end)) |
134 |
| - (sm-builtin . ,(rx symbol-start |
135 |
| - (or "ancient" |
136 |
| - "checkpoints" |
137 |
| - "directory" |
138 |
| - "dynamic" |
139 |
| - "expand" |
140 |
| - "input" |
141 |
| - "multiext" |
142 |
| - "output" |
143 |
| - "params" |
144 |
| - "pipe" |
145 |
| - "protected" |
146 |
| - "report" |
147 |
| - "shell" |
148 |
| - "temp" |
149 |
| - "touch" |
150 |
| - "unpack" |
151 |
| - "wildcards") |
152 |
| - symbol-end))) |
153 |
| - "Snakemake-specific sexps for `snakemake-rx'.") |
154 |
| - |
155 |
| - (defmacro snakemake-rx (&rest regexps) |
156 |
| - "Specialized `rx' for Snakemake mode." |
157 |
| - ;; Modified from `python-rx'. |
158 |
| - (let ((rx-constituents (append snakemake-rx-constituents rx-constituents))) |
159 |
| - (cond ((null regexps) |
160 |
| - (error "No regexp")) |
161 |
| - ((cdr regexps) |
162 |
| - (rx-to-string `(and ,@regexps) t)) |
163 |
| - (t |
164 |
| - (rx-to-string (car regexps) t)))))) |
| 76 | +(defmacro snakemake-rx (&rest regexps) |
| 77 | + "Specialized `rx' for Snakemake mode." |
| 78 | + ;; Modified from `python-rx'. |
| 79 | + `(rx-let ((named-rule (and (group |
| 80 | + symbol-start |
| 81 | + (or "checkpoint" "module" "rule" "subworkflow")) |
| 82 | + " " |
| 83 | + (group (one-or-more |
| 84 | + (or (syntax word) (syntax symbol)))))) |
| 85 | + (anon-rule (and symbol-start "rule")) |
| 86 | + (field-key (and symbol-start |
| 87 | + (or "benchmark" |
| 88 | + "cache" |
| 89 | + "conda" |
| 90 | + "container" |
| 91 | + "cwl" |
| 92 | + "default_target" |
| 93 | + "envmodules" |
| 94 | + "group" |
| 95 | + "handover" |
| 96 | + "input" |
| 97 | + "localrule" |
| 98 | + "log" |
| 99 | + "message" |
| 100 | + "name" |
| 101 | + "notebook" |
| 102 | + "output" |
| 103 | + "params" |
| 104 | + "priority" |
| 105 | + "resources" |
| 106 | + "run" |
| 107 | + "script" |
| 108 | + "shadow" |
| 109 | + "shell" |
| 110 | + "singularity" |
| 111 | + "threads" |
| 112 | + "version" |
| 113 | + "wildcard_constraints" |
| 114 | + "wrapper" |
| 115 | + ;; Keys for subworkflow blocks |
| 116 | + "configfile" |
| 117 | + "snakefile" |
| 118 | + "workdir") |
| 119 | + symbol-end)) |
| 120 | + (sm-command (and symbol-start |
| 121 | + (or "configfile" |
| 122 | + "container" |
| 123 | + "containerized" |
| 124 | + "envvars" |
| 125 | + "include" |
| 126 | + "localrules" |
| 127 | + "onerror" |
| 128 | + "onsuccess" |
| 129 | + "report" |
| 130 | + "ruleorder" |
| 131 | + "singularity" |
| 132 | + "wildcard_constraints" |
| 133 | + "workdir") |
| 134 | + symbol-end)) |
| 135 | + (sm-builtin (and symbol-start |
| 136 | + (or "ancient" |
| 137 | + "checkpoints" |
| 138 | + "directory" |
| 139 | + "dynamic" |
| 140 | + "expand" |
| 141 | + "input" |
| 142 | + "multiext" |
| 143 | + "output" |
| 144 | + "params" |
| 145 | + "pipe" |
| 146 | + "protected" |
| 147 | + "report" |
| 148 | + "shell" |
| 149 | + "temp" |
| 150 | + "touch" |
| 151 | + "unpack" |
| 152 | + "wildcards") |
| 153 | + symbol-end))) |
| 154 | + (rx ,@regexps))) |
165 | 155 |
|
166 | 156 | (defconst snakemake-rule-or-subworkflow-re
|
167 | 157 | (snakemake-rx line-start (zero-or-more space)
|
|
0 commit comments