Idris2Doc : Text.Parse.Manual

Text.Parse.Manual

(source)
This module provides utilities for writing parsers by hand (without
using the combinators from module `Text.Parse.Core`).

Typically, you get the best performance by using direct pattern matches
and explicit recursion. However, for those cases where performance is
not the main issue, this module provides some combinators for
certain reoccuring patterns.

It is strongly recommended to use a lexer and probably one or two
cleanup passes over the sequence of generated tokens before parsing,
as this can significantly simplify the parsers.

Example parsers can be found in sub-packages `parser-json` and
`parser-toml`.

Note: The raison d'etre of this module is that writing provably total
      parsers for (recursive) syntax trees is cumbersome or even impossible
      when using parser combinators. In such cases, you have to arrange
      things manually, using a `SuffixAcc` helper to proof termination.
      For everything else, the combinators in here can make your life
      easier.

Reexports

importpublic Data.Bool.Rewrite
importpublic Data.List1
importpublic Data.List.Shift
importpublic Data.List.Suffix
importpublic Data.List.Suffix.Result
importpublic Data.List.Suffix.Result0
importpublic Text.Bounds
importpublic Text.FC
importpublic Text.ParseError
importpublic Text.Lex.Manual
importpublic Text.Lex.Shift

Definitions

0Res : Bool-> (t : Type) ->List (Boundedt) ->Type->Type->Type
Totality: total
Visibility: public export
0Grammar : Bool->Type->Type->Type->Type
Totality: total
Visibility: public export
0AccGrammar : Bool->Type->Type->Type->Type
Totality: total
Visibility: public export
acc : AccGrammarbtea->Grammarbtea
  Converts a grammar requiring a proof of accessibility to a regular
grammar.

Totality: total
Visibility: public export
swapOr : Grammar (x|| Delay y) tea->Grammar (y|| Delay x) tea
Totality: total
Visibility: public export
orSame : Grammar (x|| Delay x) tea->Grammarxtea
Totality: total
Visibility: public export
orTrue : Grammar (x|| Delay True) tea->GrammarTruetea
Totality: total
Visibility: public export
orFalse : Grammar (x|| Delay False) tea->Grammarxtea
Totality: total
Visibility: public export
swapAnd : Grammar (x&& Delay y) tea->Grammar (y&& Delay x) tea
Totality: total
Visibility: public export
andSame : Grammar (x&& Delay x) tea->Grammarxtea
Totality: total
Visibility: public export
andTrue : Grammar (x&& Delay True) tea->Grammarxtea
Totality: total
Visibility: public export
andFalse : Grammar (x&& Delay False) tea->GrammarFalsetea
Totality: total
Visibility: public export
terminal : Interpolationt=> (t->Maybea) ->GrammarTruetea
  Tries to convert the head of the list of tokens.
Fails with appropriate errors if the list is empty or the conversion
fails.

Totality: total
Visibility: public export
terminalE : (t->Eitherea) ->GrammarTruetea
  Like `terminal` but fails with a custom error if the conversion fails.

Totality: total
Visibility: public export
exact : Interpolationt=>Eqt=>t->GrammarTruete ()
  Tries to drop the given token from the head of the list of tokens.
Fails with appropriate errors if the list is empty or the token
at the head does not match.

Totality: total
Visibility: public export
peek : GrammarFalsetet
  Look at the next token without consuming any input.

Totality: total
Visibility: public export
nextIs : Interpolationt=> (t->Bool) ->GrammarFalsetet
  Check whether the next token satisfies a predicate. Does not consume.

Totality: total
Visibility: public export
nextEquals : Interpolationt=>Eqt=>t->GrammarFalsetet
  Check whether the next token equals the given value. Does not consume.

Totality: total
Visibility: public export
testParse : Showa=>Interpolatione=>Interpolationt=> (Origin->String->Either (ParseErrore) a) ->String->IO ()
  Utility for testing a parses and the error messages it produces
at the REPL.

Totality: total
Visibility: export