aboutsummaryrefslogtreecommitdiff
path: root/bbcode/src/Text/BBCode/Lexer.hs
diff options
context:
space:
mode:
Diffstat (limited to 'bbcode/src/Text/BBCode/Lexer.hs')
-rw-r--r--bbcode/src/Text/BBCode/Lexer.hs5
1 files changed, 4 insertions, 1 deletions
diff --git a/bbcode/src/Text/BBCode/Lexer.hs b/bbcode/src/Text/BBCode/Lexer.hs
index ad26113..2eb0022 100644
--- a/bbcode/src/Text/BBCode/Lexer.hs
+++ b/bbcode/src/Text/BBCode/Lexer.hs
@@ -29,9 +29,12 @@ data BBToken = BBOpen Text [(Text, Maybe Text)] -- ^ Tag open with attributes
29token :: Parser BBToken 29token :: Parser BBToken
30-- ^ Tokenizer 30-- ^ Tokenizer
31token = BBClose <$> ("[/" *> escapedText' [']'] <* "]") 31token = BBClose <$> ("[/" *> escapedText' [']'] <* "]")
32 <|> BBOpen <$> ("[" *> escapedText' [']', ' ']) <*> (option [] attrs <* "]") 32 <|> uncurry BBOpen <$> openTag
33 <|> BBStr <$> escapedText ['['] 33 <|> BBStr <$> escapedText ['[']
34 34
35openTag :: Parser (Text, [(Text, Maybe Text)])
36openTag = (,) <$> ("[" *> escapedText' [']', ' ']) <*> (option [] attrs <* "]")
37
35attrs :: Parser [(Text, Maybe Text)] 38attrs :: Parser [(Text, Maybe Text)]
36attrs = (:) <$> (attrs' <* takeWhile isSpace) <*> (option [] $ attrs) 39attrs = (:) <$> (attrs' <* takeWhile isSpace) <*> (option [] $ attrs)
37 where 40 where