@@ -172,16 +172,22 @@ Returns keywords suitable for `font-lock-keywords'."
172
172
; ; "@" "~" "=>") t)
173
173
" \\ (->\\ |\\ .\\ .\\ |::\\ |∷\\ |<-\\ |=>\\ |[=@\\ |~]\\ )"
174
174
" \\ S_" ))
175
+ ; ; These are only keywords when appear at top-level, optionally with
176
+ ; ; indentation. They are not reserved and in other levels would represent
177
+ ; ; record fields or other identifiers.
178
+ (toplevel-keywords
179
+ (rx line-start (zero-or-more whitespace)
180
+ (group (or " type" " module" " import" " data" " class" " newtype"
181
+ " instance" " derive" )
182
+ word-end)))
175
183
; ; Reserved identifiers
176
184
(reservedid
177
185
; ; `as' , `hiding' , and `qualified' are part of the import
178
186
; ; spec syntax, but they are not reserved.
179
187
; ; `_' can go in here since it has temporary word syntax.
180
188
(regexp-opt
181
- '(" ado" " case" " class" " data" " default" " deriving"
182
- " do" " else" " if" " import" " in" " infix" " infixl"
183
- " infixr" " instance" " let" " module" " newtype" " of"
184
- " then" " type" " where" " _" ) 'words ))
189
+ '(" ado" " case" " default" " do" " else" " if" " in" " infix"
190
+ " infixl" " infixr" " let" " of" " then" " where" " _" ) 'words ))
185
191
186
192
; ; Top-level declarations
187
193
(topdecl-var
@@ -210,6 +216,7 @@ Returns keywords suitable for `font-lock-keywords'."
210
216
(" ^>>>>>>> .*$" 0 'font-lock-warning-face t )
211
217
(" ^#.*$" 0 'font-lock-preprocessor-face t )
212
218
219
+ (, toplevel-keywords 1 (symbol-value 'purescript-keyword-face ))
213
220
(, reservedid 1 (symbol-value 'purescript-keyword-face ))
214
221
(, reservedsym 1 (symbol-value 'purescript-operator-face ))
215
222
; ; Special case for `as' , `hiding' , `safe' and `qualified' , which are
0 commit comments