Idris2Doc : TyRE.Text.Parser.Core

TyRE.Text.Parser.Core

(source)
This is a slightly modified copy of the same module from `contrib` package.

Reexports

importpublic Control.Delayed
importpublic Data.List

Definitions

dataGrammar : Type->Bool->Type->Type
  Description of a language's grammar. The `tok` parameter is the type
of tokens, and the `consumes` flag is True if the language is guaranteed
to be non-empty - that is, successfully parsing the language is guaranteed
to consume some input.

Totality: total
Visibility: public export
Constructors:
Empty : ty->GrammartokFalsety
Terminal : String-> (tok->Maybea) ->GrammartokTruea
NextIs : String-> (tok->Bool) ->GrammartokFalsetok
EOF : GrammartokFalse ()
Fail : Bool->String->Grammartokcty
Commit : GrammartokFalse ()
MustWork : Grammartokca->Grammartokca
SeqEat : GrammartokTruea-> Inf (a->Grammartokc2b) ->GrammartokTrueb
SeqEmpty : Grammartokc1a-> (a->Grammartokc2b) ->Grammartok (c1|| Delay c2) b
ThenEat : GrammartokTrue () -> Inf (Grammartokc2b) ->GrammartokTrueb
ThenEmpty : Grammartokc1 () ->Grammartokc2b->Grammartok (c1|| Delay c2) b
Alt : Grammartokc1ty->Grammartokc2ty->Grammartok (c1&& Delay c2) ty

Hint: 
Functor (Grammartokc)
(>>=) : Grammartokc1a->infc1 (a->Grammartokc2b) ->Grammartok (c1|| Delay c2) b
  Sequence two grammars. If either consumes some input, the sequence is
guaranteed to consume some input. If the first one consumes input, the
second is allowed to be recursive (because it means some input has been
consumed and therefore the input is smaller)

Visibility: public export
Fixity Declaration: infixl operator, level 1
(>>) : Grammartokc1 () ->infc1 (Grammartokc2a) ->Grammartok (c1|| Delay c2) a
  Sequence two grammars. If either consumes some input, the sequence is
guaranteed to consume some input. If the first one consumes input, the
second is allowed to be recursive (because it means some input has been
consumed and therefore the input is smaller)

Visibility: public export
Fixity Declaration: infixl operator, level 1
seq : Grammartokc1a-> (a->Grammartokc2b) ->Grammartok (c1|| Delay c2) b
  Sequence two grammars. If either consumes some input, the sequence is
guaranteed to consume input. This is an explicitly non-infinite version
of `>>=`.

Visibility: public export
join : Grammartokc1 (Grammartokc2a) ->Grammartok (c1|| Delay c2) a
  Sequence a grammar followed by the grammar it returns.

Visibility: public export
(<|>) : Grammartokc1ty->Grammartokc2ty->Grammartok (c1&& Delay c2) ty
  Give two alternative grammars. If both consume, the combination is
guaranteed to consume.

Visibility: public export
Fixity Declaration: infixr operator, level 2
(<*>) : Grammartokc1 (a->b) -> Inf (Grammartokc2a) ->Grammartok (c1|| Delay c2) b
  Sequence a grammar with value type `a -> b` and a grammar
with value type `a`. If both succeed, apply the function
from the first grammar to the value from the second grammar.
Guaranteed to consume if either grammar consumes.

Visibility: public export
Fixity Declarations:
infixl operator, level 3
infixr operator, level 6
(<*) : Grammartokc1a-> Inf (Grammartokc2b) ->Grammartok (c1|| Delay c2) a
  Sequence two grammars. If both succeed, use the value of the first one.
Guaranteed to consume if either grammar consumes.

Visibility: public export
Fixity Declarations:
infixl operator, level 3
infixr operator, level 6
(*>) : Grammartokc1a-> Inf (Grammartokc2b) ->Grammartok (c1|| Delay c2) b
  Sequence two grammars. If both succeed, use the value of the second one.
Guaranteed to consume if either grammar consumes.

Visibility: public export
Fixity Declarations:
infixl operator, level 3
infixr operator, level 6
mapToken : (a->b) ->Grammarbcty->Grammaracty
  Produce a grammar that can parse a different type of token by providing a
function converting the new token type into the original one.

Visibility: public export
pure : ty->GrammartokFalsety
  Always succeed with the given value.

Visibility: public export
nextIs : String-> (tok->Bool) ->GrammartokFalsetok
  Check whether the next token satisfies a predicate

Visibility: public export
peek : GrammartokFalsetok
  Look at the next token in the input

Visibility: public export
terminal : String-> (tok->Maybea) ->GrammartokTruea
  Succeeds if running the predicate on the next token returns Just x,
returning x. Otherwise fails.

Visibility: public export
fail : String->Grammartokcty
  Always fail with a message

Visibility: public export
fatalError : String->Grammartokcty
Visibility: public export
eof : GrammartokFalse ()
  Succeed if the input is empty

Visibility: public export
commit : GrammartokFalse ()
  Commit to an alternative; if the current branch of an alternative
fails to parse, no more branches will be tried

Visibility: public export
mustWork : Grammartokcty->Grammartokcty
  If the parser fails, treat it as a fatal error

Visibility: public export
dataParseResult : Listtok->Bool->Type->Type
Totality: total
Visibility: public export
Constructors:
Failure : Bool->Bool->String->Listtok->ParseResultxscty
EmptyRes : Bool->ty-> (more : Listtok) ->ParseResultmoreFalsety
NonEmptyRes : Bool->ty-> (more : Listtok) ->ParseResult (x:: (xs++more)) cty
weakenRes : Bool->ParseResultxscty->ParseResultxs (whatever&& Delay c) ty
Visibility: public export
doParse : Bool->Grammartokcty-> (xs : Listtok) ->ParseResultxscty
Visibility: public export
dataParseError : Type->Type
Totality: total
Visibility: public export
Constructor: 
Error : String->Listtok->ParseErrortok
parse : Grammartokcty->Listtok->Either (ParseErrortok) (ty, Listtok)
  Parse a list of tokens according to the given grammar. If successful,
returns a pair of the parse result and the unparsed tokens (the remaining
input).

Visibility: public export