diff options
| author | Gregor Kleen <gkleen@yggdrasil.li> | 2016-02-25 14:26:47 +0100 |
|---|---|---|
| committer | Gregor Kleen <gkleen@yggdrasil.li> | 2016-02-25 14:26:47 +0100 |
| commit | e6e3823982cb9755b7cb4727fb08171eed5b4332 (patch) | |
| tree | e747dbd35b2b8156e0aa2eb8ed63a92d2b3445c3 /bbcode/src | |
| parent | a93837da703767b6a982ead94494df7c885b46f1 (diff) | |
| download | thermoprint-e6e3823982cb9755b7cb4727fb08171eed5b4332.tar thermoprint-e6e3823982cb9755b7cb4727fb08171eed5b4332.tar.gz thermoprint-e6e3823982cb9755b7cb4727fb08171eed5b4332.tar.bz2 thermoprint-e6e3823982cb9755b7cb4727fb08171eed5b4332.tar.xz thermoprint-e6e3823982cb9755b7cb4727fb08171eed5b4332.zip | |
Accept trailing newlines
Diffstat (limited to 'bbcode/src')
| -rw-r--r-- | bbcode/src/Text/BBCode.hs | 4 |
1 files changed, 2 insertions, 2 deletions
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) | |||
| 25 | import Control.Applicative | 25 | import Control.Applicative |
| 26 | 26 | ||
| 27 | import Text.BBCode.Lexer (BBToken(..), token) | 27 | import Text.BBCode.Lexer (BBToken(..), token) |
| 28 | import Data.Attoparsec.Text (parseOnly, endOfInput) | 28 | import Data.Attoparsec.Text (parseOnly, endOfInput, endOfLine) |
| 29 | 29 | ||
| 30 | import Data.Tree | 30 | import Data.Tree |
| 31 | import Data.Tree.Zipper (TreePos, Empty, Full) | 31 | import Data.Tree.Zipper (TreePos, Empty, Full) |
| @@ -72,7 +72,7 @@ instance Exception BBCodeError | |||
| 72 | 72 | ||
| 73 | bbcode :: Text -> Either BBCodeError DomForest | 73 | bbcode :: Text -> Either BBCodeError DomForest |
| 74 | -- ^ Parse BBCode | 74 | -- ^ Parse BBCode |
| 75 | bbcode t = fmap dom $ first LexerError (parseOnly (many token <* endOfInput) t) >>= first TreeError . rose | 75 | bbcode t = fmap dom $ first LexerError (parseOnly (many token <* many endOfLine <* endOfInput) t) >>= first TreeError . rose |
| 76 | 76 | ||
| 77 | -- | Errors in input encountered during parsing of lexed token-stream | 77 | -- | Errors in input encountered during parsing of lexed token-stream |
| 78 | data TreeError = MismatchedTags Text Text -- ^ Closing tags label does not match opening tags | 78 | data TreeError = MismatchedTags Text Text -- ^ Closing tags label does not match opening tags |
