--
-- * Doesn't handle shared subgoals ("whenever ... { ... }")
-{- Header material -} -- {{{
+-- Header material {{{
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE NoMonomorphismRestriction #-}
import Dyna.XXX.Trifecta (identNL)
------------------------------------------------------------------------}}}
-{- * Parsed output definition -} -- {{{
+-- Parsed output definition {{{
data Annotation = AnnType (Spanned Term)
deriving (Eq,Ord,Show)
------------------------------------------------------------------------}}}
-{- * Utilities -} -- {{{
+-- Utilities {{{
bsf :: Functor f => f String -> f B.ByteString
bsf = fmap BU.fromString
------------------------------------------------------------------------}}}
-{- * Identifier Syles -} -- {{{
+-- Identifier Syles {{{
usualpunct :: CS.CharSet
usualpunct = CS.fromList "!#$%&*+/<=>?@\\^|-~:."
------------------------------------------------------------------------}}}
-{- * Comment handling -} -- {{{
+-- Comment handling {{{
dynaCommentStyle :: CommentStyle
dynaCommentStyle = CommentStyle
restOfLine = lift restOfLine
------------------------------------------------------------------------}}}
-{- * Atoms -} -- {{{
+-- Atoms {{{
atom :: (Monad m, TokenParsing m) => m B.ByteString
atom = liftA BU.fromString stringLiteral
<|> (bsf $ ident dynaAtomStyle)
------------------------------------------------------------------------}}}
-{- * Terms and term expressions -} -- {{{
+-- Terms and term expressions {{{
term :: DeltaParsing m => m (Spanned Term)
term = token $ choice
dtexpr = unDL texpr
------------------------------------------------------------------------}}}
-{- * Rules -} -- {{{
+-- Rules {{{
-- | Grab the head (term!) and aggregation operator from a line that
-- we hope is a rule.
drule = spanned rule
------------------------------------------------------------------------}}}
-{- * Lines -} -- {{{
+-- Lines {{{
progline :: DeltaParsing m => m (Spanned Line)
progline = spanned $ choice [ LRule <$> drule