X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2FhsSyn%2FHsPat.lhs;h=266cff2aa02f6c29307fd7d9ff864792491b3869;hp=87f471788129a863aa9cdd745925449dac66f919;hb=f3399c446c7507d46d6cc550aa2fe7027dbc1b5b;hpb=206b4dec78250efef3cd927d64dc6cbc54a16c3d diff --git a/compiler/hsSyn/HsPat.lhs b/compiler/hsSyn/HsPat.lhs index 87f4717..266cff2 100644 --- a/compiler/hsSyn/HsPat.lhs +++ b/compiler/hsSyn/HsPat.lhs @@ -19,6 +19,8 @@ module HsPat ( HsConPatDetails, hsConPatArgs, HsRecFields(..), HsRecField(..), hsRecFields, + HsQuasiQuote(..), + mkPrefixConPat, mkCharLitPat, mkNilPat, mkCoPat, mkCoPatCoI, isBangHsBind, @@ -46,6 +48,7 @@ import TyCon import Outputable import Type import SrcLoc +import FastString \end{code} @@ -113,6 +116,10 @@ data Pat id -- (= the argument type of the view function) -- for hsPatType. + ------------ Quasiquoted patterns --------------- + -- See Note [Quasi-quote overview] in TcSplice + | QuasiQuotePat (HsQuasiQuote id) + ------------ Literal and n+k patterns --------------- | LitPat HsLit -- Used for *non-overloaded* literal patterns: -- Int#, Char#, Int, Char, String, etc. @@ -200,6 +207,14 @@ hsRecFields :: HsRecFields id arg -> [id] hsRecFields rbinds = map (unLoc . hsRecFieldId) (rec_flds rbinds) \end{code} +\begin{code} +data HsQuasiQuote id = HsQuasiQuote + id + id + SrcSpan + FastString +\end{code} + %************************************************************************ %* * @@ -247,6 +262,10 @@ pprPat (LitPat s) = ppr s pprPat (NPat l Nothing _) = ppr l pprPat (NPat l (Just _) _) = char '-' <> ppr l pprPat (NPlusKPat n k _ _) = hcat [ppr n, char '+', ppr k] +pprPat (QuasiQuotePat (HsQuasiQuote name quoter _ quote)) + = char '$' <> brackets (ppr name) <> + ptext SLIT("[:") <> ppr quoter <> ptext SLIT("|") <> + ppr quote <> ptext SLIT("|]") pprPat (TypePat ty) = ptext SLIT("{|") <> ppr ty <> ptext SLIT("|}") pprPat (CoPat co pat _) = parens (pprHsWrapper (ppr pat) co) pprPat (SigPatIn pat ty) = ppr pat <+> dcolon <+> ppr ty