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 #

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

Since: 1.0

#### Instances

Instances details

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

runParser #

Arguments

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

Run a parser

Since: 1.0

data ParseResult a #

Since: 1.0

Constructors

Success a |
Invalid |
Ambiguous [a] |

#### Instances

Instances details

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

expr :: Parser Expr #

The awk-like expression parser.

Since: 1.0

parseAwkExpr :: String -> Maybe Expr #

Parse an awk expression.

Since: 1.1