Skip to content

Commit

Permalink
Merge pull request fxbois#1138 from jsmestad/elixir-improvements
Browse files Browse the repository at this point in the history
Elixir font lock improvements
  • Loading branch information
fxbois authored Jun 5, 2020
2 parents 186a7c2 + 20d8b93 commit a2badd0
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion web-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -1407,6 +1407,19 @@ shouldn't be moved back.)")
(cdr (assoc "python" web-mode-extra-constants))
'("True" "False" "None" "__debug__" "NotImplemented" "Ellipsis"))))

(defvar web-mode-elixir-keywords
(regexp-opt
(append
(cdr (assoc "elixir" web-mode-extra-keywords))
'("do" "end" "case" "bc" "lc" "for" "if" "cond" "with" "unless" "try" "receive" "fn" "defmodule" "defprotocol" "defimpl" "defrecord" "defrecordp" "defstruct" "defdelegate" "defcallback" "defexception" "defoverridable" "defguard" "defgaurdp" "exit" "after" "rescue" "catch" "else" "raise" "throw" "quote" "unquote" "super" "when" "and" "or" "not" "in"))))


(defvar web-mode-elixir-constants
(regexp-opt
(append
(cdr (assoc "elixir" web-mode-extra-constants))
'("nil" "true" "false"))))

(defvar web-mode-erlang-constants
(regexp-opt
(append
Expand Down Expand Up @@ -2251,6 +2264,15 @@ shouldn't be moved back.)")
(cons (concat "\\_<\\(" web-mode-python-keywords "\\)\\_>") '(0 'web-mode-keyword-face))
))

(defvar web-mode-elixir-font-lock-keywords
(list
(cons (concat "\\_<\\(" web-mode-elixir-keywords "\\)\\_>") '(0 'web-mode-builtin-face))
(cons (concat "\\_<\\(" web-mode-elixir-constants "\\)\\_>") '(0 'web-mode-constant-face))
'("def[ ]+\\([[:alnum:]_]+\\)" 1 'web-mode-function-name-face)
'("@\\([[:alnum:]_]+\\)" 0 'web-mode-variable-name-face)
'("[ ]\\(:[[:alnum:]-_]+\\)" 1 'web-mode-symbol-face)
))

(defvar web-mode-erlang-font-lock-keywords
(list
(cons (concat "\\_<\\(" web-mode-erlang-keywords "\\)\\_>") '(0 'web-mode-keyword-face))
Expand Down Expand Up @@ -2355,7 +2377,7 @@ shouldn't be moved back.)")
("closure" . web-mode-closure-font-lock-keywords)
("ctemplate" . web-mode-ctemplate-font-lock-keywords)
("dust" . web-mode-dust-font-lock-keywords)
("elixir" . web-mode-erlang-font-lock-keywords)
("elixir" . web-mode-elixir-font-lock-keywords)
("ejs" . web-mode-ejs-font-lock-keywords)
("erb" . web-mode-erb-font-lock-keywords)
("expressionengine" . web-mode-expressionengine-font-lock-keywords)
Expand Down

0 comments on commit a2badd0

Please sign in to comment.