tlex-th 0.3.0.0 → 0.4.0.0
raw patch · 4 files changed
+33/−39 lines, 4 filesdep +enummapsetdep −enummapset-thdep ~arraydep ~basedep ~containersPVP ok
version bump matches the API change (PVP)
Dependencies added: enummapset
Dependencies removed: enummapset-th
Dependency ranges changed: array, base, containers, ghc-prim, template-haskell, tlex, tlex-core
API changes (from Hackage documentation)
- Language.Lexer.Tlex.Plugin.TH: thLexRule :: Enum e => Enum s => [s] -> Pattern e -> Q (TExp a) -> THScannerBuilder s e a ()
+ Language.Lexer.Tlex.Plugin.TH: thLexRule :: Enum e => Enum s => [s] -> Pattern e -> Code Q a -> THScannerBuilder s e a ()
Files
- src/Language/Lexer/Tlex/Data/TypeableTH.hs +8/−14
- src/Language/Lexer/Tlex/Output/TH.hs +11/−11
- src/Language/Lexer/Tlex/Plugin/TH.hs +2/−2
- tlex-th.cabal +12/−12
src/Language/Lexer/Tlex/Data/TypeableTH.hs view
@@ -20,20 +20,14 @@ do tyConToType tyCon do [ go r | r <- rs ] --- |------ TODO: correct reifying--- NOTICE: introduce @reifyType@ by GHC 8.10--- tyConToType :: Typeable.TyCon -> TH.Q TH.Type-tyConToType tyCon = do- mn <- TH.lookupTypeName tyConQualifiedName- case mn of+tyConToType tyCon = TH.lookupTypeName tyConQualifiedName >>= \case+ Just n -> pure do TH.ConT n+ Nothing -> TH.lookupTypeName tyConName >>= \case Just n -> pure do TH.ConT n- Nothing -> case tyConQualifiedName of- "GHC.Tuple.()" ->- pure do TH.TupleT 0- _ ->- fail do "Missing type: " ++ tyConQualifiedName+ Nothing -> case tyConName of+ "()" -> pure do TH.TupleT 0+ _ -> fail do "Missing type: " ++ tyConQualifiedName where- tyConQualifiedName = Typeable.tyConModule tyCon ++ "." ++ Typeable.tyConName tyCon+ tyConName = Typeable.tyConName tyCon+ tyConQualifiedName = Typeable.tyConModule tyCon ++ "." ++ tyConName
src/Language/Lexer/Tlex/Output/TH.hs view
@@ -50,15 +50,15 @@ in ST.runST do ST.ST \s0# -> case unitSize of TlexTransStateSize8 -> case Prim.readWord8OffAddr# table# i# s0# of- (# s1#, r# #) -> case r# of- 255## -> (# s1#, -1 #)- _ -> (# s1#, Types.I# do Prim.word2Int# r# #)+ (# s1#, r# #) -> case Prim.int8ToInt# do Prim.word8ToInt8# r# of+ 255# -> (# s1#, -1 #)+ ri# -> (# s1#, Types.I# ri# #) TlexTransStateSize16 -> case Prim.readWord16OffAddr# table# i# s0# of- (# s1#, r# #) -> case r# of- 65535## -> (# s1#, -1 #)- _ -> (# s1#, Types.I# do Prim.word2Int# r# #)+ (# s1#, r# #) -> case Prim.int16ToInt# do Prim.word16ToInt16# r# of+ 65535# -> (# s1#, -1 #)+ ri# -> (# s1#, Types.I# ri# #) TlexTransStateSize32 -> case Prim.readInt32OffAddr# table# i# s0# of- (# s1#, r# #) -> (# s1#, Types.I# r# #)+ (# s1#, r# #) -> (# s1#, Types.I# do Prim.int32ToInt# r# #) type TlexArray = Array.Array Int @@ -260,11 +260,11 @@ | n == -1 = replicate us 0xFF | otherwise = error "unsupported" where- mod8bit = case Bits.bitSizeMaybe n of- Nothing -> \x -> x Bits..&. 0xFF+ mod8bit x = case Bits.bitSizeMaybe n of+ Nothing -> x Bits..&. 0xFF Just bs- | bs <= 8 -> \x -> x- | otherwise -> \x -> x Bits..&. 0xFF+ | bs <= 8 -> x+ | otherwise -> x Bits..&. 0xFF outputTlexAcceptFn :: DFA.DFA (TH.Q TH.Exp) -> (TH.Q TH.Type) -> TH.Name -> TH.Q TH.Dec
src/Language/Lexer/Tlex/Plugin/TH.hs view
@@ -88,8 +88,8 @@ } pure x -thLexRule :: Enum e => Enum s => [s] -> Tlex.Pattern e -> TH.Q (TH.TExp a) -> THScannerBuilder s e a ()-thLexRule ss p act = liftTlexScannerBuilder do Tlex.lexRule ss p do TH.unType <$> act+thLexRule :: Enum e => Enum s => [s] -> Tlex.Pattern e -> TH.Code TH.Q a -> THScannerBuilder s e a ()+thLexRule ss p act = liftTlexScannerBuilder do Tlex.lexRule ss p do TH.unTypeCode act outputScanner :: Enum e => THScanner e -> TH.Q [TH.Dec]
tlex-th.cabal view
@@ -2,7 +2,7 @@ build-type: Custom name: tlex-th-version: 0.3.0.0+version: 0.4.0.0 license: Apache-2.0 OR MPL-2.0 license-file: LICENSE copyright: (c) 2021 Mizunashi Mana@@ -89,16 +89,16 @@ -dcore-lint build-depends:- base >= 4.12.0 && < 4.15,+ base >= 4.12.0 && < 5, -- project depends- tlex-core >= 0.3.0 && < 0.4,- tlex >= 0.3.0 && < 0.4,- ghc-prim >= 0.5.3 && < 0.7,- template-haskell >= 2.14.0 && < 2.17.0,- array >= 0.5.3 && < 0.6,- containers >= 0.6.0 && < 0.7,- enummapset-th >= 0.6.0 && < 0.7,+ tlex-core >= 0.4.0 && < 0.5,+ tlex >= 0.4.0 && < 0.5,+ ghc-prim >= 0.8.0 && < 1,+ template-haskell >= 2.17.0 && < 3,+ array >= 0.5.3 && < 1,+ containers >= 0.6.0 && < 1,+ enummapset >= 0.7.1 && < 1, autogen-modules: Paths_tlex_th@@ -107,9 +107,9 @@ custom-setup setup-depends:- base,- Cabal,- cabal-doctest,+ base >= 4.12.0 && < 5,+ Cabal >= 3.6 && < 4,+ cabal-doctest >= 1.0.9 && < 2, library import: