From e6e3823982cb9755b7cb4727fb08171eed5b4332 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Thu, 25 Feb 2016 14:26:47 +0100 Subject: Accept trailing newlines --- bbcode/src/Text/BBCode.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'bbcode/src/Text') diff --git a/bbcode/src/Text/BBCode.hs b/bbcode/src/Text/BBCode.hs index d0c9974..f2a9570 100644 --- a/bbcode/src/Text/BBCode.hs +++ b/bbcode/src/Text/BBCode.hs @@ -25,7 +25,7 @@ import Data.Function (on) import Control.Applicative import Text.BBCode.Lexer (BBToken(..), token) -import Data.Attoparsec.Text (parseOnly, endOfInput) +import Data.Attoparsec.Text (parseOnly, endOfInput, endOfLine) import Data.Tree import Data.Tree.Zipper (TreePos, Empty, Full) @@ -72,7 +72,7 @@ instance Exception BBCodeError bbcode :: Text -> Either BBCodeError DomForest -- ^ Parse BBCode -bbcode t = fmap dom $ first LexerError (parseOnly (many token <* endOfInput) t) >>= first TreeError . rose +bbcode t = fmap dom $ first LexerError (parseOnly (many token <* many endOfLine <* endOfInput) t) >>= first TreeError . rose -- | Errors in input encountered during parsing of lexed token-stream data TreeError = MismatchedTags Text Text -- ^ Closing tags label does not match opening tags -- cgit v1.2.3