From b4a21404f2e7e59610a531252d440d31d1ca69c6 Mon Sep 17 00:00:00 2001 From: Samuel Tonini Date: Wed, 5 Aug 2015 06:40:24 +0200 Subject: [PATCH 1/2] remove legacy regex for syntax highlighting --- elixir-mode.el | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/elixir-mode.el b/elixir-mode.el index a9a8e503..5bbd422a 100644 --- a/elixir-mode.el +++ b/elixir-mode.el @@ -184,24 +184,10 @@ (zero-or-more (any "A-Z" "a-z" "_" "0-9")))) (optional (or "!" "?")) symbol-end)) - (operators1 . ,(rx symbol-start - (or "<" ">" "+" "-" "*" "/" "!" "^" "&") - symbol-end)) - (operators2 . ,(rx symbol-start - (or - "==" "!=" "<=" ">=" "&&" "||" "<>" "++" "--" "|>" "=~" - "->" "<-" "|" "." "=") - symbol-end)) - (operators3 . ,(rx symbol-start - (or "<<<" ">>>" "|||" "&&&" "^^^" "~~~" "===" "!==") - symbol-end)) (pseudo-var . ,(rx symbol-start (or "_" "__MODULE__" "__DIR__" "__ENV__" "__CALLER__" "__block__" "__aliases__") symbol-end)) - (punctuation . ,(rx symbol-start - (or "\\" "<<" ">>" "=>" "(" ")" ":" ";" "" "[" "]") - symbol-end)) (sigils . ,(rx "~" (or "B" "C" "R" "S" "b" "c" "r" "s" "w"))))) (defmacro elixir-rx (&rest sexps) From 1e85220b968fa42bb5436c9dc4f0da34dbc864f1 Mon Sep 17 00:00:00 2001 From: Samuel Tonini Date: Wed, 5 Aug 2015 06:40:54 +0200 Subject: [PATCH 2/2] `&` char should also be colored as part of the module --- elixir-mode.el | 2 +- test/elixir-mode-font-test.el | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/elixir-mode.el b/elixir-mode.el index 5bbd422a..f10f76e3 100644 --- a/elixir-mode.el +++ b/elixir-mode.el @@ -175,7 +175,7 @@ ;; Finally, like other identifiers, it can be terminated with either `?' ;; or `!'. (module-names . ,(rx symbol-start - (optional "%") + (optional (or "%" "&")) (one-or-more (any "A-Z")) (zero-or-more (any "A-Z" "a-z" "_" "0-9")) (zero-or-more diff --git a/test/elixir-mode-font-test.el b/test/elixir-mode-font-test.el index 49113b9e..2102d8db 100644 --- a/test/elixir-mode-font-test.el +++ b/test/elixir-mode-font-test.el @@ -49,7 +49,8 @@ match=~r/foo/" "defmodule Application.Behavior do use Application.Behaviour Stand.Alone.call - %RuntimeError{message: msg}" + %RuntimeError{message: msg} + &Enum" (should (eq (elixir-test-face-at 1) 'font-lock-keyword-face)) (should (eq (elixir-test-face-at 11) 'font-lock-type-face)) (should (eq (elixir-test-face-at 22) 'font-lock-type-face)) @@ -61,6 +62,8 @@ match=~r/foo/" (should (eq (elixir-test-face-at 53) 'font-lock-type-face)) (should (eq (elixir-test-face-at 68) 'font-lock-type-face)) (should (eq (elixir-test-face-at 72) 'font-lock-type-face)) + (should (eq (elixir-test-face-at 114) 'font-lock-type-face)) + (should (eq (elixir-test-face-at 117) 'font-lock-type-face)) ;; no face for function call (should (eq (elixir-test-face-at 79) nil)) (should (eq (elixir-test-face-at 84) 'font-lock-type-face))