parsec 3.1.2 → 3.1.3
raw patch · 4 files changed
+16/−7 lines, 4 files
Files
- CHANGES +4/−0
- Text/Parsec/Error.hs +7/−3
- Text/Parsec/Prim.hs +2/−2
- parsec.cabal +3/−2
+ CHANGES view
@@ -0,0 +1,4 @@++3.1.3++- Fix a regression introduced in 3.1.2 related to positions reported by error messages.
Text/Parsec/Error.hs view
@@ -134,12 +134,16 @@ = ParseError pos (msg : filter (msg /=) msgs) mergeError :: ParseError -> ParseError -> ParseError-mergeError (ParseError pos1 msgs1) (ParseError pos2 msgs2)+mergeError e1@(ParseError pos1 msgs1) e2@(ParseError pos2 msgs2)+ -- prefer meaningful errors+ | null msgs2 && not (null msgs1) = e1+ | null msgs1 && not (null msgs2) = e2+ | otherwise = case pos1 `compare` pos2 of -- select the longest match EQ -> ParseError pos1 (msgs1 ++ msgs2)- GT -> ParseError pos1 msgs1- LT -> ParseError pos2 msgs2+ GT -> e1+ LT -> e2 instance Show ParseError where show err
Text/Parsec/Prim.hs view
@@ -451,7 +451,7 @@ p' = ParsecT $ \s cok cerr eok eerr -> unParser p s eok cerr eok eerr --- | The parser @tokenPrim showTok posFromTok testTok@ accepts a token @t@+-- | The parser @token showTok posFromTok testTok@ accepts a token @t@ -- with result @x@ when the function @testTok t@ returns @'Just' x@. The -- source position of the @t@ should be returned by @posFromTok t@ and -- the token can be shown using @showTok t@.@@ -479,7 +479,7 @@ Nothing -> tokpos tok Just (tok',_) -> tokpos tok' --- | The parser @token showTok nextPos testTok@ accepts a token @t@+-- | The parser @tokenPrim showTok nextPos testTok@ accepts a token @t@ -- with result @x@ when the function @testTok t@ returns @'Just' x@. The -- token can be shown using @showTok t@. The position of the /next/ -- token should be returned when @nextPos@ is called with the current
parsec.cabal view
@@ -1,5 +1,5 @@ name: parsec-version: 3.1.2+version: 3.1.3 cabal-version: >= 1.6 license: BSD3 license-file: LICENSE@@ -16,6 +16,7 @@ and is also 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@@ -24,7 +25,7 @@ source-repository this type: darcs location: http://code.haskell.org/parsec3- tag: 3.1.2+ tag: 3.1.3 flag base4 Description: Use base-4.*