@@ -36,7 +36,7 @@ import Effect.Console (log, logShow)
3636import Effect.Unsafe (unsafePerformEffect )
3737import Node.Process (lookupEnv )
3838import Parsing (ParseError (..), ParseState (..), Parser , ParserT , Position (..), consume , fail , getParserT , initialPos , parseErrorPosition , position , region , runParser )
39- import Parsing.Combinators (advance , between , chainl , chainl1 , chainr , chainr1 , choice , empty , endBy , endBy1 , lookAhead , many , many1 , many1Till , many1Till_ , manyIndex , manyTill , manyTill_ , notFollowedBy , optionMaybe , replicateA , sepBy , sepBy1 , sepEndBy , sepEndBy1 , skipMany , skipMany1 , try , tryRethrow , (<?>), (<??>), (<~?>))
39+ import Parsing.Combinators (advance , between , chainl , chainl1 , chainr , chainr1 , choice , empty , endBy , endBy1 , lookAhead , many , many1 , many1Till , many1Till_ , manyIndex , manyTill , manyTill_ , notFollowedBy , optional , optionMaybe , replicateA , sepBy , sepBy1 , sepEndBy , sepEndBy1 , skipMany , skipMany1 , try , tryRethrow , (<?>), (<??>), (<~?>))
4040import Parsing.Combinators.Array as Combinators.Array
4141import Parsing.Expr (Assoc (..), Operator (..), buildExprParser )
4242import Parsing.Language (haskellDef , haskellStyle , javaStyle )
@@ -572,6 +572,13 @@ javaStyleTest = do
572572 " hello {- comment\n -} foo"
573573 (mkPos 7 )
574574
575+ takeWhilePropagatFail :: TestM
576+ takeWhilePropagatFail = do
577+ parseErrorTestPosition
578+ (optional $ (char ' f' <* takeWhile CodePoint.Unicode .isSpace <* fail " test failure" ))
579+ " f"
580+ (Position { index: 1 , line: 1 , column: 2 })
581+
575582main :: Effect Unit
576583main = do
577584
@@ -734,6 +741,8 @@ main = do
734741 , expected: Left $ ParseError " Expected letter" (Position { index: 0 , line: 1 , column: 1 })
735742 }
736743
744+ takeWhilePropagatFail
745+
737746 log " \n TESTS number\n "
738747
739748 -- assert' "Number.fromString" $ Just infinity == Data.Number.fromString "Infinity"
0 commit comments