Skip to content

Commit 3ea3935

Browse files
committed
Merge pull request #58 from elixir-lang/regex-string-format
Use string syntax highlighting for regex patterns.
2 parents 395c795 + a2f3f2c commit 3ea3935

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

elixir-mode.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@
387387
'("\\(\\w+\\)\\s-*:?=[^=]" 1 font-lock-variable-name-face)
388388

389389
;; regexes:
390-
'("-[Rr].*[ \n\t]" . font-lock-constant-face)
390+
'("~r/\\(.*\\)/[, \n\t]*" 1 font-lock-string-face)
391391

392392
;; atoms, boolean:
393393
'("\\<\\(true\\|false\\|nil\\)\\>" . font-lock-reference-face)

test/elixir-mode-font-tests.el

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ buffer."
2727
(elixir-test-with-temp-buffer
2828
"match = ~r/foo/"
2929
(should (eq (elixir-test-face-at 1) 'font-lock-variable-name-face))
30-
(should (eq (elixir-test-face-at 9) 'font-lock-builtin-face))))
30+
(should (eq (elixir-test-face-at 9) 'font-lock-builtin-face))
31+
(should (eq (elixir-test-face-at 12) 'font-lock-string-face))
32+
;; no face for regex delimiters
33+
(should (eq (elixir-test-face-at 15) nil))))
3134

3235
(ert-deftest elixir-mode-syntax-table/fontify-modules-and-types ()
3336
:tags '(fontification syntax-table)

0 commit comments

Comments
 (0)