From 539b69b3e3b0c4ffee2323a8fe6239ebda4af48c Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Fri, 15 Jan 2016 04:24:57 +0000 Subject: predictive documentation --- spec/src/Thermoprint/Printout/BBCode.hs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'spec/src') diff --git a/spec/src/Thermoprint/Printout/BBCode.hs b/spec/src/Thermoprint/Printout/BBCode.hs index f80f780..cee36b8 100644 --- a/spec/src/Thermoprint/Printout/BBCode.hs +++ b/spec/src/Thermoprint/Printout/BBCode.hs @@ -1,6 +1,7 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE DeriveGeneric #-} +-- | Use 'Text.BBCode' to parse BBCode module Thermoprint.Printout.BBCode ( bbcode , BBCodeError(..) @@ -14,6 +15,9 @@ import qualified Data.Text as T (unpack) import Data.Map (Map) import qualified Data.Map as Map (lookup) +import Data.Sequence (Seq) +import qualified Data.Sequence as Seq () + import Data.CaseInsensitive (CI) import qualified Data.CaseInsensitive as CI @@ -41,13 +45,14 @@ data BBCodeError = LexerError String -- ^ Error while parsing input to stream of instance Exception BBCodeError -data SemanticError = BlockTagInLineContext Text - | UnmappedTag Text +-- ^ An error ocurred while parsing the DOM-Forest (`['DomTree']`) +data SemanticError = UnmappedTag Text -- ^ An `Element` does not map to any structure in the context it occurred in deriving (Show, Eq, Generic, Typeable) instance Exception SemanticError bbcode :: Text -> Either BBCodeError Printout +-- ^ Parse BBCode bbcode = join . fmap (first SemanticError) . bimap morph' morph . Raw.bbcode morph' :: Raw.BBCodeError -> BBCodeError -- cgit v1.2.3