packages feed

parsec 3.1.1 → 3.1.2

raw patch · 7 files changed

+94/−20 lines, 7 filesdep +textdep ~basedep ~bytestringdep ~mtl

Dependencies added: text

Dependency ranges changed: base, bytestring, mtl

Files

Text/Parsec/Combinator.hs view
@@ -275,12 +275,3 @@                       scan  = do{ end; return [] }                             <|>                               do{ x <- p; xs <- scan; return (x:xs) }---- | @lookAhead p@ parses @p@ without consuming any input.--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-                        }
Text/Parsec/Error.hs view
@@ -134,8 +134,12 @@     = ParseError pos (msg : filter (msg /=) msgs)  mergeError :: ParseError -> ParseError -> ParseError-mergeError (ParseError pos msgs1) (ParseError _ msgs2)-    = ParseError pos (msgs1 ++ msgs2)+mergeError (ParseError pos1 msgs1) (ParseError pos2 msgs2)+    = case pos1 `compare` pos2 of+        -- select the longest match+        EQ -> ParseError pos1 (msgs1 ++ msgs2)+        GT -> ParseError pos1 msgs1+        LT -> ParseError pos2 msgs2  instance Show ParseError where     show err
Text/Parsec/Prim.hs view
@@ -37,6 +37,7 @@     , (<|>)     , label     , labels+    , lookAhead     , Stream(..)     , tokens     , try@@ -432,9 +433,23 @@  try :: ParsecT s u m a -> ParsecT s u m a try p =-    ParsecT $ \s@(State _ pos _) cok _ eok eerr ->-    let pcerr parseError = eerr $ setErrorPos pos parseError -    in unParser p s cok pcerr eok eerr+    ParsecT $ \s cok _ eok eerr ->+    unParser p s cok eerr eok eerr++-- | @lookAhead p@ parses @p@ without consuming any input.+--+-- If @p@ fails and consumes some input, so does @lookAhead@. Combine with 'try'+-- 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  -- | The parser @tokenPrim showTok posFromTok testTok@ accepts a token @t@ -- with result @x@ when the function @testTok t@ returns @'Just' x@. The
+ Text/Parsec/Text.hs view
@@ -0,0 +1,31 @@+-----------------------------------------------------------------------------+-- |+-- Module      :  Text.Parsec.String+-- Copyright   :  (c) Antoine Latter 2011+-- License     :  BSD-style (see the file libraries/parsec/LICENSE)+-- +-- Maintainer  :  aslatter@gmail.com+-- Stability   :  provisional+-- Portability :  portable+-- +-- Make Text an instance of 'Stream' with 'Char' token type.+--+-----------------------------------------------------------------------------++{-# LANGUAGE FlexibleInstances #-}+{-# OPTIONS_GHC -fno-warn-orphans #-}++module Text.Parsec.Text+    ( Parser, GenParser+    ) where++import qualified Data.Text as Text+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
+ Text/Parsec/Text/Lazy.hs view
@@ -0,0 +1,31 @@+-----------------------------------------------------------------------------+-- |+-- Module      :  Text.Parsec.String+-- Copyright   :  (c) Antoine Latter 2011+-- License     :  BSD-style (see the file libraries/parsec/LICENSE)+-- +-- Maintainer  :  aslatter@gmail.com+-- Stability   :  provisional+-- Portability :  portable+-- +-- Make Text an instance of 'Stream' with 'Char' token type.+--+-----------------------------------------------------------------------------++{-# LANGUAGE FlexibleInstances #-}+{-# OPTIONS_GHC -fno-warn-orphans #-}++module Text.Parsec.Text.Lazy+    ( Parser, GenParser+    ) where++import qualified Data.Text.Lazy as Text+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
Text/Parsec/Token.hs view
@@ -658,10 +658,10 @@                             GT  -> False      theReservedNames-        | caseSensitive languageDef  = sortedNames-        | otherwise               = map (map toLower) sortedNames+        | caseSensitive languageDef  = sort reserved+        | otherwise                  = sort . map (map toLower) $ reserved         where-          sortedNames   = sort (reservedNames languageDef)+          reserved = reservedNames languageDef   
parsec.cabal view
@@ -1,5 +1,5 @@ name:		parsec-version:	3.1.1+version:	3.1.2 cabal-version: >= 1.6 license:	BSD3 license-file:	LICENSE@@ -24,7 +24,7 @@ source-repository this     type: darcs     location: http://code.haskell.org/parsec3-    tag: 3.1.1+    tag: 3.1.2  flag base4     Description: Use base-4.*@@ -36,6 +36,8 @@         Text.Parsec.String,         Text.Parsec.ByteString,         Text.Parsec.ByteString.Lazy,+        Text.Parsec.Text,+        Text.Parsec.Text.Lazy,         Text.Parsec.Pos,         Text.Parsec.Error,         Text.Parsec.Prim,@@ -60,6 +62,6 @@     else         build-depends: base >= 3.0.3 && < 4         cpp-options: -DBASE3-    build-depends: mtl, bytestring+    build-depends: mtl, bytestring, text >= 0.2 && < 0.12     extensions:	ExistentialQuantification, PolymorphicComponents, MultiParamTypeClasses, FlexibleInstances, FlexibleContexts, DeriveDataTypeable, CPP     ghc-options:	-O2