{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE PackageImports #-}
{-# LANGUAGE ViewPatterns #-}
module Text.InterpolatedString.QM.Internal.Parsers
( qm, qn
, qmb, qnb
, qms, qns
) where
import qualified "template-haskell" Language.Haskell.TH as TH
import Text.InterpolatedString.QM.Internal.Parsers.TH (parserTpl)
import Text.InterpolatedString.QM.Internal.Parsers.Types ( Parser
, StringPart (..)
, LineBreaks (..)
)
import Text.InterpolatedString.QM.Internal.Parsers.Helpers
( unQX
, clearIndentAtStart
, clearIndentAtSOF
, clearIndentTillEOF
, clearFirstQXXLineBreak
, clearLastQXXLineBreak
, makeExpr
)
$(parserTpl "parseQM" True IgnoreLineBreaks)
$(parserTpl "parseQN" False IgnoreLineBreaks)
$(parserTpl "parseQMB" True KeepLineBreaks)
$(parserTpl "parseQNB" False KeepLineBreaks)
$(parserTpl "parseQMS" True ReplaceLineBreaksWithSpaces)
$(parserTpl "parseQNS" False ReplaceLineBreaksWithSpaces)
qm :: String -> TH.ExpQ
qm :: [Char] -> ExpQ
qm = [StringPart] -> ExpQ
makeExpr ([StringPart] -> ExpQ)
-> ([Char] -> [StringPart]) -> [Char] -> ExpQ
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Parser
parseQM [Char]
"" ([Char] -> [StringPart])
-> ([Char] -> [Char]) -> [Char] -> [StringPart]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Char] -> [Char]
clearIndentAtStart
qn :: String -> TH.ExpQ
qn :: [Char] -> ExpQ
qn = [StringPart] -> ExpQ
makeExpr ([StringPart] -> ExpQ)
-> ([Char] -> [StringPart]) -> [Char] -> ExpQ
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Parser
parseQN [Char]
"" ([Char] -> [StringPart])
-> ([Char] -> [Char]) -> [Char] -> [StringPart]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Char] -> [Char]
clearIndentAtStart
qmb :: String -> TH.ExpQ
qmb :: [Char] -> ExpQ
qmb = [StringPart] -> ExpQ
makeExpr
([StringPart] -> ExpQ)
-> ([Char] -> [StringPart]) -> [Char] -> ExpQ
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Parser
parseQMB [Char]
""
([Char] -> [StringPart])
-> ([Char] -> [Char]) -> [Char] -> [StringPart]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Char] -> [Char]
clearFirstQXXLineBreak
([Char] -> [Char]) -> ([Char] -> [Char]) -> [Char] -> [Char]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Char] -> [Char]
clearIndentAtStart
qnb :: String -> TH.ExpQ
qnb :: [Char] -> ExpQ
qnb = [StringPart] -> ExpQ
makeExpr
([StringPart] -> ExpQ)
-> ([Char] -> [StringPart]) -> [Char] -> ExpQ
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Parser
parseQNB [Char]
""
([Char] -> [StringPart])
-> ([Char] -> [Char]) -> [Char] -> [StringPart]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Char] -> [Char]
clearFirstQXXLineBreak
([Char] -> [Char]) -> ([Char] -> [Char]) -> [Char] -> [Char]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Char] -> [Char]
clearIndentAtStart
qms :: String -> TH.ExpQ
qms :: [Char] -> ExpQ
qms = [StringPart] -> ExpQ
makeExpr
([StringPart] -> ExpQ)
-> ([Char] -> [StringPart]) -> [Char] -> ExpQ
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Parser
parseQMS [Char]
""
([Char] -> [StringPart])
-> ([Char] -> [Char]) -> [Char] -> [StringPart]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Char] -> [Char]
clearFirstQXXLineBreak
([Char] -> [Char]) -> ([Char] -> [Char]) -> [Char] -> [Char]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Char] -> [Char]
clearIndentAtStart
qns :: String -> TH.ExpQ
qns :: [Char] -> ExpQ
qns = [StringPart] -> ExpQ
makeExpr
([StringPart] -> ExpQ)
-> ([Char] -> [StringPart]) -> [Char] -> ExpQ
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Parser
parseQNS [Char]
""
([Char] -> [StringPart])
-> ([Char] -> [Char]) -> [Char] -> [StringPart]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Char] -> [Char]
clearFirstQXXLineBreak
([Char] -> [Char]) -> ([Char] -> [Char]) -> [Char] -> [Char]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Char] -> [Char]
clearIndentAtStart