Skip to content

Commit dc4cea0

Browse files
committed
Restore module in non-toplevel and test that
1 parent c1492bd commit dc4cea0

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

purescript-font-lock.el

Lines changed: 2 additions & 2 deletions
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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,3 +154,25 @@ still comment
154154
(40 40 nil)
155155
(41 43 font-lock-type-face)
156156
(44 45 nil))))
157+
158+
(ert-deftest module-in-different-locations ()
159+
(purescript-test-ranges
160+
"module React.Basic.Hooks ( Component, module React.Basic
161+
, module Data.Tuple.Nested) where
162+
"
163+
'((1 6 font-lock-keyword-face)
164+
(7 7 nil)
165+
(8 24 font-lock-type-face)
166+
(25 27 nil)
167+
(28 36 font-lock-type-face)
168+
(37 38 nil)
169+
(39 44 font-lock-keyword-face)
170+
(45 45 nil)
171+
(46 56 font-lock-type-face)
172+
(57 84 nil)
173+
(85 90 font-lock-keyword-face)
174+
(91 91 nil)
175+
(92 108 font-lock-type-face)
176+
(109 110 nil)
177+
(111 115 font-lock-keyword-face)
178+
(116 116 nil))))

0 commit comments

Comments
 (0)