Fix bypassed error message for lines + add one for occurrences

This commit is contained in:
Tissevert 2019-05-31 15:06:20 +02:00
parent 11cb6504d7
commit 85e4eb9273
2 changed files with 4 additions and 3 deletions

View File

@ -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 =

View File

@ -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-"