uu-parsinglib 2.9.1.1 → 2.9.2
raw patch · 3 files changed
+33/−24 lines, 3 filesnew-uploaderPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Text.ParserCombinators.UU.BasicInstances: class Show loc => IsLocationUpdatedBy loc str
- Text.ParserCombinators.UU.Core: Apply :: (b -> a) -> Steps b -> Steps a
- Text.ParserCombinators.UU.Core: Done :: a -> Steps a
- Text.ParserCombinators.UU.Core: End_f :: [Steps a] -> Steps a -> Steps a
- Text.ParserCombinators.UU.Core: End_h :: ([a], [a] -> Steps r) -> Steps (a, r) -> Steps (a, r)
- Text.ParserCombinators.UU.Core: Fail :: Strings -> [Strings -> (Cost, Steps a)] -> Steps a
- Text.ParserCombinators.UU.Core: Micro :: Int -> Steps a -> Steps a
- Text.ParserCombinators.UU.Core: Step :: Progress -> Steps a -> Steps a
- Text.ParserCombinators.UU.Core: class HasPosition state pos | state -> pos
- Text.ParserCombinators.UU.Core: class Show loc => IsLocationUpdatedBy loc str
- Text.ParserCombinators.UU.Core: class StoresErrors state error | state -> error
+ Text.ParserCombinators.UU.BasicInstances: class Show loc => loc `IsLocationUpdatedBy` str
+ Text.ParserCombinators.UU.Core: [Apply] :: forall a b. (b -> a) -> Steps b -> Steps a
+ Text.ParserCombinators.UU.Core: [Done] :: a -> Steps a
+ Text.ParserCombinators.UU.Core: [End_f] :: [Steps a] -> Steps a -> Steps a
+ Text.ParserCombinators.UU.Core: [End_h] :: ([a], [a] -> Steps r) -> Steps (a, r) -> Steps (a, r)
+ Text.ParserCombinators.UU.Core: [Fail] :: Strings -> [Strings -> (Cost, Steps a)] -> Steps a
+ Text.ParserCombinators.UU.Core: [Micro] :: Int -> Steps a -> Steps a
+ Text.ParserCombinators.UU.Core: [Step] :: Progress -> Steps a -> Steps a
+ Text.ParserCombinators.UU.Core: class Show loc => loc `IsLocationUpdatedBy` str
+ Text.ParserCombinators.UU.Core: class state `HasPosition` pos | state -> pos
+ Text.ParserCombinators.UU.Core: infix 2 <?>
+ Text.ParserCombinators.UU.Core: infixl 2 `opt`
+ Text.ParserCombinators.UU.Core: infixl 3 <<|>
+ Text.ParserCombinators.UU.Derived: infixl 4 <??>
- Text.ParserCombinators.UU.BasicInstances: Str :: s -> [Error loc] -> loc -> !Bool -> Str a s loc
+ Text.ParserCombinators.UU.BasicInstances: Str :: s -> [Error loc] -> !loc -> !Bool -> Str a s loc
- Text.ParserCombinators.UU.BasicInstances: [pos] :: Str a s loc -> loc
+ Text.ParserCombinators.UU.BasicInstances: [pos] :: Str a s loc -> !loc
- Text.ParserCombinators.UU.BasicInstances: pMunch :: (Show a, loc `IsLocationUpdatedBy` a, ListLike state a) => (a -> Bool) -> P (Str a state loc) [a]
+ Text.ParserCombinators.UU.BasicInstances: pMunch :: forall loc state a. (Show a, loc `IsLocationUpdatedBy` a, ListLike state a) => (a -> Bool) -> P (Str a state loc) [a]
- Text.ParserCombinators.UU.BasicInstances: pMunchL :: (Show a, loc `IsLocationUpdatedBy` a, ListLike state a) => (a -> Bool) -> String -> P (Str a state loc) [a]
+ Text.ParserCombinators.UU.BasicInstances: pMunchL :: forall loc state a. (Show a, loc `IsLocationUpdatedBy` a, ListLike state a) => (a -> Bool) -> String -> P (Str a state loc) [a]
- Text.ParserCombinators.UU.BasicInstances: pSatisfy :: (Show a, loc `IsLocationUpdatedBy` a, ListLike state a) => (a -> Bool) -> (Insertion a) -> P (Str a state loc) a
+ Text.ParserCombinators.UU.BasicInstances: pSatisfy :: forall loc state a. (Show a, loc `IsLocationUpdatedBy` a, ListLike state a) => (a -> Bool) -> Insertion a -> P (Str a state loc) a
- Text.ParserCombinators.UU.BasicInstances: pToken :: (Show a, Eq a, loc `IsLocationUpdatedBy` a, ListLike state a) => [a] -> P (Str a state loc) [a]
+ Text.ParserCombinators.UU.BasicInstances: pToken :: forall loc state a. (Show a, Eq a, loc `IsLocationUpdatedBy` a, ListLike state a) => [a] -> P (Str a state loc) [a]
- Text.ParserCombinators.UU.BasicInstances: pTokenCost :: (Show a, Eq a, loc `IsLocationUpdatedBy` a, ListLike state a) => [a] -> Int -> P (Str a state loc) [a]
+ Text.ParserCombinators.UU.BasicInstances: pTokenCost :: forall loc state a. (Show a, Eq a, loc `IsLocationUpdatedBy` a, ListLike state a) => [a] -> Int -> P (Str a state loc) [a]
- Text.ParserCombinators.UU.Core: P :: (T st a) -> (Maybe (T st a)) -> (Maybe a) -> Nat -> P st a
+ Text.ParserCombinators.UU.Core: P :: T st a -> Maybe (T st a) -> Maybe a -> Nat -> P st a
- Text.ParserCombinators.UU.Core: class (Alternative p) => ExtAlternative p where opt p v = must_be_non_empty "opt" p (p <<|> pure v)
+ Text.ParserCombinators.UU.Core: class (Alternative p) => ExtAlternative p
- Text.ParserCombinators.UU.Core: parse :: (Eof t) => P t a -> t -> a
+ Text.ParserCombinators.UU.Core: parse :: Eof t => P t a -> t -> a
- Text.ParserCombinators.UU.Core: parse_h :: (Eof t) => P t a -> t -> a
+ Text.ParserCombinators.UU.Core: parse_h :: Eof t => P t a -> t -> a
- Text.ParserCombinators.UU.Demo.Examples: lift :: t -> [t]
+ Text.ParserCombinators.UU.Demo.Examples: lift :: a -> [a]
- Text.ParserCombinators.UU.Demo.Examples: pConId :: (ListLike state Char, IsLocationUpdatedBy loc Char) => P (Str Char state loc) [Char]
+ Text.ParserCombinators.UU.Demo.Examples: pConId :: (IsLocationUpdatedBy loc Char, ListLike state Char) => P (Str Char state loc) [Char]
- Text.ParserCombinators.UU.Demo.Examples: pIdChar :: (ListLike state Char, IsLocationUpdatedBy loc Char) => P (Str Char state loc) Char
+ Text.ParserCombinators.UU.Demo.Examples: pIdChar :: (IsLocationUpdatedBy loc Char, ListLike state Char) => P (Str Char state loc) Char
- Text.ParserCombinators.UU.Demo.Examples: pVarId :: (ListLike state Char, IsLocationUpdatedBy loc Char) => P (Str Char state loc) [Char]
+ Text.ParserCombinators.UU.Demo.Examples: pVarId :: (IsLocationUpdatedBy loc Char, ListLike state Char) => P (Str Char state loc) [Char]
- Text.ParserCombinators.UU.Demo.Examples: run' :: (Show a, Show a1, ListLike s a) => P (Str a s LineColPos) a1 -> s -> IO ()
+ Text.ParserCombinators.UU.Demo.Examples: run' :: (Show a, ListLike s (Item s), Show (Item s)) => P (Str (Item s) s LineColPos) a -> s -> IO ()
- Text.ParserCombinators.UU.Demo.Examples: same_prio :: (Eq b, Show b, ListLike state b, IsLocationUpdatedBy loc b) => [(b, a)] -> P (Str b state loc) a
+ Text.ParserCombinators.UU.Demo.Examples: same_prio :: (Eq (Item state), IsLocationUpdatedBy loc (Item state), ListLike state (Item state), Show (Item state)) => [(Item state, a)] -> P (Str (Item state) state loc) a
- Text.ParserCombinators.UU.Demo.Examples: simpleComment :: (ListLike state Char, IsLocationUpdatedBy loc Char) => P (Str Char state loc) [Char]
+ Text.ParserCombinators.UU.Demo.Examples: simpleComment :: (IsLocationUpdatedBy loc Char, ListLike state Char) => P (Str Char state loc) [Char]
- Text.ParserCombinators.UU.Derived: pAtLeast :: (IsParser f) => Int -> f a -> f [a]
+ Text.ParserCombinators.UU.Derived: pAtLeast :: IsParser f => Int -> f a -> f [a]
- Text.ParserCombinators.UU.Derived: pAtMost :: (IsParser f) => Int -> f a -> f [a]
+ Text.ParserCombinators.UU.Derived: pAtMost :: IsParser f => Int -> f a -> f [a]
- Text.ParserCombinators.UU.Derived: pBetween :: (IsParser f) => Int -> Int -> f a -> f [a]
+ Text.ParserCombinators.UU.Derived: pBetween :: IsParser f => Int -> Int -> f a -> f [a]
- Text.ParserCombinators.UU.Derived: pExact :: (IsParser f) => Int -> f a -> f [a]
+ Text.ParserCombinators.UU.Derived: pExact :: IsParser f => Int -> f a -> f [a]
- Text.ParserCombinators.UU.Derived: pSome :: (IsParser f) => f a -> f [a]
+ Text.ParserCombinators.UU.Derived: pSome :: IsParser f => f a -> f [a]
- Text.ParserCombinators.UU.Utils: pDoubleRaw :: (Read a) => Parser a
+ Text.ParserCombinators.UU.Utils: pDoubleRaw :: Read a => Parser a
- Text.ParserCombinators.UU.Utils: pEnumRaw :: (Enum a, Show a) => Parser a
+ Text.ParserCombinators.UU.Utils: pEnumRaw :: forall a. (Enum a, Show a) => Parser a
- Text.ParserCombinators.UU.Utils: pIntegerRaw :: (Num a) => Parser a
+ Text.ParserCombinators.UU.Utils: pIntegerRaw :: Num a => Parser a
- Text.ParserCombinators.UU.Utils: pNaturalRaw :: (Num a) => Parser a
+ Text.ParserCombinators.UU.Utils: pNaturalRaw :: Num a => Parser a
Files
- src/Text/ParserCombinators/UU/BasicInstances.hs +6/−4
- src/Text/ParserCombinators/UU/Core.hs +19/−12
- uu-parsinglib.cabal +8/−8
src/Text/ParserCombinators/UU/BasicInstances.hs view
@@ -8,6 +8,7 @@ NoMonomorphismRestriction, TypeSynonymInstances, ScopedTypeVariables,+ BangPatterns, TypeOperators #-} -- | This module contains basic instances for the class interface described in the "Text.ParserCombinators.UU.Core" module.@@ -46,6 +47,7 @@ import Data.Word -- import Debug.Trace import qualified Data.ListLike as LL+import Data.List (foldl') -- * `Error` -- |The data type `Error` describes the various kinds of errors which can be generated by the instances in this module@@ -83,7 +85,7 @@ -- | the accumulated error messages msgs :: [Error loc], -- | the current input position - pos :: loc, + pos :: !loc, -- | we want to avoid deletions after insertions deleteOk :: !Bool }@@ -101,10 +103,10 @@ -- The first parameter is the current position, and the second parameter the part which has been removed from the input. instance IsLocationUpdatedBy Int Char where- advance pos _ = pos + 1+ advance !pos _ = pos + 1 instance IsLocationUpdatedBy Int Word8 where- advance pos _ = pos + 1+ advance !pos _ = pos + 1 data LineCol = LineCol !Int !Int deriving Show instance IsLocationUpdatedBy LineCol Char where@@ -121,7 +123,7 @@ _ -> LineColPos line (pos + 1) (abs + 1) instance IsLocationUpdatedBy loc a => IsLocationUpdatedBy loc [a] where- advance = foldl advance + advance = foldl' advance instance (Show a, LL.ListLike s a) => Eof (Str a s loc) where eof (Str i _ _ _ ) = LL.null i
src/Text/ParserCombinators/UU/Core.hs view
@@ -538,18 +538,25 @@ ) (maxBound, error "getCheapest") l -traverse :: Int -> Steps a -> Int -> Int -> Int -traverse 0 _ v c = trace' ("traverse " ++ show' 0 v c ++ " choosing" ++ show v ++ "\n") v-traverse n (Step _ l) v c = trace' ("traverse Step " ++ show' n v c ++ "\n") (traverse (n - 1 ) l (v - n) c)-traverse n (Micro x l) v c = trace' ("traverse Micro " ++ show' n v c ++ "\n") (traverse n l v c)-traverse n (Apply _ l) v c = trace' ("traverse Apply " ++ show n ++ "\n") (traverse n l v c)-traverse n (Fail m m2ls) v c = trace' ("traverse Fail " ++ show m ++ show' n v c ++ "\n") - (foldr (\ (w,l) c' -> if v + w < c' then traverse (n - 1 ) l (v+w) c'- else c') c (map ($m) m2ls)- )-traverse n (End_h ((a, lf)) r) v c = traverse n (lf a `best` removeEnd_h r) v c-traverse n (End_f (l :_) r) v c = traverse n (l `best` r) v c-traverse n (Done _ ) v c = trace' ("traverse at Done" ++ show' 0 v c ++ " choosing" ++ show v ++ "\n") 0+traverse :: Int -> Steps a -> Int -> Int -> Int+traverse 0 _ v c = trace' ("traverse " ++ show' 0 v c ++ " choosing " ++ show v ++ "\n") $+ v + 100 -- uncertainty cost+traverse n (Step _ l) v c = trace' ("traverse Step " ++ show' n v c ++ "\n") $+ traverse (n - 1) l v c+traverse n (Micro x l) v c = trace' ("traverse Micro " ++ show' n v c ++ "\n") $+ traverse n l v c+traverse n (Apply _ l) v c = trace' ("traverse Apply " ++ show n ++ "\n") $+ traverse n l v c+traverse n (Fail m m2ls) v c = trace' ("traverse Fail " ++ show m ++ " " ++ show' n v c ++ " length m2ls = " ++ show (length m2ls) ++ "\n") $+ foldr ((\ (w,l) c' -> if v + w < c' then traverse (n - 1 ) l (v+w) c'+ else c') . ($m)) c m2ls+traverse n (End_h (a, lf) r) v c = trace' ("traverse End_h " ++ show' n v c ++ "\n") $+ traverse n (lf a `best` removeEnd_h r) v c+traverse n (End_f (l :_) r) v c = trace' ("traverse End_f " ++ show' n v c ++ "\n") $+ traverse n (l `best` r) v c+traverse n (End_f [] r) v c = error "Cannot traverse End_f with empty list"+traverse n (Done _ ) v c = trace' ("traverse Done " ++ show' n v c ++ " choosing " ++ show v ++ "\n")+ v show' :: (Show a, Show b, Show c) => a -> b -> c -> String show' n v c = "n: " ++ show n ++ " v: " ++ show v ++ " c: " ++ show c
uu-parsinglib.cabal view
@@ -1,14 +1,13 @@ Name: uu-parsinglib-Version: 2.9.1.1+Version: 2.9.2 Build-Type: Simple License: MIT Copyright: S Doaitse Swierstra License-file: LICENSE Author: Doaitse Swierstra, Utrecht University-Maintainer: Doaitse Swierstra -Stability: stable, but evolving-Homepage: http://www.cs.uu.nl/wiki/bin/view/HUT/ParserCombinators-Bug-reports: mailto:doaitse@swierstra.net +Maintainer: Jeroen Bransen+Stability: stable+Bug-reports: https://github.com/UU-ComputerScience/uu-parsinglib/issues Synopsis: Fast, online, error-correcting, monadic, applicative, merging, permuting, interleaving, idiomatic parser combinators. Description: New version of the Utrecht University parser combinator library, which provides online, error correction, annotation free, applicative style parser combinators. In addition to this we provide a monadic and an idomatic interface.@@ -30,14 +29,15 @@ We maintain a low frequency mailing for discussing the package. You can subscribe at: <http://lists.science.uu.nl/mailman/listinfo/parsing> Category: Parsing,Text,ParserCombinators -cabal-version: >= 1.6+cabal-version: >= 1.10 source-repository head- type: svn- location: https://svn.science.uu.nl/repos/project.STEC.uu-parsinglib/trunk+ type: git+ location: https://github.com/UU-ComputerScience/uu-parsinglib Library hs-source-dirs: src+ default-language: Haskell2010 Build-Depends: base >= 4.2 && <5, time, ListLike >= 3.0.1, uu-interleaved >= 0.1.0 && < 0.3