interpolatedstring-perl6 0.5 → 0.6
raw patch · 3 files changed
+6/−6 lines, 3 files
Files
interpolatedstring-perl6.cabal view
@@ -1,5 +1,5 @@ Name: interpolatedstring-perl6-Version: 0.5+Version: 0.6 License: BSD3 License-file: LICENSE Category: Data
src/Text/InterpolatedString/Perl6.hs view
@@ -156,10 +156,10 @@ parseQC a (x:xs) = parseQC (x:a) xs unQQ a [] = [Literal (reverse a)]-unQQ a ('\\':x:xs) = unQC (x:a) xs-unQQ a ('\\':[]) = unQC ('\\':a) []+unQQ a ('\\':x:xs) = unQQ (x:a) xs+unQQ a ('\\':[]) = unQQ ('\\':a) [] unQQ a ('}':xs) = AntiQuote (reverse a) : parseQQ [] xs-unQQ a (x:xs) = unQC (x:a) xs+unQQ a (x:xs) = unQQ (x:a) xs parseQQ a [] = [Literal (reverse a)] parseQQ a ('\\':x:xs) = parseQQ (x:a) xs@@ -168,7 +168,7 @@ Literal (reverse a) : AntiQuote (x:pre) : parseQQ [] post where (pre, post) = span isIdent xs-parseQQ a ('{':xs) = Literal (reverse a) : unQC [] xs+parseQQ a ('{':xs) = Literal (reverse a) : unQQ [] xs parseQQ a (x:xs) = parseQQ (x:a) xs isIdent '_' = True
tests/Test.hs view
@@ -12,7 +12,7 @@ testEmpty = assertBool "" ([$qc||] == "") testCharLiteral = assertBool "" ([$qc|{1+2}|] == "3") testString = assertBool "" ([$qc|a string {t1} is here|] == "a string 字元 is here")-testVariable = assertBool "" ([$qq|a string $t1 is here|] == "a string 字元 is here")+testVariable = assertBool "" ([$qq|a string {t1} $t1 {t1} $t1 is here|] == "a string 字元 字元 字元 字元 is here") testEscape = assertBool "" ([$qc|#\{}|] == "#{}" && [$qc|\{}|] == "{}") testComplex = assertBool "" ([$qc| ok