File tree 2 files changed +30
-0
lines changed
2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change 182
182
(zero-or-more (any " A-Z" " a-z" " _" " 0-9" ))))
183
183
(optional (or " !" " ?" ))
184
184
symbol-end))
185
+ (arrows . ,(rx (or " ->" " <-" " =>" " |>" )))
185
186
(pseudo-var . ,(rx symbol-start
186
187
(optional (or " %" " &" ))
187
188
(or " _" " __MODULE__" " __DIR__" " __ENV__" " __CALLER__"
@@ -435,6 +436,10 @@ is used to limit the scan."
435
436
(,(elixir-rx (group pseudo-var))
436
437
1 font-lock-constant-face )
437
438
439
+ ; ; Arrows
440
+ (,(elixir-rx (group arrows))
441
+ 1 font-lock-keyword-face )
442
+
438
443
; ; Code points
439
444
(,(elixir-rx (group code-point))
440
445
1 font-lock-negation-char-face )))
Original file line number Diff line number Diff line change @@ -579,6 +579,31 @@ _1_day"
579
579
(should (eq (elixir-test-face-at 2 ) 'font-lock-comment-face ))
580
580
(should (eq (elixir-test-face-at 19 ) 'font-lock-comment-face ))))
581
581
582
+ (ert-deftest elixir-mode-syntax-table/arrows ()
583
+ :tags '(fontification syntax-table)
584
+
585
+ (elixir-test-with-temp-buffer
586
+ " with {:ok, _} <- SomeModule.call(),
587
+ :ok <- OtherModule.call() do
588
+ :ok
589
+ end"
590
+ (should (eq (elixir-test-face-at 15 ) 'font-lock-keyword-face ))
591
+ (should (eq (elixir-test-face-at 50 ) 'font-lock-keyword-face )))
592
+
593
+ (elixir-test-with-temp-buffer
594
+ " %{
595
+ \"\" foo\"\" => \" bar\"
596
+ }"
597
+ (should (eq (elixir-test-face-at 18 ) 'font-lock-keyword-face )))
598
+
599
+ (elixir-test-with-temp-buffer
600
+ " [] |> IO.inspect()"
601
+ (should (eq (elixir-test-face-at 4 ) 'font-lock-keyword-face )))
602
+
603
+ (elixir-test-with-temp-buffer
604
+ " a = fn x -> x end"
605
+ (should (eq (elixir-test-face-at 10 ) 'font-lock-keyword-face ))))
606
+
582
607
(ert-deftest elixir-mode-in-docstring ()
583
608
" https://github.com/elixir-editors/emacs-elixir/issues/355"
584
609
:tags 'fontification
You can’t perform that action at this time.
0 commit comments