lexer-applicative 1.0.0.1 → 1.1
raw patch · 3 files changed
+7/−14 lines, 3 filesdep ~srclocPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: srcloc
API changes (from Hackage documentation)
Files
- lexer-applicative.cabal +2/−2
- src/Language/Lexer/Applicative.hs +0/−7
- tests/test.hs +5/−5
lexer-applicative.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: lexer-applicative-version: 1.0.0.1+version: 1.1 synopsis: Simple lexer based on applicative regular expressions description: Simple lexer based on applicative regular expressions homepage: https://github.com/feuerbach/lexer-applicative@@ -29,7 +29,7 @@ -- other-extensions: build-depends: base >=4.5 && < 5,- srcloc,+ srcloc >= 0.5, regex-applicative >= 0.3.1 hs-source-dirs: src default-language: Haskell2010
src/Language/Lexer/Applicative.hs view
@@ -68,10 +68,3 @@ re :: RE (Char, Pos, Pos) (Maybe token) re = comap (\(c, _, _) -> c) $ (Just <$> pToken) <|> (Nothing <$ pJunk)---- | Format a position-displayPos :: Pos -> String-displayPos (Pos src line col _) =- src ++ (colon . shows line . colon . shows (col+1)) ""- where- colon = (':' :)
tests/test.hs view
@@ -21,10 +21,10 @@ [ testCase "Empty string" $ tokens (empty :: RE Char Int) empty "-" "" @=? [] , testCase "Space- and newline-separated numbers" $- unloc <$> tokens decimal whitespace "-" "1\n 23 456" @=?- [ (1, Loc (Pos "-" 1 0 0) (Pos "-" 1 0 0))- , (23, Loc (Pos "-" 2 1 3) (Pos "-" 2 2 4))- , (456,Loc (Pos "-" 2 5 7) (Pos "-" 2 7 9))+ unloc <$> tokens decimal whitespace "-" "1\n 23 456" @?=+ [ (1, Loc (Pos "-" 1 1 0) (Pos "-" 1 1 0))+ , (23, Loc (Pos "-" 2 2 3) (Pos "-" 2 3 4))+ , (456,Loc (Pos "-" 2 6 7) (Pos "-" 2 8 9)) ] , testCase "Nullable parser, no error" $ do r <- try . evaluate $ tokens decimal badWhitespace "-" "31 45"@@ -35,7 +35,7 @@ r <- try . evaluate . force $ tokens decimal badWhitespace "-" "31? 45" case r of Right (_ :: [L Int]) -> assertFailure "No error?"- Left (LexicalError p) -> p @?= Pos "-" 1 2 2+ Left (LexicalError p) -> p @?= Pos "-" 1 3 2 ] -- orphan