Skip to content

Improve QuasiQuote font lock #693

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 4, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions haskell-font-lock.el
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ that should be commented under LaTeX-style literate scripts."
;; QuasiQuotes opens only when outside of a string or a comment
;; and closes only when inside a quasiquote.
;;
;; (syntax-ppss) returns list with two imteresting elements:
;; (syntax-ppss) returns list with two interesting elements:
;; nth 3. non-nil if inside a string. (it is the character that will
;; terminate the string, or t if the string should be terminated
;; by a generic string delimiter.)
Expand All @@ -382,7 +382,7 @@ that should be commented under LaTeX-style literate scripts."
;; Note also that we need to do in in a single pass, hence a regex
;; that covers both the opening and the ending of a quasiquote.

("\\(\\[[[:alnum:]]+\\)?\\(|\\)\\(?:]\\)?"
("\\(\\[[[:alnum:]]+\\)?\\(|\\)\\(]\\)?"
(2 (save-excursion
(goto-char (match-beginning 0))
(if (eq ?\[ (char-after))
Expand All @@ -391,10 +391,12 @@ that should be commented under LaTeX-style literate scripts."
(nth 4 (syntax-ppss))
(member (match-string 1)
'("[e" "[t" "[d" "[p")))
"|")
"\"")
;; closing case
(when (eq t (nth 3 (syntax-ppss)))
"|")))))
(when (and (eq ?| (nth 3 (syntax-ppss)))
(equal "]" (match-string 3))
)
"\"")))))
))

(defconst haskell-bird-syntactic-keywords
Expand Down