File tree Expand file tree Collapse file tree 2 files changed +19
-9
lines changed Expand file tree Collapse file tree 2 files changed +19
-9
lines changed Original file line number Diff line number Diff line change 1
1
---
2
- refs/heads/master: c7f85003a345826b17801d473303d0c545d0e8d2
2
+ refs/heads/master: 1ef8c48a204ad215310f38a239a898ee38d9bf8e
3
3
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4
4
refs/heads/snap-stage3: a6d9689399d091c3265f00434a69c551a61c28dc
5
5
refs/heads/try: ef355f6332f83371e4acf04fc4eb940ab41d78d3
Original file line number Diff line number Diff line change 101
101
(rust-push-context st 'string (current-column ) t )
102
102
(setf (rust-state-tokenize st) 'rust-token-string )
103
103
(rust-token-string st))
104
- (def ?\' (forward-char )
105
- (setf rust-tcat 'atom )
106
- (let ((is-escape (eq (char-after ) ?\\ ))
107
- (start (point )))
108
- (if (not (rust-eat-until-unescaped ?\' ))
109
- 'font-lock-warning-face
110
- (if (or is-escape (= (point ) (+ start 2 )))
111
- 'font-lock-string-face 'font-lock-warning-face ))))
104
+ (def ?\' (rust-single-quote))
112
105
(def ?/ (forward-char )
113
106
(case (char-after )
114
107
(?/ (end-of-line ) 'font-lock-comment-face )
150
143
(setf rust-tcat 'op ) nil )
151
144
table)))
152
145
146
+ (defun rust-single-quote ()
147
+ (forward-char )
148
+ (setf rust-tcat 'atom )
149
+ ; Is this a lifetime?
150
+ (if (or (looking-at " [a-zA-Z_]$" )
151
+ (looking-at " [a-zA-Z_][^']" ))
152
+ ; If what we see is 'abc, use font-lock-type-face:
153
+ (progn (rust-eat-re " [a-zA-Z_][a-zA-Z_0-9]*" )
154
+ 'font-lock-type-face )
155
+ ; Otherwise, handle as a character constant:
156
+ (let ((is-escape (eq (char-after ) ?\\ ))
157
+ (start (point )))
158
+ (if (not (rust-eat-until-unescaped ?\' ))
159
+ 'font-lock-warning-face
160
+ (if (or is-escape (= (point ) (+ start 2 )))
161
+ 'font-lock-string-face 'font-lock-warning-face )))))
162
+
153
163
(defun rust-token-base (st )
154
164
(funcall (char-table-range rust-char-table (char-after )) st))
155
165
You can’t perform that action at this time.
0 commit comments