incremental-parser-0.2.5: Generic parser library capable of providing partial results from partial input.

Safe Haskell | Safe
Language | Haskell2010

Text.ParserCombinators.Incremental.LeftBiasedLocal

Description

This module defines parsing combinators for incremental parsers with left-biased local choice.

The exported `Parser` type can provide partial parsing results from partial input, as long as the output is a `Monoid`. Construct a parser using the primitives and combinators, supply it with input using functions `feed` and `feedEof`, and extract the parsed output using `results`.

Implementation is based on Brzozowski derivatives.

Synopsis

- module Text.ParserCombinators.Incremental
- type Parser s r = Parser LeftBiasedLocal s r
- data LeftBiasedLocal
- leftmost :: Parser s r -> Parser a s r

# Documentation

module Text.ParserCombinators.Incremental

type Parser s r = Parser LeftBiasedLocal s r #

data LeftBiasedLocal #

An empty type to specialize `Parser` for the left-biased `Alternative` instance.

Instances

Monoid s => Alternative (Parser LeftBiasedLocal s) # | Left-biased choice. The right parser is used only if the left one utterly fails.
Methods empty :: Parser LeftBiasedLocal s a # (<|>) :: Parser LeftBiasedLocal s a -> Parser LeftBiasedLocal s a -> Parser LeftBiasedLocal s a # some :: Parser LeftBiasedLocal s a -> Parser LeftBiasedLocal s [a] # many :: Parser LeftBiasedLocal s a -> Parser LeftBiasedLocal s [a] #
Monoid s => MonadPlus (Parser LeftBiasedLocal s) # | The `MonadPlus` instances are the same as the `Alternative` instances.
Methods mzero :: Parser LeftBiasedLocal s a # mplus :: Parser LeftBiasedLocal s a -> Parser LeftBiasedLocal s a -> Parser LeftBiasedLocal s a #

leftmost :: Parser s r -> Parser a s r #