Skip to content

Commit 165ed40

Browse files
committed
font-lock: "foreign import" can't be preceded by text on the line
1 parent 5532b19 commit 165ed40

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

purescript-font-lock.el

+2-1
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,8 @@ Returns keywords suitable for `font-lock-keywords'."
224224

225225
(,reservedsym 1 (symbol-value 'purescript-operator-face))
226226
;; Case for `foreign import'
227-
("\\<\\(foreign\\)[ \t]+\\(import\\>\\)"
227+
(,(rx line-start (0+ whitespace)
228+
(group "foreign") (1+ whitespace) (group "import") word-end)
228229
(1 (symbol-value 'purescript-keyword-face) nil lax)
229230
(2 (symbol-value 'purescript-keyword-face) nil lax))
230231

tests/purescript-font-lock-tests.el

+7-1
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,8 @@ foreign import func3
312312
foreign import
313313
func4 :: Effect Int
314314
foreign import func5 -- invalid indentation, but allowed in other context
315+
invalid_dont_highlight foreign import func6
316+
foreign importinvalid
315317
"
316318
'((1 7 font-lock-keyword-face)
317319
(8 8 nil)
@@ -348,4 +350,8 @@ foreign import
348350
(120 125 font-lock-keyword-face)
349351
(126 132 nil)
350352
(133 135 font-lock-comment-delimiter-face)
351-
(136 185 font-lock-comment-face))))
353+
(136 185 font-lock-comment-face)
354+
(186 207 font-lock-function-name-face)
355+
(208 229 nil)
356+
(230 236 font-lock-function-name-face)
357+
(237 251 nil))))

0 commit comments

Comments
 (0)