import qualified Data.Char as C
+import Dyna.XXX.Trifecta (renderSpan)
+
------------------------------------------------------------------------}}}
-- Preliminaries {{{
------------------------------------------------------------------------}}}
-- 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)
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 {{{
{-# 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
import Text.Trifecta
import Text.Trifecta.Delta
+import Text.PrettyPrint.Free ((<+>), above, indent)
+
-- import Debug.Trace
-- | Just like ident but without the "token $" prefix
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))