Skip to content

Commit 8be3b95

Browse files
committed
Merge pull request #693 from gracjan/pr-improve-quasiquote
Improve QuasiQuote font lock
2 parents cb063bd + b9b078a commit 8be3b95

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

haskell-font-lock.el

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ that should be commented under LaTeX-style literate scripts."
372372
;; QuasiQuotes opens only when outside of a string or a comment
373373
;; and closes only when inside a quasiquote.
374374
;;
375-
;; (syntax-ppss) returns list with two imteresting elements:
375+
;; (syntax-ppss) returns list with two interesting elements:
376376
;; nth 3. non-nil if inside a string. (it is the character that will
377377
;; terminate the string, or t if the string should be terminated
378378
;; by a generic string delimiter.)
@@ -382,7 +382,7 @@ that should be commented under LaTeX-style literate scripts."
382382
;; Note also that we need to do in in a single pass, hence a regex
383383
;; that covers both the opening and the ending of a quasiquote.
384384

385-
("\\(\\[[[:alnum:]]+\\)?\\(|\\)\\(?:]\\)?"
385+
("\\(\\[[[:alnum:]]+\\)?\\(|\\)\\(]\\)?"
386386
(2 (save-excursion
387387
(goto-char (match-beginning 0))
388388
(if (eq ?\[ (char-after))
@@ -391,10 +391,12 @@ that should be commented under LaTeX-style literate scripts."
391391
(nth 4 (syntax-ppss))
392392
(member (match-string 1)
393393
'("[e" "[t" "[d" "[p")))
394-
"|")
394+
"\"")
395395
;; closing case
396-
(when (eq t (nth 3 (syntax-ppss)))
397-
"|")))))
396+
(when (and (eq ?| (nth 3 (syntax-ppss)))
397+
(equal "]" (match-string 3))
398+
)
399+
"\"")))))
398400
))
399401

400402
(defconst haskell-bird-syntactic-keywords

0 commit comments

Comments
 (0)