tasty-1.5.3: Modern and extensible testing framework

Safe Haskell | None
Language | Haskell2010

Test.Tasty.Patterns.Parser

Description

See http://pubs.opengroup.org/onlinepubs/9699919799/utilities/awk.html for the full awk grammar.

Since: 1.0

Synopsis

- data Parser a
- runParser :: Parser a -> String -> ParseResult a
- data ParseResult a
  - = Success a
  - | Invalid
  - | Ambiguous [a]
- expr :: Parser Expr
- parseAwkExpr :: String -> Maybe Expr

# Documentation

data Parser a Source #

A separate `Parser` data type ensures that we don't forget to skip spaces.

Since: 1.0

#### Instances

Instances details

Alternative Parser Source # |
Instance details Defined in Test.Tasty.Patterns.Parser Methods empty :: Parser a Source # (<|>) :: Parser a -> Parser a -> Parser a Source # some :: Parser a -> Parser [a] Source # many :: Parser a -> Parser [a] Source #
Applicative Parser Source # |
Instance details Defined in Test.Tasty.Patterns.Parser Methods pure :: a -> Parser a Source # (<*>) :: Parser (a -> b) -> Parser a -> Parser b Source # liftA2 :: (a -> b -> c) -> Parser a -> Parser b -> Parser c Source # (*>) :: Parser a -> Parser b -> Parser b Source # (<*) :: Parser a -> Parser b -> Parser a Source #
Functor Parser Source # |
Instance details Defined in Test.Tasty.Patterns.Parser Methods fmap :: (a -> b) -> Parser a -> Parser b Source # (<$) :: a -> Parser b -> Parser a Source #
Monad Parser Source # |
Instance details Defined in Test.Tasty.Patterns.Parser Methods (>>=) :: Parser a -> (a -> Parser b) -> Parser b Source # (>>) :: Parser a -> Parser b -> Parser b Source # return :: a -> Parser a Source #
MonadPlus Parser Source # |
Instance details Defined in Test.Tasty.Patterns.Parser Methods mzero :: Parser a Source # mplus :: Parser a -> Parser a -> Parser a Source #

runParser Source #

Arguments

:: Parser a |
-> String | text to parse
-> ParseResult a |

Run a parser

Since: 1.0

data ParseResult a Source #

Since: 1.0

Constructors

Success a |
Invalid |
Ambiguous [a] |

#### Instances

Instances details

Show a => Show (ParseResult a) Source # |
Instance details Defined in Test.Tasty.Patterns.Parser Methods showsPrec :: Int -> ParseResult a -> ShowS Source # show :: ParseResult a -> String Source # showList :: [ParseResult a] -> ShowS Source #
Eq a => Eq (ParseResult a) Source # | Since: 1.4.2
Instance details Defined in Test.Tasty.Patterns.Parser Methods (==) :: ParseResult a -> ParseResult a -> Bool Source # (/=) :: ParseResult a -> ParseResult a -> Bool Source #

expr :: Parser Expr Source #

The awk-like expression parser.

Since: 1.0

parseAwkExpr :: String -> Maybe Expr Source #

Parse an awk expression.

Since: 1.1