Skip to content

Commit f5271a7

Browse files
author
Artyom
committed
Treat insides of quasiquotes as strings
Fixes #1189
1 parent f73b1ce commit f5271a7

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

haskell-mode.el

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,13 @@ executable found in PATH.")
587587
(put-text-property (match-beginning 3) (1+ (match-end 3)) 'syntax-table (string-to-syntax "|")))))
588588
((equal token-kind 'template-haskell-quasi-quote)
589589
(put-text-property (match-beginning 2) (match-end 2) 'syntax-table (string-to-syntax "\""))
590-
(put-text-property (match-beginning 4) (match-end 4) 'syntax-table (string-to-syntax "\""))))
590+
(put-text-property (match-beginning 4) (match-end 4) 'syntax-table (string-to-syntax "\""))
591+
(save-excursion
592+
(goto-char (match-beginning 3))
593+
(let ((limit (match-end 3)))
594+
(save-match-data
595+
(while (re-search-forward "\"" limit t)
596+
(put-text-property (match-beginning 0) (match-end 0) 'syntax-table (string-to-syntax "."))))))))
591597
(if token-kind
592598
(goto-char (match-end 0))
593599
(goto-char end)))))))

tests/haskell-indentation-tests.el

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -656,13 +656,23 @@ test = [randomQQ| This is
656656
"
657657
(4 0 2))
658658

659-
(hindent-test "29c* quasiquote with quotes in it and a string outside" "
659+
(hindent-test "29c quasiquote with quotes in it and a string outside" "
660660
foo = do
661661
let bar = [text|\"some text\"|]
662662
button \"Cancel\" $ do
663663
"
664664
(4 4))
665665

666+
(hindent-test "29d unfinished quasiquote" "
667+
foo = [text|some
668+
"
669+
(2 0 11))
670+
671+
(hindent-test "29e an expression quotation" "
672+
foo = [|forever $ do
673+
"
674+
(2 10))
675+
666676
(hindent-test "30* parse '[] identifier correctly" "
667677
instance Callable '[]
668678
"

0 commit comments

Comments
 (0)