Skip to content

Commit

Permalink
Merge pull request #246 from syohex/issue-245
Browse files Browse the repository at this point in the history
Fix highlighting true, false, nil
  • Loading branch information
tonini committed Sep 6, 2015
2 parents f899bc7 + 128e70c commit 4198d1e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
4 changes: 3 additions & 1 deletion elixir-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,9 @@ is used to limit the scan."
1 font-lock-type-face)

;; Atoms and singleton-like words like true/false/nil.
(,(elixir-rx (group (or atoms "true" "false" "nil"))
(,(elixir-rx symbol-start
(group (or atoms "true" "false" "nil"))
symbol-end
(zero-or-more space)
(optional "="))
1 elixir-atom-face)
Expand Down
13 changes: 12 additions & 1 deletion test/elixir-mode-font-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ end"
true
false
nil
true_false_nil
"
(should (eq (elixir-test-face-at 3) 'elixir-atom-face))
(should (eq (elixir-test-face-at 5) 'elixir-atom-face))
Expand All @@ -183,7 +184,8 @@ nil
(should (eq (elixir-test-face-at 26) 'elixir-atom-face))
(should (eq (elixir-test-face-at 43) 'elixir-atom-face))
(should (eq (elixir-test-face-at 48) 'elixir-atom-face))
(should (eq (elixir-test-face-at 54) 'elixir-atom-face))))
(should (eq (elixir-test-face-at 54) 'elixir-atom-face))
(should-not (eq (elixir-test-face-at 57) 'elixir-atom-face))))

(ert-deftest elixir-mode-syntax-table/fontify-map-keys ()
:tags '(fontification map syntax-table)
Expand Down Expand Up @@ -246,6 +248,15 @@ some_expr"
(should (eq (elixir-test-face-at 2) 'font-lock-variable-name-face))
(should (eq (elixir-test-face-at 4) 'font-lock-variable-name-face))))

(ert-deftest elixir-mode-syntax-table/fontify-assignment-with-singleton ()
"https://github.com/elixir-lang/emacs-elixir/issues/245"
:tags '(fontification syntax-table)
(elixir-test-with-temp-buffer
"true_false_nil = 1"
(should (eq (elixir-test-face-at 1) 'font-lock-variable-name-face))
(should (eq (elixir-test-face-at 6) 'font-lock-variable-name-face))
(should (eq (elixir-test-face-at 12) 'font-lock-variable-name-face))))

(provide 'elixir-mode-font-test)

;;; elixir-mode-font-test.el ends here

0 comments on commit 4198d1e

Please sign in to comment.