LParse-0.1.3.0: A continuation-based parser library

Copyright(c) Marcus Völker 2017
LicenseMIT
Maintainermarcus.voelker@rwth-aachen.de
Safe HaskellSafe
LanguageHaskell2010

Text.LParse.Atomics

Description

This module implements LParse's atomic parsers, i.e., parsers that are not built up from other parsers.

Synopsis

Documentation

noop :: Parser r t () Source #

A parser that always succeeds, parses nothing and returns unit

full :: Parser r [t] [t] Source #

A parser that consumes the whole input and returns it unchanged

discard :: Parser r [t] () Source #

A parser that consumes the whole input and discards it, successfully

eoi :: Parser r [t] () Source #

A parser that parses nothing, but only succeeds if the input is empty

tokenParse :: (t -> a) -> Parser r [t] a Source #

Extracts the first token from the input and applies the given function to it

tokenReturn :: Parser r [a] a Source #

Consumes and returns the first token of the input

consume :: (Eq t, Show t) => [t] -> Parser r [t] () Source #

Succeeds exactly if the input begins with the given sequence. On success, consumes that sequence

consumeSingle :: (Eq t, Show t) => t -> Parser r [t] () Source #

Succeeds exactly if the input begins with the given token. On success, consumes that token

word :: Parser r String String Source #

Extracts the first word (i.e. contiguous string of letters) from the input and returns it

integer :: Parser r String Integer Source #

Extracts the first integer (i.e. contiguous string of digits) from the input and returns it

peek :: (t -> Bool) -> String -> Parser r [t] () Source #

Succeeds if the first token matches the given function, without consuming it