aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS2
-rw-r--r--snakemake-mode.el15
-rw-r--r--snakemake.el2
3 files changed, 12 insertions, 7 deletions
diff --git a/NEWS b/NEWS
index 46428f7..e9a937e 100644
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,8 @@ NEWS -- history of user-visible changes -*- mode: org; -*-
- ".snakefile" has been added as a suffix for Snakemake files.
+- Anonymous rule blocks are now supported.
+
* v0.3.0
** New features
diff --git a/snakemake-mode.el b/snakemake-mode.el
index 319a0d8..56052d1 100644
--- a/snakemake-mode.el
+++ b/snakemake-mode.el
@@ -70,10 +70,11 @@
;;; Regexp
(defconst snakemake-rule-or-subworkflow-re
- (rx (group symbol-start (or "rule" "subworkflow"))
- " "
- (group (one-or-more (or (syntax word) (syntax symbol))))
- ":")
+ (rx (or (and (group symbol-start (or "rule" "subworkflow"))
+ " "
+ (group (one-or-more (or (syntax word) (syntax symbol))))
+ ":")
+ (and (group symbol-start "rule") ":")))
"Regexp matching a rule or subworkflow.")
(defconst snakemake-rule-or-subworkflow-line-re
@@ -326,8 +327,10 @@ label."
;;; Mode
(defvar snakemake-font-lock-keywords
- `((,snakemake-rule-or-subworkflow-line-re (1 font-lock-keyword-face)
- (2 font-lock-function-name-face))
+ `((,snakemake-rule-or-subworkflow-line-re
+ (1 font-lock-keyword-face nil 'lax)
+ (2 font-lock-function-name-face nil 'lax)
+ (3 font-lock-keyword-face nil 'lax))
(,snakemake-toplevel-command-re 1 font-lock-keyword-face)
(,snakemake-builtin-function-re 1 font-lock-builtin-face)
(,snakemake-field-key-indented-re 1 font-lock-type-face)))
diff --git a/snakemake.el b/snakemake.el
index c3f5ec4..20ec2cd 100644
--- a/snakemake.el
+++ b/snakemake.el
@@ -299,7 +299,7 @@ currently limited to a single-item list."
(save-excursion
(end-of-line)
(re-search-backward snakemake-rule-or-subworkflow-re)
- (let ((rule (and (equal (match-string-no-properties 1) "rule")
+ (let ((rule (and (string= (match-string-no-properties 1) "rule")
(match-string-no-properties 2))))
(and (or (not targets-only) (snakemake-check-target rule))
(list rule))))))