|
278 | 278 | (or "+" "++" "<>" "-" "/" "*" "div" "rem" "==" "!=" "<="
|
279 | 279 | "<" ">=" ">" "===" "!==" "and" "or" "not" "&&" "||"
|
280 | 280 | "!" "." "#" "=" ":=" "<-")))
|
281 |
| - (resource-name . ,(rx symbol-start |
282 |
| - (zero-or-more (any "A-Z") |
283 |
| - (zero-or-more |
284 |
| - (any "a-z")) |
285 |
| - "." |
286 |
| - (any "A-Z") |
287 |
| - (zero-or-more |
288 |
| - (any "a-z"))) |
289 |
| - symbol-end)) |
| 281 | + ;; Module and submodule names start with upper case letter or `_'. This |
| 282 | + ;; can then be followed by any combination of alphanumeric chars + `_'. |
| 283 | + ;; In turn, this can be followed by a `.' which begins the notation of |
| 284 | + ;; a submodule, which follows the same naming pattern of the module. |
| 285 | + ;; Finally, like other identifiers, it can be terminated with either `?' |
| 286 | + ;; or `!'. |
| 287 | + (module-names . ,(rx symbol-start |
| 288 | + (one-or-more (any "A-Z" "_")) |
| 289 | + (zero-or-more (any "A-Z" "a-z" "_" "0-9")) |
| 290 | + (zero-or-more |
| 291 | + (and "." |
| 292 | + (one-or-more (any "A-Z" "_")) |
| 293 | + (zero-or-more (any "A-Z" "a-z" "_" "0-9")))) |
| 294 | + (optional (or "!" "?")) |
| 295 | + symbol-end)) |
| 296 | + ;; The first character of an identifier must be a letter or an underscore. |
| 297 | + ;; After that, they may contain any alphanumeric character + underscore. |
| 298 | + ;; Additionally, the final character may be either `?' or `!'. |
290 | 299 | (identifiers . ,(rx symbol-start
|
291 | 300 | (one-or-more (any "A-Z" "a-z""_"))
|
292 |
| - (zero-or-more (any "0-9" "_")) |
| 301 | + (zero-or-more (any "A-Z" "a-z" "0-9" "_")) |
293 | 302 | (optional (or "?" "!"))
|
294 | 303 | symbol-end))
|
295 | 304 | (atoms . ,(rx ":"
|
|
310 | 319 |
|
311 | 320 | (defconst elixir-mode-font-lock-defaults
|
312 | 321 | `(
|
313 |
| - ;; Import, module- and method-defining keywords |
314 |
| - (,(elixir-rx (or method-defines module-defines imports) |
| 322 | + ;; Module-defining & namespace builtins |
| 323 | + (,(elixir-rx (or module-defines imports) |
315 | 324 | space
|
316 |
| - (group resource-name)) |
| 325 | + (group module-names)) |
317 | 326 | 1 font-lock-type-face)
|
318 | 327 |
|
319 | 328 | ;; Keywords
|
|
0 commit comments