From b4be5e8072478a9c916add695acdbf6e8ea4fe45 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Thu, 17 Nov 2016 18:12:22 -0500 Subject: snakemake-rx-constituents: Replace sm-func with sm-builtin The sm-builtin regexp will be extended to support built-in Snakemake objects like "input" and "output", at which point "function" will no longer be an accurate description. --- snakemake-mode.el | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/snakemake-mode.el b/snakemake-mode.el index 9471965..448a4af 100644 --- a/snakemake-mode.el +++ b/snakemake-mode.el @@ -111,14 +111,16 @@ "wildcard_constraints" "workdir") symbol-end)) - (sm-func . ,(rx symbol-start - (or "dynamic" - "expand" - "protected" - "shell" - "temp" - "touch") - symbol-end))) + (sm-builtin . ,(rx symbol-start + (or "dynamic" + "expand" + "protected" + "shell" + "temp" + "touch") + symbol-end)) + ;; Deprecated. Use `sm-builtin' instead. + (sm-func . sm-builtin)) "Snakemake-specific sexps for `snakemake-rx'.") (defmacro snakemake-rx (&rest regexps) @@ -414,7 +416,7 @@ embedded R, you need to set mmm-global-mode to a non-nil value such as 'maybe.") (1 font-lock-keyword-face nil 'lax) (2 font-lock-function-name-face nil 'lax) (3 font-lock-keyword-face nil 'lax)) - (,(snakemake-rx (group sm-func) (zero-or-more space) "(") + (,(snakemake-rx (group sm-builtin) (zero-or-more space) "(") 1 font-lock-builtin-face) (,(snakemake-rx line-start (one-or-more space) (group field-key) -- cgit v1.2.3 From 6af48198df6520acbba6c0408ab7ff697ef348f4 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Thu, 17 Nov 2016 18:13:42 -0500 Subject: snakemake-font-lock-keywords: Increase field key precedence Instead of distinguishing built-ins from field keys by a trailing "(", make the field key regexp, which is more specific, have a higher precedence. This allows Snakemake built-ins to be highlighted correctly even if they are not called as functions. --- snakemake-mode.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/snakemake-mode.el b/snakemake-mode.el index 448a4af..b8b1f49 100644 --- a/snakemake-mode.el +++ b/snakemake-mode.el @@ -416,12 +416,11 @@ embedded R, you need to set mmm-global-mode to a non-nil value such as 'maybe.") (1 font-lock-keyword-face nil 'lax) (2 font-lock-function-name-face nil 'lax) (3 font-lock-keyword-face nil 'lax)) - (,(snakemake-rx (group sm-builtin) (zero-or-more space) "(") - 1 font-lock-builtin-face) (,(snakemake-rx line-start (one-or-more space) (group field-key) (zero-or-more space) ":") 1 font-lock-type-face) + (,(snakemake-rx (group sm-builtin)) 1 font-lock-builtin-face) (,(snakemake-rx line-start (zero-or-more space) (group sm-command) (zero-or-more space) ":") -- cgit v1.2.3 From 26bfdfaa76728a906c06b3577c3de08dc79cd4b5 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Thu, 17 Nov 2016 18:15:41 -0500 Subject: snakemake-rx-constituents: Support more built-in Snakemake objects Using "input" here overrides the highlighting of "input" by python-font-lock-keywords, although in either case font-lock-builtin-face is used. The addition of "output" to the regexp means that output and input are now displayed with a consistent face in run blocks. Fixes #20. --- snakemake-mode.el | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/snakemake-mode.el b/snakemake-mode.el index b8b1f49..b557672 100644 --- a/snakemake-mode.el +++ b/snakemake-mode.el @@ -114,10 +114,14 @@ (sm-builtin . ,(rx symbol-start (or "dynamic" "expand" + "input" + "output" + "params" "protected" "shell" "temp" - "touch") + "touch" + "wildcards") symbol-end)) ;; Deprecated. Use `sm-builtin' instead. (sm-func . sm-builtin)) -- cgit v1.2.3