packages feed

indentation 0.2.0.3 → 0.2.1

raw patch · 4 files changed

+36/−9 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Text.Trifecta.Indentation: data IndentationState
+ Text.Trifecta.Indentation: data Token

Files

CHANGELOG.md view
@@ -1,3 +1,11 @@+# 0.2.1 #++* Export 'Token' from 'Text.Trifecta.Indentation'++  * Add new testcase++* Re-export 'Text.Parser.Indentation.Implementation.IndentationState' from 'Text.Trifecta.Indentation'+ # 0.2.0.3 #  * Add (simple) tests for Parsec and Trifecta.
Text/Trifecta/Indentation.hs view
@@ -3,7 +3,9 @@ -- Implements "Indentation Senstivie Parsing" for Trifecta module Text.Trifecta.Indentation (   I.IndentationRel(..), I.Indentation, I.infIndentation, I.mkIndentationState,+  I.IndentationState,   IndentationParsing(..),+  Token,   IndentationParserT,   runIndentationParserT,   evalIndentationParserT,
indentation.cabal view
@@ -1,5 +1,5 @@ name:                indentation-version:             0.2.0.3+version:             0.2.1 synopsis:            Indentation sensitive parsing combinators for Parsec and Trifecta description:         Indentation sensitive parsing combinators for Parsec and Trifecta.                      .                     
tests/ParensTrifecta.hs view
@@ -34,13 +34,21 @@     ]  -runParse input- = let indA = evalIndentationParserT (a :: IndentationParserT Char Parser A)-              $ mkIndentationState 0 infIndentation True Gt+evalCharIndentationParserT :: Monad m => IndentationParserT Char m a -> IndentationState -> m a+evalCharIndentationParserT = evalIndentationParserT++evalTokenIndentationParserT :: Monad m => IndentationParserT Token m a -> IndentationState -> m a+evalTokenIndentationParserT = evalIndentationParserT++runParse ev input+ = let indA = ev a $ mkIndentationState 0 infIndentation True Gt    in case parseString indA mempty input of     Failure err -> Left (show err)     Success a -> Right a +runCharParse = runParse evalCharIndentationParserT+runTokenParse = runParse evalTokenIndentationParserT+ -- conveniences for tests parL = Par . listToSeq braL = Bra . listToSeq@@ -54,7 +62,8 @@                  , "      ]"                  , ")"                  ]-output1 = runParse input1+output1c = runCharParse input1+output1t = runTokenParse input1 expected1 = listToSeq [ parL [braL [parL []]]                       ] @@ -68,7 +77,8 @@                  , "   )"                  , ")"                  ]-output2 = runParse input2+output2c = runCharParse input2+output2t = runTokenParse input2 expected2 = listToSeq [ parL [ braL [ parL []                                     , braL []                                     ]@@ -82,11 +92,18 @@   case actual of    Right ok -> assertEqual "parsing succeeded, but " expected ok    Left err -> assertFailure ("parse failed with " ++ show err-                              ++ ", expected" ++ show expected)+                              ++ ", expected " ++ show expected)  allTests :: TestTree allTests =   testGroup "parens (trifecta)"-  [ testCase "1" $ assertParsedOk output1 expected1-  , testCase "2" $ assertParsedOk output2 expected2+  [+    testGroup "char parsing"+    [ testCase "1" $ assertParsedOk output1c expected1+    , testCase "2" $ assertParsedOk output2c expected2+    ]+  , testGroup "token parsing"+    [ testCase "1" $ assertParsedOk output1t expected1+    , testCase "2" $ assertParsedOk output2t expected2+    ]   ]