aboutsummaryrefslogtreecommitdiff
path: root/bbcode
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2016-01-12 01:02:14 +0000
committerGregor Kleen <gkleen@yggdrasil.li>2016-01-12 01:02:14 +0000
commitc1da385941598c8e31f0e3b72f34797afe964bc9 (patch)
tree149ba6405414360d83f24f1aab6c3a2644c67510 /bbcode
parentfea4f8690111a8bbb65845fb61961cfc0a9802cc (diff)
downloadthermoprint-c1da385941598c8e31f0e3b72f34797afe964bc9.tar
thermoprint-c1da385941598c8e31f0e3b72f34797afe964bc9.tar.gz
thermoprint-c1da385941598c8e31f0e3b72f34797afe964bc9.tar.bz2
thermoprint-c1da385941598c8e31f0e3b72f34797afe964bc9.tar.xz
thermoprint-c1da385941598c8e31f0e3b72f34797afe964bc9.zip
minor code cleanup
Diffstat (limited to 'bbcode')
-rw-r--r--bbcode/src/Text/BBCode/Lexer.hs9
-rw-r--r--bbcode/test/Text/BBCode/LexerSpec.hs2
2 files changed, 3 insertions, 8 deletions
diff --git a/bbcode/src/Text/BBCode/Lexer.hs b/bbcode/src/Text/BBCode/Lexer.hs
index 01f47f0..a7294fe 100644
--- a/bbcode/src/Text/BBCode/Lexer.hs
+++ b/bbcode/src/Text/BBCode/Lexer.hs
@@ -12,20 +12,15 @@ module Text.BBCode.Lexer
12import Data.Attoparsec.Text 12import Data.Attoparsec.Text
13 13
14import Data.Text (Text) 14import Data.Text (Text)
15import qualified Data.Text as T (singleton, head, last, tail, null) 15import qualified Data.Text as T (singleton)
16 16
17import Control.Applicative 17import Control.Applicative
18 18
19import Test.QuickCheck (Arbitrary(..), CoArbitrary, genericShrink)
20import Test.QuickCheck.Gen (oneof, suchThat)
21import Test.QuickCheck.Instances
22import GHC.Generics (Generic)
23
24-- | Our lexicographical unit 19-- | Our lexicographical unit
25data BBToken = BBOpen Text -- ^ Tag open 20data BBToken = BBOpen Text -- ^ Tag open
26 | BBClose Text -- ^ Tag close 21 | BBClose Text -- ^ Tag close
27 | BBStr Text -- ^ Content of a tag 22 | BBStr Text -- ^ Content of a tag
28 deriving (Generic, Eq, Show) 23 deriving (Eq, Show)
29 24
30token :: Parser BBToken 25token :: Parser BBToken
31-- ^ Tokenizer 26-- ^ Tokenizer
diff --git a/bbcode/test/Text/BBCode/LexerSpec.hs b/bbcode/test/Text/BBCode/LexerSpec.hs
index 8b95874..b0b77d9 100644
--- a/bbcode/test/Text/BBCode/LexerSpec.hs
+++ b/bbcode/test/Text/BBCode/LexerSpec.hs
@@ -44,7 +44,7 @@ spec = do
44 zipWithM_ example [1..] examples 44 zipWithM_ example [1..] examples
45 where 45 where
46 example n (s, ts) = let str = "Example " <> show n 46 example n (s, ts) = let str = "Example " <> show n
47 in specify str $ (tokenize s == Right ts) 47 in specify str (tokenize s == Right ts)
48 48
49prop_token :: Text -> Property 49prop_token :: Text -> Property
50-- ^ prop> (mconcat . map coToken) <$> tokenize x == Right x 50-- ^ prop> (mconcat . map coToken) <$> tokenize x == Right x