@@ -86,6 +86,19 @@ be disabled at that position."
86
86
:type '(alist string string)
87
87
:group 'haskell-appearance )
88
88
89
+ (defcustom haskell-font-lock-keywords
90
+ ; ; `as' , `hiding' , and `qualified' are part of the import
91
+ ; ; spec syntax, but they are not reserved.
92
+ ; ; `_' can go in here since it has temporary word syntax.
93
+ '(" case" " class" " data" " default" " deriving" " do"
94
+ " else" " if" " import" " in" " infix" " infixl"
95
+ " infixr" " instance" " let" " module" " mdo" " newtype" " of"
96
+ " rec" " pattern" " proc" " then" " type" " where" " _" )
97
+ " Identifiers treated as reserved keywords in Haskell."
98
+ :group 'haskell-appearance
99
+ :type '(repeat string))
100
+
101
+
89
102
(defun haskell-font-lock-dot-is-not-composition (start )
90
103
" Return non-nil if the \" .\" at START is not a composition operator.
91
104
This is the case if the \" .\" is part of a \" forall <tvar> . <type>\" ."
@@ -229,16 +242,6 @@ Regexp match data 0 points to the chars."
229
242
; ; no face. So force evaluation by using `keep' .
230
243
keep)))))
231
244
232
- (defconst haskell-font-lock--reverved-ids
233
- ; ; `as' , `hiding' , and `qualified' are part of the import
234
- ; ; spec syntax, but they are not reserved.
235
- ; ; `_' can go in here since it has temporary word syntax.
236
- '(" case" " class" " data" " default" " deriving" " do"
237
- " else" " if" " import" " in" " infix" " infixl"
238
- " infixr" " instance" " let" " module" " mdo" " newtype" " of"
239
- " rec" " proc" " then" " type" " where" " _" )
240
- " Identifiers treated as reserved keywords in Haskell." )
241
-
242
245
(defun haskell-font-lock--forward-type (&optional ignore )
243
246
" Find where does this type declaration end.
244
247
@@ -283,7 +286,7 @@ like ::, class, instance, data, newtype, type."
283
286
(setq last-token-was-newline nil ))
284
287
((and (or (member (match-string-no-properties 0 )
285
288
'(" <-" " =" " ←" ))
286
- (member (match-string-no-properties 0 ) haskell-font-lock--reverved-ids ))
289
+ (member (match-string-no-properties 0 ) haskell-font-lock-keywords ))
287
290
(not (member (match-string-no-properties 0 ) ignore)))
288
291
(setq cont nil )
289
292
(setq last-token-was-newline nil ))
@@ -318,7 +321,7 @@ like ::, class, instance, data, newtype, type."
318
321
" Private function used to select either type or constructor face
319
322
on an uppercase identifier."
320
323
(cl-case (haskell-lexeme-classify-by-first-char (char-after (match-beginning 1 )))
321
- (varid (when (member (match-string 0 ) haskell-font-lock--reverved-ids )
324
+ (varid (when (member (match-string 0 ) haskell-font-lock-keywords )
322
325
; ; Note: keywords parse as keywords only when not qualified.
323
326
; ; GHC parses Control.let as a single but illegal lexeme.
324
327
(when (member (match-string 0 ) '(" class" " instance" " type" " data" " newtype" ))
@@ -440,11 +443,11 @@ on an uppercase identifier."
440
443
441
444
; ; Toplevel Declarations.
442
445
; ; Place them *before* generic id-and-op highlighting.
443
- (, topdecl-var (1 (unless (member (match-string 1 ) haskell-font-lock--reverved-ids )
446
+ (, topdecl-var (1 (unless (member (match-string 1 ) haskell-font-lock-keywords )
444
447
'haskell-definition-face )))
445
- (, topdecl-var2 (2 (unless (member (match-string 2 ) haskell-font-lock--reverved-ids )
448
+ (, topdecl-var2 (2 (unless (member (match-string 2 ) haskell-font-lock-keywords )
446
449
'haskell-definition-face )))
447
- (, topdecl-bangpat (1 (unless (member (match-string 1 ) haskell-font-lock--reverved-ids )
450
+ (, topdecl-bangpat (1 (unless (member (match-string 1 ) haskell-font-lock-keywords )
448
451
'haskell-definition-face )))
449
452
(, topdecl-sym (2 (unless (member (match-string 2 ) '(" \\ " " =" " ->" " →" " <-" " ←" " ::" " ∷" " ," " ;" " `" ))
450
453
'haskell-definition-face )))
0 commit comments