|
70 | 70 | :type 'string
|
71 | 71 | :group 'elixir)
|
72 | 72 |
|
| 73 | +(defvar elixir-mode-define-names '( |
| 74 | + "def" |
| 75 | + "defdelegate" |
| 76 | + "defimpl" |
| 77 | + "defmacro" |
| 78 | + "defmacrop" |
| 79 | + "defmodule" |
| 80 | + "defoverridable" |
| 81 | + "defp" |
| 82 | + "defprotocol" |
| 83 | + "defrecord" |
| 84 | + "destructure") |
| 85 | +"Elixir mode def-like keywords.") |
73 | 86 | (defvar elixir-mode-keyword-names '(
|
74 | 87 | "->"
|
| 88 | + "bc" |
| 89 | + "lc" |
| 90 | + "in" |
| 91 | + "inbits" |
| 92 | + "inlist" |
| 93 | + "quote" |
| 94 | + "unquote" |
| 95 | + "unquote_splicing" |
| 96 | + "var" |
75 | 97 | "do"
|
76 | 98 | "after"
|
77 | 99 | "for"
|
78 |
| - "defmodule" |
79 |
| - "private" |
80 | 100 | "def"
|
| 101 | + "defdelegate" |
| 102 | + "defimpl" |
| 103 | + "defmacro" |
| 104 | + "defmacrop" |
| 105 | + "defmodule" |
| 106 | + "defoverridable" |
| 107 | + "defp" |
| 108 | + "defprotocol" |
| 109 | + "defrecord" |
| 110 | + "destructure" |
| 111 | + "alias" |
| 112 | + "refer" |
| 113 | + "require" |
| 114 | + "import" |
| 115 | + "use" |
81 | 116 | "if"
|
| 117 | + "true" |
| 118 | + "false" |
82 | 119 | "when"
|
83 | 120 | "case"
|
84 |
| - "match" |
| 121 | + "cond" |
| 122 | + "throw" |
85 | 123 | "then"
|
86 | 124 | "else"
|
87 | 125 | "elsif"
|
88 | 126 | "try"
|
89 | 127 | "catch"
|
| 128 | + "rescue" |
| 129 | + "fn" |
| 130 | + "receive" |
90 | 131 | "end")
|
91 | 132 | "Elixir mode keywords.")
|
92 | 133 | (defvar elixir-mode-module-names '(
|
93 |
| - "Atom" |
94 |
| - "BitString" |
| 134 | + "Behavior" |
| 135 | + "Binary" |
| 136 | + "Bitwise" |
| 137 | + "Builtin" |
| 138 | + "Elixir" |
95 | 139 | "Code"
|
96 |
| - "Date" |
97 |
| - "DateTime" |
98 | 140 | "EEx"
|
99 |
| - "ETS" |
| 141 | + "Enum" |
100 | 142 | "ExUnit"
|
| 143 | + "Exception" |
101 | 144 | "File"
|
102 |
| - "Float" |
| 145 | + "GenServer" |
103 | 146 | "Function"
|
104 | 147 | "GenServer"
|
105 | 148 | "GenTCP"
|
106 |
| - "IEX" |
107 |
| - "Integer" |
| 149 | + "HashDict" |
108 | 150 | "IO"
|
| 151 | + "Keyword" |
109 | 152 | "List"
|
110 | 153 | "Math"
|
111 |
| - "Method" |
112 | 154 | "Module"
|
113 |
| - "Numeric" |
114 |
| - "OrderedDict" |
115 |
| - "OS" |
| 155 | + "Node" |
| 156 | + "OptrionParser" |
| 157 | + "OrdDict" |
116 | 158 | "Port"
|
117 | 159 | "Process"
|
118 | 160 | "Record"
|
119 |
| - "Reference" |
120 | 161 | "Regexp"
|
121 |
| - "Set" |
122 |
| - "String" |
123 |
| - "Timer" |
| 162 | + "System" |
124 | 163 | "Tuple"
|
| 164 | + "URI" |
125 | 165 | "UnboundMethod")
|
126 | 166 | "Elixir mode modules.")
|
127 | 167 | (defvar elixir-mode-builtin-names '(
|
128 |
| - "Erlang") |
| 168 | + "Erlang" |
| 169 | + "__MODULE__" |
| 170 | + "__FUNCTION__" |
| 171 | + "__LINE__" |
| 172 | + "__FILE__" |
| 173 | + "__LOCAL__" |
| 174 | +) |
129 | 175 | "Elixir mode builtins.")
|
130 | 176 | (defvar elixir-mode-operator-names '(
|
131 | 177 | "+"
|
| 178 | + "++" |
| 179 | + "<>" |
132 | 180 | "-"
|
133 | 181 | "/"
|
134 | 182 | "*"
|
|
156 | 204 | ":="
|
157 | 205 | "<-")
|
158 | 206 | "Elixir mode operators.")
|
| 207 | +(defvar elixir-basic-offset 2) |
| 208 | +(defvar elixir-key-label-offset 0) |
| 209 | +(defvar elixir-match-label-offset 2) |
159 | 210 |
|
160 | 211 | (defvar font-lock-operator-face 'font-lock-operator-face)
|
161 | 212 | (defface font-lock-operator-face
|
|
166 | 217 | "For use with operators."
|
167 | 218 | :group 'font-lock-faces)
|
168 | 219 |
|
169 |
| -(defvar font-lock-atom-face 'default) |
170 |
| -(defface font-lock-operator-face |
171 |
| - '((((type tty) (class color)) nil) |
172 |
| - (((class color) (background light)) |
173 |
| - (:foreground "magenta")) |
174 |
| - (t nil)) |
175 |
| - "For use with atoms." |
176 |
| - :group 'font-lock-faces) |
177 |
| - |
178 | 220 | (defconst elixir-mode-font-lock-defaults
|
179 | 221 | (list
|
180 | 222 | '("#.*$" . font-lock-comment-face) ; comments
|
181 |
| - '("^\\<def\\s_+\\([^( \t\n]+\\)" . font-lock-function-name-face) ; methods |
| 223 | + `(,(concat "^\\s *\\<" (regexp-opt elixir-mode-define-names t) "\\>\\s +\\([^( \t\n]+\\)") 2 font-lock-function-name-face) ; methods |
182 | 224 | `(,(concat "\\<" (regexp-opt elixir-mode-keyword-names t) "\\>") . font-lock-keyword-face) ; keywords
|
183 | 225 | `(,(concat "\\<" (regexp-opt elixir-mode-builtin-names t) "\\>") . font-lock-builtin-face) ; builtins
|
184 | 226 | `(,(concat "\\<" (regexp-opt elixir-mode-module-names t) "\\>") . font-lock-type-face) ; core modules
|
185 | 227 | (when elixir-mode-highlight-operators `(,(concat "\\<" (regexp-opt elixir-mode-operator-names t) "\\>") . font-lock-operator-face)) ; operators
|
186 | 228 | '("\\(\\w*\\)\\s-*:?=" . font-lock-variable-name-face) ; variables
|
187 | 229 | '("-[Rr].*[ \n\t]" . font-lock-constant-face) ; regexes
|
188 |
| - '("\\<\\(true\\|false\\|nil\\)\\>" . font-lock-atom-face) ; atoms, boolean |
189 |
| - '("'\\w*" . font-lock-atom-face)) ; atoms, generic |
| 230 | + '("\\<\\(true\\|false\\|nil\\)\\>" . font-lock-reference-face) ; atoms, boolean |
| 231 | + '("\\w*:\s" . font-lock-reference-face) |
| 232 | + '(":\\w*" . font-lock-reference-face)) ; atoms, generic |
190 | 233 | "Highlighting for Elixir mode.")
|
191 | 234 |
|
192 | 235 | (defun elixir-mode-cygwin-path (expanded-file-name)
|
|
0 commit comments