Skip to content

Commit f51a214

Browse files
committed
Restore module in non-toplevel and test that
1 parent 413f56a commit f51a214

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

purescript-font-lock.el

+2-2
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ Returns keywords suitable for `font-lock-keywords'."
177177
;; record fields or other identifiers.
178178
(toplevel-keywords
179179
(rx line-start (zero-or-more whitespace)
180-
(group (or "type" "module" "import" "data" "class" "newtype"
180+
(group (or "type" "import" "data" "class" "newtype"
181181
"instance" "derive")
182182
word-end)))
183183
;; Reserved identifiers
@@ -186,7 +186,7 @@ Returns keywords suitable for `font-lock-keywords'."
186186
;; spec syntax, but they are not reserved.
187187
;; `_' can go in here since it has temporary word syntax.
188188
(regexp-opt
189-
'("ado" "case" "do" "else" "if" "in" "infix"
189+
'("ado" "case" "do" "else" "if" "in" "infix" "module"
190190
"infixl" "infixr" "let" "of" "then" "where" "_") 'words))
191191

192192
;; Top-level declarations

tests/purescript-font-lock-tests.el

+22
Original file line numberDiff line numberDiff line change
@@ -169,3 +169,25 @@ noncomment
169169
(40 40 nil)
170170
(41 43 font-lock-type-face)
171171
(44 45 nil))))
172+
173+
(ert-deftest module-in-different-locations ()
174+
(purescript-test-ranges
175+
"module React.Basic.Hooks ( Component, module React.Basic
176+
, module Data.Tuple.Nested ) where
177+
"
178+
'((1 6 font-lock-keyword-face)
179+
(7 7 nil)
180+
(8 24 font-lock-type-face)
181+
(25 27 nil)
182+
(28 36 font-lock-type-face)
183+
(37 38 nil)
184+
(39 44 font-lock-keyword-face)
185+
(45 45 nil)
186+
(46 56 font-lock-type-face)
187+
(57 84 nil)
188+
(85 90 font-lock-keyword-face)
189+
(91 91 nil)
190+
(92 108 font-lock-type-face)
191+
(109 111 nil)
192+
(112 116 font-lock-keyword-face)
193+
(117 117 nil))))

0 commit comments

Comments
 (0)