diff --git a/compiler/GHC/Driver/MultilineStrings.hs b/compiler/GHC/Driver/MultilineStrings.hs index d9a6378140590a26c36b3f764e01d94864121d81..ec36aa65d7ee33dcb6bd9d205f9788dd8b1d88bd 100644 --- a/compiler/GHC/Driver/MultilineStrings.hs +++ b/compiler/GHC/Driver/MultilineStrings.hs @@ -17,10 +17,16 @@ convertMultilineStrings s = go s WaitingForString 0 InString -> case s of "" -> error "we are in a mutline string, but text ended unexpectedly" '\n':'"':'"':'"':s -> '"':'\n' : go s WaitingForString 0 + '#':'{':s -> '#':'{' : go s InInterpolationSection charCnt '"':s -> '\\':'"' : go s state charCnt '\\':s -> '\\':'\\' : go s state charCnt '\n':s -> "\\n\"\n" ++ replicate charCnt ' ' ++ "++ \"" ++ go s state charCnt c:s -> c : go s state charCnt + InInterpolationSection -> case s of + '\n':_ -> error "we are in an interpolation section in mutline string, but text line ended unexpectedly" + '}':s -> '}' : go s InString charCnt + c:s -> c : go s state charCnt + where skipOneLineComment "" = go "" state charCnt skipOneLineComment s@('\n':_) = go s state charCnt @@ -33,3 +39,4 @@ convertMultilineStrings s = go s WaitingForString 0 data State = WaitingForString | InString + | InInterpolationSection