Hello community, here is the log from the commit of package ghc-parsec for openSUSE:Factory checked in at 2015-05-21 08:11:54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-parsec (Old) and /work/SRC/openSUSE:Factory/.ghc-parsec.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-parsec" Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-parsec/ghc-parsec.changes 2014-11-26 20:55:01.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.ghc-parsec.new/ghc-parsec.changes 2015-05-21 08:11:55.000000000 +0200 @@ -1,0 +2,17 @@ +Sat Apr 11 19:30:19 UTC 2015 - [email protected] + +- update to 3.1.9 +* Add an 'Eq' instance for 'ParseError' +* Fixed a regression from 3.1.6: 'runP' is again exported from module + Text.Parsec. +* Fix a regression from 3.1.6 related to exports from the main module. +* Fix a regression from 3.1.6 related to the reported position of error messages. +* Reset the current error position on success of 'lookAhead'. +* Export 'Text' instances from Text.Parsec +* Make Text.Parsec exports more visible +* Re-arrange Text.Parsec exports +* Add functions 'crlf' and 'endOfLine' to Text.Parsec.Char for handling + input streams that do not have normalized line terminators. +* Fix off-by-one error in Token.charControl + +------------------------------------------------------------------- Old: ---- parsec-3.1.5.tar.gz New: ---- parsec-3.1.9.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-parsec.spec ++++++ --- /var/tmp/diff_new_pack.9gldtO/_old 2015-05-21 08:11:56.000000000 +0200 +++ /var/tmp/diff_new_pack.9gldtO/_new 2015-05-21 08:11:56.000000000 +0200 @@ -1,7 +1,7 @@ # # spec file for package ghc-parsec # -# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -19,7 +19,7 @@ %global pkg_name parsec Name: ghc-parsec -Version: 3.1.5 +Version: 3.1.9 Release: 0 Summary: Monadic parser combinators License: BSD-3-Clause ++++++ parsec-3.1.5.tar.gz -> parsec-3.1.9.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/parsec-3.1.5/CHANGES new/parsec-3.1.9/CHANGES --- old/parsec-3.1.5/CHANGES 2014-01-11 07:13:34.000000000 +0100 +++ new/parsec-3.1.9/CHANGES 2015-03-22 02:13:17.000000000 +0100 @@ -1,3 +1,30 @@ +3.1.9 + +- Many and various updates to documentation and package description (inlcuding + the homepage links). +- Add an 'Eq' instance for 'ParseError' +- Fixed a regression from 3.1.6: 'runP' is again exported from module + Text.Parsec. + +3.1.8 + +- Fix a regression from 3.1.6 related to exports from the main module. + +3.1.7 + +- Fix a regression from 3.1.6 related to the reported position of error messages. + See bug #9 for details. +- Reset the current error position on success of 'lookAhead'. + +3.1.6 + +- Export 'Text' instances from Text.Parsec +- Make Text.Parsec exports more visible +- Re-arrange Text.Parsec exports +- Add functions 'crlf' and 'endOfLine' to Text.Parsec.Char for handling + input streams that do not have normalized line terminators. +- Fix off-by-one error in Token.charControl + 3.1.4 & 3.1.5 - Bump dependency on 'text' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/parsec-3.1.5/Text/Parsec/ByteString/Lazy.hs new/parsec-3.1.9/Text/Parsec/ByteString/Lazy.hs --- old/parsec-3.1.5/Text/Parsec/ByteString/Lazy.hs 2014-01-11 07:13:34.000000000 +0100 +++ new/parsec-3.1.9/Text/Parsec/ByteString/Lazy.hs 2015-03-22 02:13:17.000000000 +0100 @@ -8,13 +8,10 @@ -- Stability : provisional -- Portability : portable -- --- Make lazy ByteStrings an instance of 'Stream' with 'Char' token type. +-- Convinience definitions for working with lazy 'C.ByteString's. -- ----------------------------------------------------------------------------- -{-# LANGUAGE FlexibleInstances #-} -{-# OPTIONS_GHC -fno-warn-orphans #-} - module Text.Parsec.ByteString.Lazy ( Parser, GenParser, parseFromFile ) where @@ -24,9 +21,6 @@ import qualified Data.ByteString.Lazy.Char8 as C -instance (Monad m) => Stream C.ByteString m Char where - uncons = return . C.uncons - type Parser = Parsec C.ByteString () type GenParser t st = Parsec C.ByteString st diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/parsec-3.1.5/Text/Parsec/ByteString.hs new/parsec-3.1.9/Text/Parsec/ByteString.hs --- old/parsec-3.1.5/Text/Parsec/ByteString.hs 2014-01-11 07:13:34.000000000 +0100 +++ new/parsec-3.1.9/Text/Parsec/ByteString.hs 2015-03-22 02:13:17.000000000 +0100 @@ -8,13 +8,10 @@ -- Stability : provisional -- Portability : portable -- --- Make strict ByteStrings an instance of 'Stream' with 'Char' token type. +-- Convinience definitions for working with 'C.ByteString's. -- ----------------------------------------------------------------------------- -{-# LANGUAGE FlexibleInstances, MultiParamTypeClasses #-} -{-# OPTIONS_GHC -fno-warn-orphans #-} - module Text.Parsec.ByteString ( Parser, GenParser, parseFromFile ) where @@ -24,9 +21,6 @@ import qualified Data.ByteString.Char8 as C -instance (Monad m) => Stream C.ByteString m Char where - uncons = return . C.uncons - type Parser = Parsec C.ByteString () type GenParser t st = Parsec C.ByteString st diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/parsec-3.1.5/Text/Parsec/Char.hs new/parsec-3.1.9/Text/Parsec/Char.hs --- old/parsec-3.1.5/Text/Parsec/Char.hs 2014-01-11 07:13:34.000000000 +0100 +++ new/parsec-3.1.9/Text/Parsec/Char.hs 2015-03-22 02:13:17.000000000 +0100 @@ -19,6 +19,7 @@ import Data.Char import Text.Parsec.Pos import Text.Parsec.Prim +import Control.Applicative ((*>)) -- | @oneOf cs@ succeeds if the current character is in the supplied -- list of characters @cs@. Returns the parsed character. See also @@ -52,7 +53,22 @@ -- | Parses a newline character (\'\\n\'). Returns a newline character. newline :: (Stream s m Char) => ParsecT s u m Char -newline = char '\n' <?> "new-line" +newline = char '\n' <?> "lf new-line" + +-- | Parses a carriage return character (\'\\r\') followed by a newline character (\'\\n\'). +-- Returns a newline character. + +crlf :: (Stream s m Char) => ParsecT s u m Char +crlf = char '\r' *> char '\n' <?> "crlf new-line" + +-- | Parses a CRLF (see 'crlf') or LF (see 'newline') end-of-line. +-- Returns a newline character (\'\\n\'). +-- +-- > endOfLine = newline <|> crlf +-- + +endOfLine :: (Stream s m Char) => ParsecT s u m Char +endOfLine = newline <|> crlf <?> "new-line" -- | Parses a tab character (\'\\t\'). Returns a tab character. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/parsec-3.1.5/Text/Parsec/Combinator.hs new/parsec-3.1.9/Text/Parsec/Combinator.hs --- old/parsec-3.1.5/Text/Parsec/Combinator.hs 2014-01-11 07:13:34.000000000 +0100 +++ new/parsec-3.1.9/Text/Parsec/Combinator.hs 2015-03-22 02:13:17.000000000 +0100 @@ -143,13 +143,13 @@ sepEndBy p sep = sepEndBy1 p sep <|> return [] --- | @endBy1 p sep@ parses /one/ or more occurrences of @p@, seperated +-- | @endBy1 p sep@ parses /one/ or more occurrences of @p@, separated -- and ended by @sep@. Returns a list of values returned by @p@. endBy1 :: (Stream s m t) => ParsecT s u m a -> ParsecT s u m sep -> ParsecT s u m [a] endBy1 p sep = many1 (do{ x <- p; sep; return x }) --- | @endBy p sep@ parses /zero/ or more occurrences of @p@, seperated +-- | @endBy p sep@ parses /zero/ or more occurrences of @p@, separated -- and ended by @sep@. Returns a list of values returned by @p@. -- -- > cStatements = cStatement `endBy` semi @@ -165,7 +165,7 @@ count n p | n <= 0 = return [] | otherwise = sequence (replicate n p) --- | @chainr p op x@ parser /zero/ or more occurrences of @p@, +-- | @chainr p op x@ parses /zero/ or more occurrences of @p@, -- separated by @op@ Returns a value obtained by a /right/ associative -- application of all functions returned by @op@ to the values returned -- by @p@. If there are no occurrences of @p@, the value @x@ is @@ -174,7 +174,7 @@ chainr :: (Stream s m t) => ParsecT s u m a -> ParsecT s u m (a -> a -> a) -> a -> ParsecT s u m a chainr p op x = chainr1 p op <|> return x --- | @chainl p op x@ parser /zero/ or more occurrences of @p@, +-- | @chainl p op x@ parses /zero/ or more occurrences of @p@, -- separated by @op@. Returns a value obtained by a /left/ associative -- application of all functions returned by @op@ to the values returned -- by @p@. If there are zero occurrences of @p@, the value @x@ is @@ -183,7 +183,7 @@ chainl :: (Stream s m t) => ParsecT s u m a -> ParsecT s u m (a -> a -> a) -> a -> ParsecT s u m a chainl p op x = chainl1 p op <|> return x --- | @chainl1 p op x@ parser /one/ or more occurrences of @p@, +-- | @chainl1 p op x@ parses /one/ or more occurrences of @p@, -- separated by @op@ Returns a value obtained by a /left/ associative -- application of all functions returned by @op@ to the values returned -- by @p@. . This parser can for example be used to eliminate left @@ -208,7 +208,7 @@ } <|> return x --- | @chainr1 p op x@ parser /one/ or more occurrences of |p|, +-- | @chainr1 p op x@ parses /one/ or more occurrences of |p|, -- separated by @op@ Returns a value obtained by a /right/ associative -- application of all functions returned by @op@ to the values returned -- by @p@. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/parsec-3.1.5/Text/Parsec/Error.hs new/parsec-3.1.9/Text/Parsec/Error.hs --- old/parsec-3.1.5/Text/Parsec/Error.hs 2014-01-11 07:13:34.000000000 +0100 +++ new/parsec-3.1.9/Text/Parsec/Error.hs 2015-03-22 02:13:17.000000000 +0100 @@ -91,7 +91,7 @@ -- provides the source position ('SourcePos') of the error -- and a list of error messages ('Message'). A @ParseError@ -- can be returned by the function 'Text.Parsec.Prim.parse'. @ParseError@ is an --- instance of the 'Show' class. +-- instance of the 'Show' and 'Eq' classes. data ParseError = ParseError !SourcePos [Message] @@ -152,6 +152,12 @@ "expecting" "unexpected" "end of input" (errorMessages err) +instance Eq ParseError where + l == r + = errorPos l == errorPos r && messageStrs l == messageStrs r + where + messageStrs = map messageString . errorMessages + -- Language independent show function -- TODO @@ -196,10 +202,10 @@ commasOr [m] = m commasOr ms = commaSep (init ms) ++ " " ++ msgOr ++ " " ++ last ms - commaSep = seperate ", " . clean + commaSep = separate ", " . clean - seperate _ [] = "" - seperate _ [m] = m - seperate sep (m:ms) = m ++ sep ++ seperate sep ms + separate _ [] = "" + separate _ [m] = m + separate sep (m:ms) = m ++ sep ++ separate sep ms clean = nub . filter (not . null) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/parsec-3.1.5/Text/Parsec/Prim.hs new/parsec-3.1.9/Text/Parsec/Prim.hs --- old/parsec-3.1.5/Text/Parsec/Prim.hs 2014-01-11 07:13:34.000000000 +0100 +++ new/parsec-3.1.9/Text/Parsec/Prim.hs 2015-03-22 02:13:17.000000000 +0100 @@ -14,6 +14,7 @@ {-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies, FlexibleContexts, UndecidableInstances #-} +{-# OPTIONS_HADDOCK not-home #-} module Text.Parsec.Prim ( unknownError @@ -67,6 +68,13 @@ , updateState ) where + +import qualified Data.ByteString.Lazy.Char8 as CL +import qualified Data.ByteString.Char8 as C + +import qualified Data.Text as Text +import qualified Data.Text.Lazy as TextL + import qualified Control.Applicative as Applicative ( Applicative(..), Alternative(..) ) import Control.Monad() import Control.Monad.Trans @@ -272,7 +280,7 @@ -- | @parserZero@ always fails without consuming any input. @parserZero@ is defined -- equal to the 'mzero' member of the 'MonadPlus' class and to the 'Control.Applicative.empty' member --- of the 'Control.Applicative.Applicative' class. +-- of the 'Control.Applicative.Alternative' class. parserZero :: ParsecT s u m a parserZero @@ -299,7 +307,7 @@ infix 0 <?> infixr 1 <|> --- | The parser @p <?> msg@ behaves as parser @p@, but whenever the +-- | The parser @p \<?> msg@ behaves as parser @p@, but whenever the -- parser @p@ fails /without consuming any input/, it replaces expect -- error messages with the expect error message @msg@. -- @@ -329,6 +337,7 @@ (<|>) :: (ParsecT s u m a) -> (ParsecT s u m a) -> (ParsecT s u m a) p1 <|> p2 = mplus p1 p2 +-- | A synonym for @\<?>@, but as a function instead of an operator. label :: ParsecT s u m a -> String -> ParsecT s u m a label p msg = labels p [msg] @@ -363,6 +372,27 @@ class (Monad m) => Stream s m t | s -> t where uncons :: s -> m (Maybe (t,s)) +instance (Monad m) => Stream [tok] m tok where + uncons [] = return $ Nothing + uncons (t:ts) = return $ Just (t,ts) + {-# INLINE uncons #-} + + +instance (Monad m) => Stream CL.ByteString m Char where + uncons = return . CL.uncons + +instance (Monad m) => Stream C.ByteString m Char where + uncons = return . C.uncons + +instance (Monad m) => Stream Text.Text m Char where + uncons = return . Text.uncons + {-# INLINE uncons #-} + +instance (Monad m) => Stream TextL.Text m Char where + uncons = return . TextL.uncons + {-# INLINE uncons #-} + + tokens :: (Stream s m t, Eq t) => ([t] -> String) -- Pretty print a list of tokens -> (SourcePos -> [t] -> SourcePos) @@ -442,14 +472,10 @@ -- if this is undesirable. lookAhead :: (Stream s m t) => ParsecT s u m a -> ParsecT s u m a -lookAhead p = do{ state <- getParserState - ; x <- p' - ; setParserState state - ; return x - } - where - p' = ParsecT $ \s cok cerr eok eerr -> - unParser p s eok cerr eok eerr +lookAhead p = + ParsecT $ \s _ cerr eok eerr -> do + let eok' a _ _ = eok a s (newErrorUnknown (statePos s)) + unParser p s eok' cerr eok' eerr -- | The parser @token showTok posFromTok testTok@ accepts a token @t@ -- with result @x@ when the function @testTok t@ returns @'Just' x@. The diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/parsec-3.1.5/Text/Parsec/String.hs new/parsec-3.1.9/Text/Parsec/String.hs --- old/parsec-3.1.5/Text/Parsec/String.hs 2014-01-11 07:13:34.000000000 +0100 +++ new/parsec-3.1.9/Text/Parsec/String.hs 2015-03-22 02:13:17.000000000 +0100 @@ -12,9 +12,6 @@ -- ----------------------------------------------------------------------------- -{-# LANGUAGE FlexibleInstances #-} -{-# OPTIONS_GHC -fno-warn-orphans #-} - module Text.Parsec.String ( Parser, GenParser, parseFromFile ) where @@ -22,11 +19,6 @@ import Text.Parsec.Error import Text.Parsec.Prim -instance (Monad m) => Stream [tok] m tok where - uncons [] = return $ Nothing - uncons (t:ts) = return $ Just (t,ts) - {-# INLINE uncons #-} - type Parser = Parsec String () type GenParser tok st = Parsec [tok] st diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/parsec-3.1.5/Text/Parsec/Text/Lazy.hs new/parsec-3.1.9/Text/Parsec/Text/Lazy.hs --- old/parsec-3.1.5/Text/Parsec/Text/Lazy.hs 2014-01-11 07:13:34.000000000 +0100 +++ new/parsec-3.1.9/Text/Parsec/Text/Lazy.hs 2015-03-22 02:13:17.000000000 +0100 @@ -8,13 +8,10 @@ -- Stability : provisional -- Portability : portable -- --- Make Text an instance of 'Stream' with 'Char' token type. +-- Convinience definitions for working with lazy 'Text.Text'. -- ----------------------------------------------------------------------------- -{-# LANGUAGE FlexibleInstances #-} -{-# OPTIONS_GHC -fno-warn-orphans #-} - module Text.Parsec.Text.Lazy ( Parser, GenParser ) where @@ -23,9 +20,5 @@ import Text.Parsec.Error import Text.Parsec.Prim -instance (Monad m) => Stream Text.Text m Char where - uncons = return . Text.uncons - {-# INLINE uncons #-} - type Parser = Parsec Text.Text () type GenParser st = Parsec Text.Text st diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/parsec-3.1.5/Text/Parsec/Text.hs new/parsec-3.1.9/Text/Parsec/Text.hs --- old/parsec-3.1.5/Text/Parsec/Text.hs 2014-01-11 07:13:34.000000000 +0100 +++ new/parsec-3.1.9/Text/Parsec/Text.hs 2015-03-22 02:13:17.000000000 +0100 @@ -8,13 +8,10 @@ -- Stability : provisional -- Portability : portable -- --- Make Text an instance of 'Stream' with 'Char' token type. +-- Convinience definitions for working with 'Text.Text'. -- ----------------------------------------------------------------------------- -{-# LANGUAGE FlexibleInstances #-} -{-# OPTIONS_GHC -fno-warn-orphans #-} - module Text.Parsec.Text ( Parser, GenParser ) where @@ -23,9 +20,5 @@ import Text.Parsec.Error import Text.Parsec.Prim -instance (Monad m) => Stream Text.Text m Char where - uncons = return . Text.uncons - {-# INLINE uncons #-} - type Parser = Parsec Text.Text () type GenParser st = Parsec Text.Text st diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/parsec-3.1.5/Text/Parsec/Token.hs new/parsec-3.1.9/Text/Parsec/Token.hs --- old/parsec-3.1.5/Text/Parsec/Token.hs 2014-01-11 07:13:34.000000000 +0100 +++ new/parsec-3.1.9/Text/Parsec/Token.hs 2015-03-22 02:13:17.000000000 +0100 @@ -64,12 +64,12 @@ nestedComments :: Bool, -- | This parser should accept any start characters of identifiers. For - -- example @letter \<|> char \"_\"@. + -- example @letter \<|> char \'_\'@. identStart :: ParsecT s u m Char, -- | This parser should accept any legal tail characters of identifiers. - -- For example @alphaNum \<|> char \"_\"@. + -- For example @alphaNum \<|> char \'_\'@. identLetter :: ParsecT s u m Char, @@ -448,7 +448,7 @@ charControl = do{ char '^' ; code <- upper - ; return (toEnum (fromEnum code - fromEnum 'A')) + ; return (toEnum (fromEnum code - fromEnum 'A' + 1)) } charNum = do{ code <- decimal diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/parsec-3.1.5/Text/Parsec.hs new/parsec-3.1.9/Text/Parsec.hs --- old/parsec-3.1.5/Text/Parsec.hs 2014-01-11 07:13:34.000000000 +0100 +++ new/parsec-3.1.9/Text/Parsec.hs 2015-03-22 02:13:17.000000000 +0100 @@ -1,29 +1,116 @@ ------------------------------------------------------------------------------ --- | --- Module : Text.Parsec --- Copyright : (c) Daan Leijen 1999-2001, (c) Paolo Martini 2007 --- License : BSD-style (see the LICENSE file) --- --- Maintainer : [email protected] --- Stability : provisional --- Portability : portable --- ------------------------------------------------------------------------------ +{-| +Module : Text.Parsec +Copyright : (c) Daan Leijen 1999-2001, (c) Paolo Martini 2007 +License : BSD-style (see the LICENSE file) + +Maintainer : [email protected] +Stability : provisional +Portability : portable + +This module includes everything you need to get started writing a +parser. + +By default this module is set up to parse character data. If you'd like +to parse the result of your own tokenizer you should start with the following +imports: + +@ + import Text.Parsec.Prim + import Text.Parsec.Combinator +@ + +Then you can implement your own version of 'satisfy' on top of the 'tokenPrim' +primitive. + +-} module Text.Parsec - ( module Text.Parsec.Prim + ( -- * Parsers + ParsecT + , Parsec + , token + , tokens + , runParserT + , runParser + , parse + , parseTest + , getPosition + , getInput + , getState + , putState + , modifyState + -- * Combinators + , (<|>) + , (<?>) + , label + , labels + , try + , unexpected + , choice + , many + , many1 + , skipMany + , skipMany1 + , count + , between + , option + , optionMaybe + , optional + , sepBy + , sepBy1 + , endBy + , endBy1 + , sepEndBy + , sepEndBy1 + , chainl + , chainl1 + , chainr + , chainr1 + , eof + , notFollowedBy + , manyTill + , lookAhead + , anyToken + -- * Character Parsing , module Text.Parsec.Char - , module Text.Parsec.Combinator - , module Text.Parsec.String - , module Text.Parsec.ByteString - , module Text.Parsec.ByteString.Lazy + -- * Error messages , ParseError , errorPos + -- * Position , SourcePos , SourceName, Line, Column , sourceName, sourceLine, sourceColumn , incSourceLine, incSourceColumn , setSourceLine, setSourceColumn, setSourceName + -- * Low-level operations + , manyAccum + , tokenPrim + , tokenPrimEx + , runPT + , unknownError + , sysUnExpectError + , mergeErrorReply + , getParserState + , setParserState + , updateParserState + , Stream (..) + , runParsecT + , mkPT + , runP + , Consumed (..) + , Reply (..) + , State (..) + , setPosition + , setInput + -- * Other stuff + , setState + , updateState + , parsecMap + , parserReturn + , parserBind + , parserFail + , parserZero + , parserPlus ) where import Text.Parsec.Pos @@ -31,6 +118,3 @@ import Text.Parsec.Prim import Text.Parsec.Char import Text.Parsec.Combinator -import Text.Parsec.String hiding ( Parser, GenParser, parseFromFile ) -import Text.Parsec.ByteString hiding ( Parser, GenParser, parseFromFile ) -import Text.Parsec.ByteString.Lazy hiding ( Parser, GenParser, parseFromFile ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/parsec-3.1.5/parsec.cabal new/parsec-3.1.9/parsec.cabal --- old/parsec-3.1.5/parsec.cabal 2014-01-11 07:13:34.000000000 +0100 +++ new/parsec-3.1.9/parsec.cabal 2015-03-22 02:13:17.000000000 +0100 @@ -1,37 +1,33 @@ name: parsec -version: 3.1.5 -cabal-version: >= 1.6 +version: 3.1.9 +cabal-version: >= 1.8 license: BSD3 license-file: LICENSE author: Daan Leijen <[email protected]>, Paolo Martini <[email protected]> maintainer: Antoine Latter <[email protected]> -homepage: http://www.cs.uu.nl/~daan/parsec.html +homepage: https://github.com/aslatter/parsec +bug-reports: https://github.com/aslatter/parsec/issues category: Parsing synopsis: Monadic parser combinators -build-type: Simple +build-type: Simple description: Parsec is designed from scratch as an industrial-strength parser library. It is simple, safe, well documented (on the package - homepage), has extensive libraries and good error messages, - and is also fast. It is defined as a monad transformer that can be + homepage), has extensive libraries, good error messages, + and is fast. It is defined as a monad transformer that can be stacked on arbitrary monads, and it is also parametric in the input stream type. extra-source-files: CHANGES source-repository head - type: darcs - location: http://code.haskell.org/parsec3 - -source-repository this - type: darcs - location: http://code.haskell.org/parsec3 - tag: 3.1.5 + type: git + location: https://github.com/aslatter/parsec flag base4 Description: Use base-4.* Default: True -library +library exposed-modules: Text.Parsec, Text.Parsec.String, @@ -63,6 +59,25 @@ else build-depends: base >= 3.0.3 && < 4 cpp-options: -DBASE3 - build-depends: mtl, bytestring, text >= 0.2 && < 1.2 + + build-depends: mtl, bytestring, text >= 0.2 && < 1.3 extensions: ExistentialQuantification, PolymorphicComponents, MultiParamTypeClasses, FlexibleInstances, FlexibleContexts, DeriveDataTypeable, CPP ghc-options: -O2 + +Test-Suite tests + type: exitcode-stdio-1.0 + hs-source-dirs: test + main-is: Main.hs + other-modules: + Bugs, + Bugs.Bug2, + Bugs.Bug6, + Bugs.Bug9, + Util + build-depends: + base, + parsec, + HUnit == 1.2.*, + test-framework >= 0.6 && < 0.9, + test-framework-hunit >= 0.2 && < 0.4 + ghc-options: -Wall diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/parsec-3.1.5/test/Bugs/Bug2.hs new/parsec-3.1.9/test/Bugs/Bug2.hs --- old/parsec-3.1.5/test/Bugs/Bug2.hs 1970-01-01 01:00:00.000000000 +0100 +++ new/parsec-3.1.9/test/Bugs/Bug2.hs 2015-03-22 02:13:17.000000000 +0100 @@ -0,0 +1,28 @@ + +module Bugs.Bug2 + ( main + ) where + +import Test.HUnit hiding ( Test ) +import Test.Framework +import Test.Framework.Providers.HUnit + +import Text.Parsec +import Text.Parsec.String +import qualified Text.Parsec.Token as P +import Text.Parsec.Language (haskellDef) + +main :: Test +main = + testCase "Control Char Parsing (#2)" $ + parseString "\"test\\^Bstring\"" @?= "test\^Bstring" + + where + parseString :: String -> String + parseString input = + case parse parser "Example" input of + Left{} -> error "Parse failure" + Right str -> str + + parser :: Parser String + parser = P.stringLiteral $ P.makeTokenParser haskellDef \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/parsec-3.1.5/test/Bugs/Bug6.hs new/parsec-3.1.9/test/Bugs/Bug6.hs --- old/parsec-3.1.5/test/Bugs/Bug6.hs 1970-01-01 01:00:00.000000000 +0100 +++ new/parsec-3.1.9/test/Bugs/Bug6.hs 2015-03-22 02:13:17.000000000 +0100 @@ -0,0 +1,25 @@ + +module Bugs.Bug6 + ( main + ) where + +import Test.HUnit hiding ( Test ) +import Test.Framework +import Test.Framework.Providers.HUnit + +import Text.Parsec +import Text.Parsec.String + +import Util + +main :: Test +main = + testCase "Look-ahead preserving error location (#6)" $ + parseErrors variable "return" @?= ["'return' is a reserved keyword"] + +variable :: Parser String +variable = do + x <- lookAhead (many1 letter) + if x == "return" + then fail "'return' is a reserved keyword" + else string x diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/parsec-3.1.5/test/Bugs/Bug9.hs new/parsec-3.1.9/test/Bugs/Bug9.hs --- old/parsec-3.1.5/test/Bugs/Bug9.hs 1970-01-01 01:00:00.000000000 +0100 +++ new/parsec-3.1.9/test/Bugs/Bug9.hs 2015-03-22 02:13:17.000000000 +0100 @@ -0,0 +1,46 @@ + +module Bugs.Bug9 ( main ) where + +import Control.Applicative ((<*), (<$>), (<$)) +import Text.Parsec +import Text.Parsec.Language (haskellStyle) +import Text.Parsec.String (Parser) +import Text.Parsec.Expr +import qualified Text.Parsec.Token as P + +import Test.HUnit hiding ( Test ) +import Test.Framework +import Test.Framework.Providers.HUnit + +import Util + +data Expr = Const Integer | Op Expr Expr + deriving Show + +main :: Test +main = + testCase "Tracing of current position in error message (#9)" + $ result @?= ["unexpected '>'","expecting operator or end of input"] + + where + result :: [String] + result = parseErrors parseTopLevel "4 >> 5" + +-- Syntax analaysis + +parseTopLevel :: Parser Expr +parseTopLevel = parseExpr <* eof + +parseExpr :: Parser Expr +parseExpr = buildExpressionParser table (Const <$> integer) + where + table = [[ Infix (Op <$ reserved ">>>") AssocLeft ]] + + -- Lexical analysis + + lexer = P.makeTokenParser haskellStyle { P.reservedOpNames = [">>>"] } + + integer = P.integer lexer + reserved = P.reserved lexer + reservedOp = P.reservedOp lexer + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/parsec-3.1.5/test/Bugs.hs new/parsec-3.1.9/test/Bugs.hs --- old/parsec-3.1.5/test/Bugs.hs 1970-01-01 01:00:00.000000000 +0100 +++ new/parsec-3.1.9/test/Bugs.hs 2015-03-22 02:13:17.000000000 +0100 @@ -0,0 +1,16 @@ + +module Bugs + ( bugs + ) where + +import Test.Framework + +import qualified Bugs.Bug2 +import qualified Bugs.Bug6 +import qualified Bugs.Bug9 + +bugs :: [Test] +bugs = [ Bugs.Bug2.main + , Bugs.Bug6.main + , Bugs.Bug9.main + ] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/parsec-3.1.5/test/Main.hs new/parsec-3.1.9/test/Main.hs --- old/parsec-3.1.5/test/Main.hs 1970-01-01 01:00:00.000000000 +0100 +++ new/parsec-3.1.9/test/Main.hs 2015-03-22 02:13:17.000000000 +0100 @@ -0,0 +1,10 @@ + +import Test.Framework + +import Bugs ( bugs ) + +main :: IO () +main = do + defaultMain + [ testGroup "Bugs" bugs + ] \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/parsec-3.1.5/test/Util.hs new/parsec-3.1.9/test/Util.hs --- old/parsec-3.1.5/test/Util.hs 1970-01-01 01:00:00.000000000 +0100 +++ new/parsec-3.1.9/test/Util.hs 2015-03-22 02:13:17.000000000 +0100 @@ -0,0 +1,14 @@ + +module Util where + +import Text.Parsec +import Text.Parsec.String ( Parser ) + +-- | Returns the error messages associated +-- with a failed parse. +parseErrors :: Parser a -> String -> [String] +parseErrors p input = + case parse p "" input of + Left err -> + drop 1 $ lines $ show err + Right{} -> []
