File tree Expand file tree Collapse file tree 2 files changed +6
-0
lines changed Expand file tree Collapse file tree 2 files changed +6
-0
lines changed Original file line number Diff line number Diff line change 8989
9090 manyTill :: forall s a m e. (Monad m) => ParserT s m a -> ParserT s m e -> ParserT s m [a]
9191
92+ notFollowedBy :: forall s a m. (Monad m) => ParserT s m a -> ParserT s m Unit
93+
9294 option :: forall m s a. (Monad m) => a -> ParserT s m a -> ParserT s m a
9395
9496 optionMaybe :: forall m s a. (Functor m, Monad m) => ParserT s m a -> ParserT s m (Maybe a)
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import Data.Either
77
88import Control.Alt
99import Control.Alternative
10+ import Control.Apply
1011import Control.Lazy
1112import Control.Monad
1213import Control.Monad.Error.Trans
@@ -120,6 +121,9 @@ lookAhead (ParserT p) = ParserT \s -> do
120121 state <- p s
121122 return state{input = s, consumed = false }
122123
124+ notFollowedBy :: forall s a m . (Monad m ) => ParserT s m a -> ParserT s m Unit
125+ notFollowedBy p = try $ (try p *> fail " Negated parser succeeded" ) <|> return unit
126+
123127manyTill :: forall s a m e . (Monad m ) => ParserT s m a -> ParserT s m e -> ParserT s m [a ]
124128manyTill p end = scan
125129 where
You can’t perform that action at this time.
0 commit comments