]> hydra-www.ietfng.org Git - dyna2/commitdiff
renderSpan moved to trifecta utils.
authortimv <tim.f.vieira@gmail.com>
Wed, 12 Dec 2012 02:45:47 +0000 (21:45 -0500)
committertimv <tim.f.vieira@gmail.com>
Wed, 12 Dec 2012 02:45:47 +0000 (21:45 -0500)
src/Dyna/Analysis/ANF.hs
src/Dyna/Backend/Python.hs
src/Dyna/XXX/Trifecta.hs

index 242c04ca2e5fd0e4cdb1b08e70f3cf2431956b44..41f1e56bb4c6d7a7e13b4d840fa6274c7d9c0460 100644 (file)
@@ -91,6 +91,8 @@ import           Dyna.XXX.PPrint (valign)
 
 import qualified Data.Char as C
 
+import Dyna.XXX.Trifecta (renderSpan)
+
 ------------------------------------------------------------------------}}}
 -- Preliminaries                                                        {{{
 
@@ -387,10 +389,11 @@ runNormalize =
 ------------------------------------------------------------------------}}}
 -- Pretty Printer                                                       {{{
 
-printANF :: FRule -> Doc e
+printANF :: FRule -> Doc T.Effect
 printANF (FRule h a s result span
             (AS {as_evals = evals, as_assgn = assgn, as_unifs = unifs})) =
- ";;" <+> (text $ show span) `above` (
+ --";;" <+> (renderSpan span) `above` 
+ (
    parens $ (pretty a)
             <+> valign [ (pretty h)
                        , parens $ text "side"   <+> (valign $ map pretty s)
index 0207762836f9bc9491613abb11ef393bb6390d8c..9abe78cf5a2a4141ae3e5ff2859a514f1c7514e0 100644 (file)
@@ -40,15 +40,8 @@ import           System.IO
 import           Text.PrettyPrint.Free
 import qualified Text.Trifecta              as T
 
-------------------------------------------------------------------------}}}
--- Utilities                                                            {{{
-
-renderSpan (T.Span s e bs) =
-       T.prettyTerm s
-   <+> char '-'
-   <+> T.prettyTerm e
-   <+> colon
-   `above` (indent 2 (T.prettyTerm $ T.rendering s bs))
+import Dyna.XXX.Trifecta (renderSpan)
+
 
 ------------------------------------------------------------------------}}}
 -- Top Level Exceptions                                                 {{{
index dd5a51748f6b8ea8a6c52457e37e2b787beab650..a6ba7abec6b43496b831fd82fb56f5f70cf61d09 100644 (file)
@@ -1,8 +1,9 @@
 {-# LANGUAGE RankNTypes #-}
+{-# LANGUAGE OverloadedStrings #-}
 -- XXX contribute back to trifecta
 
 module Dyna.XXX.Trifecta (
-    identNL, pureSpanned, stringLiteralSQ, triInteract
+    identNL, pureSpanned, stringLiteralSQ, triInteract, renderSpan
 ) where
 
 import           Control.Applicative
@@ -17,6 +18,8 @@ import           Text.Parser.Token.Highlight
 import           Text.Trifecta
 import           Text.Trifecta.Delta
 
+import           Text.PrettyPrint.Free ((<+>), above, indent)
+
 -- import Debug.Trace
 
 -- | Just like ident but without the "token $" prefix
@@ -115,3 +118,12 @@ triInteract p c s f i = loop (feed (BU.fromString i) $ stepParser (release dd *>
      dd = Directed (BU.fromString "interactive") 0 0 0 0
 
 
+------------------------------------------------------------------------}}}
+-- Utilities                                                            {{{
+
+renderSpan (Span s e bs) =
+       prettyTerm s
+   <+> "-"
+   <+> prettyTerm e
+   <+> ":"
+   `above` (indent 2 (prettyTerm $ rendering s bs))