Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell98 |
ACE.Combinators
Description
Parser combinators.
Synopsis
- string :: forall s (m :: Type -> Type) u. Stream s m Token => Text -> ParsecT s u m Text
- genitive :: forall s (m :: Type -> Type) u. Stream s m Token => ParsecT s u m Bool
- number :: forall s (m :: Type -> Type) u. Stream s m Token => ParsecT s u m Integer
- quoted :: forall s (m :: Type -> Type) u. Stream s m Token => ParsecT s u m Text
- comma :: forall s (m :: Type -> Type) u. Stream s m Token => ParsecT s u m ()
- period :: forall s (m :: Type -> Type) u. Stream s m Token => ParsecT s u m ()
- strings :: forall s (m :: Type -> Type) u. Stream s m Token => [Text] -> ParsecT s u m ()
- satisfy :: forall s (m :: Type -> Type) a u. Stream s m Token => (Token -> Maybe a) -> ParsecT s u m a
- anyToken :: forall s (m :: Type -> Type) u. Stream s m Token => ParsecT s u m Token
- tokenString :: Token -> [Char]
- tokenPosition :: SourcePos -> Token -> t -> SourcePos
- notFollowedBy :: forall s (m :: Type -> Type) u. Stream s m Token => ParsecT s u m Token -> ParsecT s u m ()
- eof :: forall s (m :: Type -> Type) u. Stream s m Token => ParsecT s u m ()
Documentation
string :: forall s (m :: Type -> Type) u. Stream s m Token => Text -> ParsecT s u m Text Source #
Match a word with the given string.
genitive :: forall s (m :: Type -> Type) u. Stream s m Token => ParsecT s u m Bool Source #
Match a Saxon genitive.
number :: forall s (m :: Type -> Type) u. Stream s m Token => ParsecT s u m Integer Source #
Match a word with the given string.
quoted :: forall s (m :: Type -> Type) u. Stream s m Token => ParsecT s u m Text Source #
Quoted string.
strings :: forall s (m :: Type -> Type) u. Stream s m Token => [Text] -> ParsecT s u m () Source #
Try to match all the given strings, or none at all.
satisfy :: forall s (m :: Type -> Type) a u. Stream s m Token => (Token -> Maybe a) -> ParsecT s u m a Source #
Satisfy the given predicate from the token stream.
anyToken :: forall s (m :: Type -> Type) u. Stream s m Token => ParsecT s u m Token Source #
The parser anyToken
accepts any kind of token. It is for example
used to implement eof
. Returns the accepted token.
tokenString :: Token -> [Char] Source #
Make a string out of the token, for error message purposes.
notFollowedBy :: forall s (m :: Type -> Type) u. Stream s m Token => ParsecT s u m Token -> ParsecT s u m () Source #
notFollowedBy p
only succeeds when parser p
fails. This parser
does not consume any input. This parser can be used to implement the
'longest match' rule. For example, when recognizing keywords (for
example let
), we want to make sure that a keyword is not followed
by a legal identifier character, in which case the keyword is
actually an identifier (for example lets
). We can program this
behaviour as follows:
keywordLet = try (do{ string "let" ; notFollowedBy alphaNum })