|
32 | 32 | (modify-syntax-entry ?\" "\"" table)
|
33 | 33 | (modify-syntax-entry ?\\ "\\" table)
|
34 | 34 |
|
35 |
| - ;; mark _ as a word constituent so that identifiers |
36 |
| - ;; such as xyz_type don't cause type to be highlighted |
37 |
| - ;; as a keyword |
38 |
| - (modify-syntax-entry ?_ "w" table) |
39 |
| - |
40 | 35 | ;; Comments
|
41 | 36 | (modify-syntax-entry ?/ ". 124b" table)
|
42 | 37 | (modify-syntax-entry ?* ". 23" table)
|
|
145 | 140 | ((skip-dot-identifier
|
146 | 141 | (lambda ()
|
147 | 142 | (when (looking-back (concat "\\." rust-re-ident))
|
148 |
| - (backward-word 1) |
| 143 | + (forward-thing 'symbol -1) |
149 | 144 | (backward-char)
|
150 | 145 | (- (current-column) rust-indent-offset)))))
|
151 | 146 | (cond
|
|
331 | 326 | (defun rust-re-item-def (itype)
|
332 | 327 | (concat (rust-re-word itype) "[[:space:]]+" (rust-re-grab rust-re-ident)))
|
333 | 328 |
|
| 329 | +;; (See PR #42 -- this is just like `(regexp-opt words 'symbols)` from |
| 330 | +;; newer Emacs versions, but will work on Emacs 23.) |
| 331 | +(defun regexp-opt-symbols (words) |
| 332 | + (concat "\\_<" (regexp-opt words t) "\\_>")) |
| 333 | + |
334 | 334 | (defvar rust-mode-font-lock-keywords
|
335 | 335 | (append
|
336 | 336 | `(
|
337 | 337 | ;; Keywords proper
|
338 |
| - (,(regexp-opt rust-mode-keywords 'words) . font-lock-keyword-face) |
| 338 | + (,(regexp-opt-symbols rust-mode-keywords) . font-lock-keyword-face) |
339 | 339 |
|
340 | 340 | ;; Special types
|
341 |
| - (,(regexp-opt rust-special-types 'words) . font-lock-type-face) |
| 341 | + (,(regexp-opt-symbols rust-special-types) . font-lock-type-face) |
342 | 342 |
|
343 | 343 | ;; Attributes like `#[bar(baz)]` or `#![bar(baz)]` or `#[bar = "baz"]`
|
344 | 344 | (,(rust-re-grab (concat "#\\!?\\[" rust-re-ident "[^]]*\\]"))
|
|
0 commit comments