prefix-expression 1.0.2 → 1.1.0
raw patch · 3 files changed
+3/−2 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- prefix-expression.cabal +1/−1
- src/Text/Exp/Prefix.hs +1/−1
- test/Text/Exp/PrefixSpec.hs +1/−0
prefix-expression.cabal view
@@ -1,5 +1,5 @@ name: prefix-expression-version: 1.0.2+version: 1.1.0 -- synopsis: description: convert infix to prefix expression homepage: https://github.com/VonFry/prefix-expression
src/Text/Exp/Prefix.hs view
@@ -113,7 +113,7 @@ splitExp' sp exp | "" <- exp = filter (\x -> x /= "") sp | otherwise- = let match = exp =~ " +|\\( *[\\+-][0-9A-Za-z]+ *\\)|&&|\\^|\\|\\||=~|!|\\(|\\)|\\+|-|\\*|/|\\\\" :: String+ = let match = exp =~ " +|'.*'|\".*\"|\\( *[\\+-][0-9A-Za-z]+ *\\)|&&|\\^|\\|\\||=~|!|\\(|\\)|\\+|-|\\*|/|\\\\" :: String in if match /= "" then let Just (idx, _) = elemSubIndex match exp (arg, exp') = splitAt idx exp
test/Text/Exp/PrefixSpec.hs view
@@ -15,6 +15,7 @@ fromInfix "!((1 + 3) * 3 - 4 ^ 5)" `shouldBe` Right "! - * + 1 3 3 ^ 4 5" fromInfix "+2 * (-1) + 3" `shouldBe` Right "+ * +2 -1 3" fromInfix "a + b + c" `shouldBe` Right "+ + a b c"+ fromInfix "\"a\" + b + 'c'" `shouldBe` Right "+ + \"a\" b 'c'" it "failed" $ do (isLeft $ fromInfix "!((1 + 3) * 3 - 4 ^ 5") `shouldBe` True (isLeft $ fromInfix "1 + + 2") `shouldBe` True