parser_combs v0.1.0 Parser.Core View Source
This module provides the monad instance definition for a parser.
A parser essentially is a function that consumes (part of) a string and produces a value and the unconsumed part of the string.
Link to this section Summary
Functions
accepts 2 parsers a and b and first applies parser a. If that that parser fails parser b applies.
single element parser.
function that accepts a string and always fails.
applies the parser to the input string, returns value and remaining string
injects the passed value into function that accepts a string and returns a pair of the injected value and the unchanged string
applies the parser and returns {:ok, result} on successful parse when there is no more input left. Returns {:error, reason} if either the parser failed or the input string was not consumed entirely.
applies the parser and returns an un-wrapped value. Raises an error if the parser failed, or the parser succeeded but the input was not consumed entirely.
Link to this section Functions
accepts 2 parsers a and b and first applies parser a. If that that parser fails parser b applies.
single element parser.
function that accepts a string and always fails.
applies the parser to the input string, returns value and remaining string
injects the passed value into function that accepts a string and returns a pair of the injected value and the unchanged string
applies the parser and returns {:ok, result} on successful parse when there is no more input left. Returns {:error, reason} if either the parser failed or the input string was not consumed entirely.
applies the parser and returns an un-wrapped value. Raises an error if the parser failed, or the parser succeeded but the input was not consumed entirely.