diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Data/BEncode.hs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/Data/BEncode.hs b/src/Data/BEncode.hs index 086d34f..6b26ee5 100644 --- a/src/Data/BEncode.hs +++ b/src/Data/BEncode.hs | |||
@@ -786,20 +786,20 @@ parser = valueP | |||
786 | case c of | 786 | case c of |
787 | -- if we have digit it always should be string length | 787 | -- if we have digit it always should be string length |
788 | di | di <= '9' -> BString <$> stringP | 788 | di | di <= '9' -> BString <$> stringP |
789 | 'i' -> P.anyChar *> ((BInteger <$> integerP) <* P.anyChar) | 789 | 'i' -> P.anyChar *> ((BInteger <$> integerP) <* P.anyChar) |
790 | 'l' -> P.anyChar *> ((BList <$> listBody) <* P.anyChar) | 790 | 'l' -> P.anyChar *> ((BList <$> listBodyP) <* P.anyChar) |
791 | 'd' -> P.anyChar *> (BDict <$> dictBodyP)<* P.anyChar | 791 | 'd' -> P.anyChar *> (BDict <$> dictBodyP) <* P.anyChar |
792 | t -> fail ("bencode unknown tag: " ++ [t]) | 792 | t -> fail ("bencode unknown tag: " ++ [t]) |
793 | 793 | ||
794 | dictBodyP :: Parser BDict | 794 | dictBodyP :: Parser BDict |
795 | dictBodyP = Cons <$> stringP <*> valueP <*> dictBodyP | 795 | dictBodyP = Cons <$> stringP <*> valueP <*> dictBodyP |
796 | <|> pure Nil | 796 | <|> pure Nil |
797 | 797 | ||
798 | listBody = do | 798 | listBodyP = do |
799 | c <- P.peekChar | 799 | c <- P.peekChar |
800 | case c of | 800 | case c of |
801 | Just 'e' -> return [] | 801 | Just 'e' -> return [] |
802 | _ -> (:) <$> valueP <*> listBody | 802 | _ -> (:) <$> valueP <*> listBodyP |
803 | 803 | ||
804 | stringP :: Parser ByteString | 804 | stringP :: Parser ByteString |
805 | stringP = do | 805 | stringP = do |