parsley-core 2.1.0.0 → 2.1.0.1
raw patch · 70 files changed
+55/−16 lines, 70 filesdep ~basePVP: minor bump suggested
API additions: PVP suggests at least a minor version bump
Dependency ranges changed: base
API changes (from Hackage documentation)
+ Parsley.Internal.Backend.Machine.InputOps: word16ToWord# :: Word# -> Word#
+ Parsley.Internal.Backend.Machine.InputOps: word8ToWord# :: Word# -> Word#
Files
- ChangeLog.md +5/−0
- README.md +0/−0
- benchmarks/BenchmarkUtils.hs +0/−0
- benchmarks/RangeSetBench.hs +0/−0
- parsley-core.cabal +7/−3
- src/ghc-8.10+/Parsley/Internal/Backend/Machine.hs +0/−0
- src/ghc-8.10+/Parsley/Internal/Backend/Machine/BindingOps.hs +0/−0
- src/ghc-8.10+/Parsley/Internal/Backend/Machine/Defunc.hs +0/−0
- src/ghc-8.10+/Parsley/Internal/Backend/Machine/Eval.hs +0/−0
- src/ghc-8.10+/Parsley/Internal/Backend/Machine/InputOps.hs +25/−5
- src/ghc-8.10+/Parsley/Internal/Backend/Machine/InputRep.hs +7/−3
- src/ghc-8.10+/Parsley/Internal/Backend/Machine/Ops.hs +0/−0
- src/ghc-8.10+/Parsley/Internal/Backend/Machine/PosOps.hs +0/−0
- src/ghc-8.10+/Parsley/Internal/Backend/Machine/Types.hs +0/−0
- src/ghc-8.10+/Parsley/Internal/Backend/Machine/Types/Base.hs +0/−0
- src/ghc-8.10+/Parsley/Internal/Backend/Machine/Types/Context.hs +0/−0
- src/ghc-8.10+/Parsley/Internal/Backend/Machine/Types/Input.hs +0/−0
- src/ghc-8.10+/Parsley/Internal/Backend/Machine/Types/Input/Offset.hs +0/−0
- src/ghc-8.10+/Parsley/Internal/Backend/Machine/Types/Input/Pos.hs +0/−0
- src/ghc-8.10+/Parsley/Internal/Backend/Machine/Types/State.hs +0/−0
- src/ghc-8.10+/Parsley/Internal/Backend/Machine/Types/Statics.hs +0/−0
- src/ghc-8.6+/Parsley/Internal/Backend/Machine.hs +0/−0
- src/ghc-8.6+/Parsley/Internal/Backend/Machine/Defunc.hs +0/−0
- src/ghc-8.6+/Parsley/Internal/Backend/Machine/Eval.hs +0/−0
- src/ghc-8.6+/Parsley/Internal/Backend/Machine/InputOps.hs +0/−0
- src/ghc-8.6+/Parsley/Internal/Backend/Machine/InputRep.hs +0/−0
- src/ghc-8.6+/Parsley/Internal/Backend/Machine/Ops.hs +0/−0
- src/ghc-8.6+/Parsley/Internal/Backend/Machine/Types/State.hs +0/−0
- src/ghc/Parsley/Internal.hs +0/−0
- src/ghc/Parsley/Internal/Backend.hs +0/−0
- src/ghc/Parsley/Internal/Backend/Analysis.hs +0/−0
- src/ghc/Parsley/Internal/Backend/Analysis/Coins.hs +0/−0
- src/ghc/Parsley/Internal/Backend/Analysis/Inliner.hs +0/−0
- src/ghc/Parsley/Internal/Backend/Machine/Identifiers.hs +0/−0
- src/ghc/Parsley/Internal/Backend/Machine/LetBindings.hs +0/−0
- src/ghc/Parsley/Internal/Backend/Machine/LetRecBuilder.hs +0/−0
- src/ghc/Parsley/Internal/Backend/Machine/THUtils.hs +0/−0
- src/ghc/Parsley/Internal/Backend/Machine/Types/Coins.hs +0/−0
- src/ghc/Parsley/Internal/Backend/Machine/Types/InputCharacteristic.hs +0/−0
- src/ghc/Parsley/Internal/Common.hs +0/−0
- src/ghc/Parsley/Internal/Common/Fresh.hs +0/−0
- src/ghc/Parsley/Internal/Common/Queue/Impl.hs +0/−0
- src/ghc/Parsley/Internal/Common/QueueLike.hs +0/−0
- src/ghc/Parsley/Internal/Common/RangeSet.hs +2/−2
- src/ghc/Parsley/Internal/Common/RewindQueue/Impl.hs +0/−0
- src/ghc/Parsley/Internal/Common/State.hs +0/−0
- src/ghc/Parsley/Internal/Common/Utils.hs +2/−2
- src/ghc/Parsley/Internal/Common/Vec.hs +0/−0
- src/ghc/Parsley/Internal/Core.hs +0/−0
- src/ghc/Parsley/Internal/Core/CharPred.hs +1/−0
- src/ghc/Parsley/Internal/Core/Defunc.hs +1/−1
- src/ghc/Parsley/Internal/Core/Identifiers.hs +0/−0
- src/ghc/Parsley/Internal/Core/InputTypes.hs +0/−0
- src/ghc/Parsley/Internal/Core/Lam.hs +5/−0
- src/ghc/Parsley/Internal/Core/Primitives.hs +0/−0
- src/ghc/Parsley/Internal/Frontend.hs +0/−0
- src/ghc/Parsley/Internal/Frontend/Analysis.hs +0/−0
- src/ghc/Parsley/Internal/Frontend/Analysis/Dependencies.hs +0/−0
- src/ghc/Parsley/Internal/Frontend/Analysis/Flags.hs +0/−0
- src/ghc/Parsley/Internal/Frontend/Compiler.hs +0/−0
- src/ghc/Parsley/Internal/Frontend/Optimiser.hs +0/−0
- src/ghc/Parsley/Internal/Verbose.hs +0/−0
- test/CommonTest.hs +0/−0
- test/CommonTest/Queue.hs +0/−0
- test/CommonTest/RangeSet.hs +0/−0
- test/Primitive.hs +0/−0
- test/Primitive/Parsers.hs +0/−0
- test/Regression/Issue27.hs +0/−0
- test/RegressionTest.hs +0/−0
- test/TestUtils.hs +0/−0
ChangeLog.md view
@@ -161,3 +161,8 @@ * Added `INPUT` to 8.6+ backend for `Defunc`. * Added a `poke` method to `QueueLike`. * Added a `charPred` converter to `Defunc`.++## 2.1.0.1 -- 2022-06-01++* Added normalisation rule for lets in `Lam`.+* Added GHC 9.2 support
README.md view
benchmarks/BenchmarkUtils.hs view
benchmarks/RangeSetBench.hs view
parsley-core.cabal view
@@ -5,7 +5,7 @@ -- | +------- breaking internal API changes -- | | +----- non-breaking API additions -- | | | +--- code changes with no API change-version: 2.1.0.0+version: 2.1.0.1 synopsis: A fast parser combinator library backed by Typed Template Haskell description: This package contains the internals of the @parsley@ package. .@@ -29,7 +29,8 @@ tested-with: GHC == 8.6.1, GHC == 8.6.2, GHC == 8.6.3, GHC == 8.6.4, GHC == 8.6.5, GHC == 8.8.1, GHC == 8.8.2, GHC == 8.8.3, GHC == 8.8.4, GHC == 8.10.4, GHC == 8.10.5, GHC == 8.10.7,- GHC == 9.0.1+ GHC == 9.0.1, GHC == 9.0.2,+ GHC == 9.2.3 flag full-width-positions description: Make line and column numbers 64-bit (on 64-bit platforms): normally they are 32-bits each for line and column.@@ -129,7 +130,7 @@ NoStarIsType -- ghc >= 8.6 && < 9.2,- build-depends: base >= 4.10 && < 4.16,+ build-depends: base >= 4.10 && < 4.17, mtl >= 2.2.1 && < 2.3, hashable >= 1.2.7.0 && < 1.4, unordered-containers >= 0.2.13 && < 0.3,@@ -168,6 +169,9 @@ ghc-options: -Wno-missing-safe-haskell-mode -Wno-prepositive-qualified-module -Wno-unused-packages+ if impl(ghc >= 9.2)+ ghc-options: -Wno-missing-kind-signatures+ -Wno-implicit-lift if flag(full-width-positions) cpp-options: -DFULL_WIDTH_POSITIONS
src/ghc-8.10+/Parsley/Internal/Backend/Machine.hs view
src/ghc-8.10+/Parsley/Internal/Backend/Machine/BindingOps.hs view
src/ghc-8.10+/Parsley/Internal/Backend/Machine/Defunc.hs view
src/ghc-8.10+/Parsley/Internal/Backend/Machine/Eval.hs view
src/ghc-8.10+/Parsley/Internal/Backend/Machine/InputOps.hs view
@@ -1,5 +1,6 @@ {-# OPTIONS_HADDOCK show-extensions #-}-{-# LANGUAGE ImplicitParams,+{-# LANGUAGE CPP,+ ImplicitParams, MagicHash, TypeApplications, UnboxedTuples #-}@@ -18,6 +19,9 @@ module Parsley.Internal.Backend.Machine.InputOps ( InputPrep(..), PositionOps(..), LogOps(..), InputOps(..), more, next,+#if __GLASGOW_HASKELL__ <= 900+ word8ToWord#, word16ToWord#,+#endif InputDependant ) where @@ -29,6 +33,11 @@ import GHC.Exts (Int(..), Char(..), TYPE, Int#) import GHC.ForeignPtr (ForeignPtr(..)) import GHC.Prim (indexWideCharArray#, indexWord16Array#, readWord8OffAddr#, word2Int#, chr#, touch#, realWorld#, plusAddr#, (+#), (-#))+#if __GLASGOW_HASKELL__ > 900+import GHC.Prim (word16ToWord#, word8ToWord#)+#else+import GHC.Prim (Word#)+#endif import Parsley.Internal.Backend.Machine.InputRep (Stream(..), CharList(..), Text16(..), Rep, UnpackedLazyByteString, offWith, emptyUnpackedLazyByteString, intSame, intLess, offsetText, offWithSame, offWithShiftRight, dropStream,@@ -39,6 +48,17 @@ import qualified Data.ByteString.Lazy.Internal as Lazy (ByteString(..)) --import qualified Data.Text as Text (length, index) ++#if __GLASGOW_HASKELL__ <= 900+{-# INLINE word8ToWord# #-}+word8ToWord# :: Word# -> Word#+word8ToWord# x = x++{-# INLINE word16ToWord# #-}+word16ToWord# :: Word# -> Word#+word16ToWord# x = x+#endif+ {- Auxillary Representation -} {-| Given some associated representation type, defines the operations@@ -166,7 +186,7 @@ prepare qinput = [|| let Text16 (Text arr (I# off#) (I# size#)) = $$qinput arr# = aBA arr- next i# = (# C# (chr# (word2Int# (indexWord16Array# arr# i#))), i# +# 1# #)+ next i# = (# C# (chr# (word2Int# (word16ToWord# (indexWord16Array# arr# i#)))), i# +# 1# #) in (# next, \qi -> $$(intLess [||qi||] [||size#||]), off# #) ||] @@ -176,7 +196,7 @@ next i# = case readWord8OffAddr# (addr# `plusAddr#` i#) 0# realWorld# of (# s', x #) -> case touch# final s' of- _ -> (# C# (chr# (word2Int# x)), i# +# 1# #)+ _ -> (# C# (chr# (word2Int# (word8ToWord# x))), i# +# 1# #) in (# next, \qi -> $$(intLess [||qi||] [||size#||]), off# #) ||] @@ -193,7 +213,7 @@ instance InputPrep Text where prepare qinput = [||- let next t@(Text arr off unconsumed) = let !(Iter c d) = iter t 0 in (# c, Text arr (off+d) (unconsumed-d) #)+ let next t@(Text arr off unconsumed) = let !(Iter c d) = iter t 0 in (# c, Text arr (off + d) (unconsumed - d) #) more (Text _ _ unconsumed) = unconsumed > 0 in (# next, more, $$qinput #) ||]@@ -203,7 +223,7 @@ let next (# i#, addr#, final, off#, size#, cs #) = case readWord8OffAddr# addr# off# realWorld# of (# s', x #) -> case touch# final s' of- _ -> (# C# (chr# (word2Int# x)),+ _ -> (# C# (chr# (word2Int# (word8ToWord# x))), if I# size# /= 1 then (# i# +# 1#, addr#, final, off# +# 1#, size# -# 1#, cs #) else case cs of Lazy.Chunk (PS (ForeignPtr addr'# final') (I# off'#) (I# size'#)) cs' ->
src/ghc-8.10+/Parsley/Internal/Backend/Machine/InputRep.hs view
@@ -1,5 +1,6 @@ {-# OPTIONS_HADDOCK show-extensions #-}-{-# LANGUAGE MagicHash,+{-# LANGUAGE CPP,+ MagicHash, TypeFamilies, UnboxedTuples, StandaloneKindSignatures #-}@@ -49,6 +50,9 @@ import Data.Text.Internal (Text(..)) import Data.Text.Unsafe (iter_, reverseIter_) import GHC.Exts (Int(..), TYPE, RuntimeRep(..), (==#), (<#), (+#), (-#), isTrue#)+#if __GLASGOW_HASKELL__ > 900+import GHC.Exts (LiftedRep)+#endif import GHC.ForeignPtr (ForeignPtr(..), ForeignPtrContents) import GHC.Prim (Int#, Addr#, nullAddr#) import Parsley.Internal.Common.Utils (Code)@@ -218,7 +222,7 @@ go 0 off' unconsumed' = Text arr off' unconsumed' go n off' unconsumed' | unconsumed' > 0 = let !d = iter_ (Text arr off' unconsumed') 0- in go (n-1) (off'+d) (unconsumed'-d)+ in go (n - 1) (off' + d) (unconsumed' - d) | otherwise = Text arr off' unconsumed' {-|@@ -231,7 +235,7 @@ where go 0 off' unconsumed' = Text arr off' unconsumed' go n off' unconsumed'- | off' > 0 = let !d = reverseIter_ (Text arr off' unconsumed') 0 in go (n-1) (off'+d) (unconsumed'-d)+ | off' > 0 = let !d = reverseIter_ (Text arr off' unconsumed') 0 in go (n - 1) (off' + d) (unconsumed' - d) | otherwise = Text arr off' unconsumed' {-# INLINE emptyUnpackedLazyByteString' #-}
src/ghc-8.10+/Parsley/Internal/Backend/Machine/Ops.hs view
src/ghc-8.10+/Parsley/Internal/Backend/Machine/PosOps.hs view
src/ghc-8.10+/Parsley/Internal/Backend/Machine/Types.hs view
src/ghc-8.10+/Parsley/Internal/Backend/Machine/Types/Base.hs view
src/ghc-8.10+/Parsley/Internal/Backend/Machine/Types/Context.hs view
src/ghc-8.10+/Parsley/Internal/Backend/Machine/Types/Input.hs view
src/ghc-8.10+/Parsley/Internal/Backend/Machine/Types/Input/Offset.hs view
src/ghc-8.10+/Parsley/Internal/Backend/Machine/Types/Input/Pos.hs view
src/ghc-8.10+/Parsley/Internal/Backend/Machine/Types/State.hs view
src/ghc-8.10+/Parsley/Internal/Backend/Machine/Types/Statics.hs view
src/ghc-8.6+/Parsley/Internal/Backend/Machine.hs view
src/ghc-8.6+/Parsley/Internal/Backend/Machine/Defunc.hs view
src/ghc-8.6+/Parsley/Internal/Backend/Machine/Eval.hs view
src/ghc-8.6+/Parsley/Internal/Backend/Machine/InputOps.hs view
src/ghc-8.6+/Parsley/Internal/Backend/Machine/InputRep.hs view
src/ghc-8.6+/Parsley/Internal/Backend/Machine/Ops.hs view
src/ghc-8.6+/Parsley/Internal/Backend/Machine/Types/State.hs view
src/ghc/Parsley/Internal.hs view
src/ghc/Parsley/Internal/Backend.hs view
src/ghc/Parsley/Internal/Backend/Analysis.hs view
src/ghc/Parsley/Internal/Backend/Analysis/Coins.hs view
src/ghc/Parsley/Internal/Backend/Analysis/Inliner.hs view
src/ghc/Parsley/Internal/Backend/Machine/Identifiers.hs view
src/ghc/Parsley/Internal/Backend/Machine/LetBindings.hs view
src/ghc/Parsley/Internal/Backend/Machine/LetRecBuilder.hs view
src/ghc/Parsley/Internal/Backend/Machine/THUtils.hs view
src/ghc/Parsley/Internal/Backend/Machine/Types/Coins.hs view
src/ghc/Parsley/Internal/Backend/Machine/Types/InputCharacteristic.hs view
src/ghc/Parsley/Internal/Common.hs view
src/ghc/Parsley/Internal/Common/Fresh.hs view
src/ghc/Parsley/Internal/Common/Queue/Impl.hs view
src/ghc/Parsley/Internal/Common/QueueLike.hs view
src/ghc/Parsley/Internal/Common/RangeSet.hs view
@@ -348,7 +348,7 @@ {-# NOINLINE balanceL #-} balanceL :: Size -> a -> a -> RangeSet a -> RangeSet a -> RangeSet a -- PRE: left grew or right shrank, difference in height at most 2 biasing to the left-balanceL !sz !l1 !u1 lt@(Fork !hlt !szl !l2 !u2 !llt !rlt) !rt+balanceL !sz !l1 !u1 lt@(Fork hlt szl l2 u2 llt rlt) !rt -- both sides are equal height or off by one | dltrt <= 1 = forkSz sz l1 u1 lt rt -- The bias is 2 (dltrt == 2)@@ -365,7 +365,7 @@ {-# NOINLINE balanceR #-} balanceR :: Size -> a -> a -> RangeSet a -> RangeSet a -> RangeSet a -- PRE: left shrank or right grew, difference in height at most 2 biasing to the right-balanceR !sz !l1 !u1 !lt rt@(Fork !hrt szr l2 u2 lrt rrt)+balanceR !sz !l1 !u1 !lt rt@(Fork hrt szr l2 u2 lrt rrt) -- both sides are equal height or off by one | drtlt <= 1 = forkSz sz l1 u1 lt rt -- The bias is 2 (drtlt == 2)
src/ghc/Parsley/Internal/Common/RewindQueue/Impl.hs view
src/ghc/Parsley/Internal/Common/State.hs view
src/ghc/Parsley/Internal/Common/Utils.hs view
@@ -6,11 +6,11 @@ #endif module Parsley.Internal.Common.Utils (WQ(..), Code, Quapplicative(..), intercalate, intercalateDiff) where -import Data.List (intersperse)+import Data.List (intersperse) import Data.String (IsString(..)) #if __GLASGOW_HASKELL__ >= 810-import Data.Kind (Type)+import Data.Kind (Type) import GHC.Exts (TYPE, RuntimeRep) #endif
src/ghc/Parsley/Internal/Common/Vec.hs view
src/ghc/Parsley/Internal/Core.hs view
src/ghc/Parsley/Internal/Core/CharPred.hs view
@@ -77,6 +77,7 @@ This given information can be used to optimise the new predicate the character is fed through. This works as follows:+ * If the given knowledge is a subset of the new predicate, then we /know/ that any character check will have passed, because it already passed a stricter check. The predicate can, therefore, be optimised to `Item`.
src/ghc/Parsley/Internal/Core/Defunc.hs view
@@ -211,5 +211,5 @@ show CONST = "const" show (IF_S c b e) = concat ["(if ", show c, " then ", show b, " else ", show e, ")"] show (LAM_S _) = "f"- show p@(RANGES{}) = show (charPred p)+ show p@RANGES{} = show (charPred p) show _ = "x"
src/ghc/Parsley/Internal/Core/Identifiers.hs view
src/ghc/Parsley/Internal/Core/InputTypes.hs view
src/ghc/Parsley/Internal/Core/Lam.hs view
@@ -58,6 +58,10 @@ T -> x F -> y c -> If c x y+ -- Reduction rule found courtesy of David Davies, forever immortalised+ reduce (Let v@(Var True _) f) = case f v of+ x | normal x -> x+ x -> reduce x reduce x = x normal :: Lam a -> Bool@@ -66,6 +70,7 @@ normal (If T _ _) = False normal (If F _ _) = False normal (If x _ _) = normal x+ normal (Let (Var True _) _) = False normal _ = True generate :: Lam a -> Code a
src/ghc/Parsley/Internal/Core/Primitives.hs view
src/ghc/Parsley/Internal/Frontend.hs view
src/ghc/Parsley/Internal/Frontend/Analysis.hs view
src/ghc/Parsley/Internal/Frontend/Analysis/Dependencies.hs view
src/ghc/Parsley/Internal/Frontend/Analysis/Flags.hs view
src/ghc/Parsley/Internal/Frontend/Compiler.hs view
src/ghc/Parsley/Internal/Frontend/Optimiser.hs view
src/ghc/Parsley/Internal/Verbose.hs view
test/CommonTest.hs view
test/CommonTest/Queue.hs view
test/CommonTest/RangeSet.hs view
test/Primitive.hs view
test/Primitive/Parsers.hs view
test/Regression/Issue27.hs view
test/RegressionTest.hs view
test/TestUtils.hs view