Skip to content

Commit

Permalink
format escapeDoubleQuoteString
Browse files Browse the repository at this point in the history
  • Loading branch information
soulomoon committed Jan 5, 2022
1 parent da3b1ce commit f97d97d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Nix/Pretty.hs
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,12 @@ pattern t :< ts <- (Text.uncons -> Just (t, ts))
where (:<) = Text.cons

escapeDoubleQuoteString :: Text -> Text
escapeDoubleQuoteString ('"':<xs) = "\\\"" <> escapeDoubleQuoteString xs
escapeDoubleQuoteString ('"':<xs) = "\\\"" <> escapeDoubleQuoteString xs
escapeDoubleQuoteString ('$':<'{':<xs) = "\\${" <> escapeDoubleQuoteString xs
escapeDoubleQuoteString ('$':<xs) = '$' :< escapeDoubleQuoteString xs
escapeDoubleQuoteString (x:<xs) = maybe (one x) (('\\' :<) . one) (toEscapeCode x)
<> escapeDoubleQuoteString xs
escapeDoubleQuoteString a = a
escapeDoubleQuoteString ('$':<xs) = '$' :< escapeDoubleQuoteString xs
escapeDoubleQuoteString (x:<xs) = maybe (one x) (('\\' :<) . one) (toEscapeCode x)
<> escapeDoubleQuoteString xs
escapeDoubleQuoteString a = a


prettyString :: NString (NixDoc ann) -> Doc ann
Expand Down

0 comments on commit f97d97d

Please sign in to comment.