summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoy Crihfield <rscrihf@gmail.com>2015-02-17 20:44:22 -0500
committerFelix S. Klock II <pnkfelix@pnkfx.org>2015-04-30 12:39:01 +0200
commit5d0fce59c71f66e7d11469dc9264817d37f51028 (patch)
treea89483e84fc576fa037681ad96912f1ff216812f
parent493cc99ecad9ee1890007c69d2b500156a78ceeb (diff)
downloadrust-mode-5d0fce59c71f66e7d11469dc9264817d37f51028.tar.gz
Fix word and symbol syntax distinction
By passing 'symbols as 2nd argument to regexp-opt, keywords will not be erroneously matched inside symbols. This obviates changing the syntax of `_' to "w".
-rw-r--r--rust-mode.el9
1 files changed, 2 insertions, 7 deletions
diff --git a/rust-mode.el b/rust-mode.el
index 290dd6b..856ee5a 100644
--- a/rust-mode.el
+++ b/rust-mode.el
@@ -32,11 +32,6 @@
(modify-syntax-entry ?\" "\"" table)
(modify-syntax-entry ?\\ "\\" table)
- ;; mark _ as a word constituent so that identifiers
- ;; such as xyz_type don't cause type to be highlighted
- ;; as a keyword
- (modify-syntax-entry ?_ "w" table)
-
;; Comments
(modify-syntax-entry ?/ ". 124b" table)
(modify-syntax-entry ?* ". 23" table)
@@ -335,10 +330,10 @@
(append
`(
;; Keywords proper
- (,(regexp-opt rust-mode-keywords 'words) . font-lock-keyword-face)
+ (,(regexp-opt rust-mode-keywords 'symbols) . font-lock-keyword-face)
;; Special types
- (,(regexp-opt rust-special-types 'words) . font-lock-type-face)
+ (,(regexp-opt rust-special-types 'symbols) . font-lock-type-face)
;; Attributes like `#[bar(baz)]` or `#![bar(baz)]` or `#[bar = "baz"]`
(,(rust-re-grab (concat "#\\!?\\[" rust-re-ident "[^]]*\\]"))