From 2e659ce0982c07c79bccc7ac322444a6f97179ee Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Tue, 3 May 2016 02:19:14 -0400 Subject: Be more lenient with spacing in regexps --- snakemake-mode.el | 6 +++--- snakemake-test.el | 20 ++++++++++++++++++++ 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/snakemake-mode.el b/snakemake-mode.el index 9c47afe..ab4549b 100644 --- a/snakemake-mode.el +++ b/snakemake-mode.el @@ -95,7 +95,7 @@ "onsuccess" "ruleorder" "workdir")) - ":" (zero-or-more space)) + (zero-or-more space) ":") "Regexp matching other toplevel commands aside from 'rule'.") (defconst snakemake-field-key-re @@ -118,7 +118,7 @@ ;; Keys for subworkflow blocks "snakefile" "workdir")) - ":") + (zero-or-more space) ":") "Regexp matching a rule or subworkflow field key.") (defconst snakemake-field-key-indented-re @@ -128,7 +128,7 @@ (defconst snakemake-builtin-function-re (rx (group symbol-start (or "expand" "shell" "protected" "temp" "dynamic" "touch")) - "(") + (zero-or-more space) "(") "Regexp matching a call to a builtin Snakemake function.") diff --git a/snakemake-test.el b/snakemake-test.el index 3bac276..f092756 100644 --- a/snakemake-test.el +++ b/snakemake-test.el @@ -111,6 +111,13 @@ rule: " rule abc:" (snakemake-indent-line) (buffer-string)))) + (should + (string= + "rule abc :" + (snakemake-with-temp-text + " rule abc :" + (snakemake-indent-line) + (buffer-string)))) ;; Don't move point if beyond column 0. (should @@ -211,6 +218,19 @@ rule abc: (should (string= " +rule abc: + input: 'infile' + output :" + (snakemake-with-temp-text + " +rule abc: + input: 'infile' +output :" + (snakemake-indent-line) + (buffer-string)))) + (should + (string= + " rule abc: input: 'infile' output:" -- cgit v1.2.3