From 85e4eb927395e066af6fce8c691f306919df4a09 Mon Sep 17 00:00:00 2001 From: Tissevert Date: Fri, 31 May 2019 15:06:20 +0200 Subject: [PATCH] Fix bypassed error message for lines + add one for occurrences --- src/PDF/Body.hs | 5 +++-- src/PDF/Object.hs | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/PDF/Body.hs b/src/PDF/Body.hs index 53fa6f0..d8903d7 100644 --- a/src/PDF/Body.hs +++ b/src/PDF/Body.hs @@ -17,7 +17,7 @@ import PDF.Object ( , Structure(..), XRefEntry(..), XRefSection, XRefSubSection(..) , blank, dictionary, directObject, integer, line ) -import PDF.Parser (Parser, block, char, on, runParser, takeAll) +import PDF.Parser (Parser, (), block, char, on, option, runParser, takeAll) data UserState = UserState { input :: ByteString @@ -110,7 +110,8 @@ indirectObjCoordinates = do return coordinates occurrence :: SParser Occurrence -occurrence = Comment <$> comment <|> Indirect <$> indirectObjCoordinates +occurrence = + Comment <$> comment <|> Indirect <$> indirectObjCoordinates "comment or object" populate :: ByteString -> InputStructure -> Content populate input structure = diff --git a/src/PDF/Object.hs b/src/PDF/Object.hs index 17c37e4..d224a1c 100644 --- a/src/PDF/Object.hs +++ b/src/PDF/Object.hs @@ -46,7 +46,7 @@ import PDF.Parser ( import Text.Printf (printf) line :: String -> Parser u () -line l = string (BS.pack l) *> EOL.parser *> return () printf "line «%s»" l +line l = (string (BS.pack l) *> EOL.parser *> return ()) printf "line «%s»" l magicNumber :: ByteString magicNumber = "%PDF-"