parsec 3.1.8 → 3.1.9
raw patch · 7 files changed
+36/−21 lines, 7 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Text.Parsec: runP :: Stream s Identity t => Parsec s u a -> u -> SourceName -> s -> Either ParseError a
+ Text.Parsec.Error: instance Eq ParseError
Files
- CHANGES +8/−0
- Text/Parsec.hs +1/−0
- Text/Parsec/Combinator.hs +6/−6
- Text/Parsec/Error.hs +11/−5
- Text/Parsec/Prim.hs +2/−2
- Text/Parsec/Token.hs +2/−2
- parsec.cabal +6/−6
CHANGES view
@@ -1,3 +1,11 @@+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.
Text/Parsec.hs view
@@ -96,6 +96,7 @@ , Stream (..) , runParsecT , mkPT+ , runP , Consumed (..) , Reply (..) , State (..)
Text/Parsec/Combinator.hs view
@@ -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@.
Text/Parsec/Error.hs view
@@ -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)
Text/Parsec/Prim.hs view
@@ -280,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@@ -337,7 +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.+-- | 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]
Text/Parsec/Token.hs view
@@ -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,
parsec.cabal view
@@ -1,20 +1,20 @@ name: parsec-version: 3.1.8+version: 3.1.9 cabal-version: >= 1.8 license: BSD3 license-file: LICENSE author: Daan Leijen <daan@microsoft.com>, Paolo Martini <paolo@nemail.it> maintainer: Antoine Latter <aslatter@gmail.com>-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@@ -27,7 +27,7 @@ Description: Use base-4.* Default: True -library +library exposed-modules: Text.Parsec, Text.Parsec.String,