| License | BSD-3-Clause |
|---|---|
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
Swarm.Language.Parser.Util
Description
A few utilities for use in conjunction with the parser.
Synopsis
- fully :: MonadParsec e s f => f () -> f a -> f a
- fullyMaybe :: MonadParsec e s f => f () -> f a -> f (Maybe a)
- showShortError :: ParserError -> String
- showErrorPos :: ParserError -> ((Int, Int), (Int, Int), Text)
- getLocRange :: Text -> (Int, Int) -> ((Int, Int), (Int, Int))
Documentation
fully :: MonadParsec e s f => f () -> f a -> f a Source #
Run a parser "fully", consuming leading whitespace and ensuring that the parser extends all the way to eof.
fullyMaybe :: MonadParsec e s f => f () -> f a -> f (Maybe a) Source #
Run a parser "fully", consuming leading whitespace (including the possibility that the input is nothing but whitespace) and ensuring that the parser extends all the way to eof.
showShortError :: ParserError -> String Source #
A utility for converting a ParserError into a one line message:
line-nr: error-msg
showErrorPos :: ParserError -> ((Int, Int), (Int, Int), Text) Source #
A utility for converting a ParserError into a range and error message.