Skip to content

Commit 866e81e

Browse files
committed
Take into account a doc-comment may lack space before bar
Credits for finding solution to Anders Lindgren at Lindydancer/font-lock-studio#10 Fixes: #16
1 parent 12c4d60 commit 866e81e

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

purescript-font-lock.el

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ that should be commented under LaTeX-style literate scripts."
326326
("\\s_\\{3,\\}" (0 (cond ((numberp (nth 4 (syntax-ppss)))
327327
;; There are no such instances inside nestable comments
328328
nil)
329-
((string-match "\\`-*\\'" (match-string 0))
329+
((string-match "\\`-*|?\\'" (match-string 0))
330330
;; Sequence of hyphens. Do nothing in
331331
;; case of things like `{---'.
332332
nil)
@@ -376,7 +376,7 @@ that should be commented under LaTeX-style literate scripts."
376376
((and purescript-font-lock-docstrings
377377
(save-excursion
378378
(goto-char (nth 8 state))
379-
(looking-at "\\(-- \\|{-\\)[ \\t]*[|^]")))
379+
(looking-at "\\(--\\|{-\\)[ \\t]*[|^]")))
380380
'font-lock-doc-face)
381381
(t 'font-lock-comment-face)))
382382

tests/purescript-font-lock-tests.el

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,11 @@ this = \"still a string\"
101101

102102
(ert-deftest docs-bar-comment-different-spacings ()
103103
(purescript-test-ranges
104-
"-- | Docs comment 1 space
104+
"--| Docs comment 0 space
105+
-- | Docs comment 1 space
105106
-- | Docs comment many spaces
106107
"
107-
'((1 57 font-lock-doc-face))))
108+
'((1 85 font-lock-doc-face))))
108109

109110
(ert-deftest docs-bar-comment-continuation ()
110111
"Acc. to

0 commit comments

Comments
 (0)