Idris2Doc : Text.ILex.Interfaces

Text.ILex.Interfaces

(source)

Definitions

interfaceHasBBErr : (Type->Type) ->Type->Type
  An interface for mutable parser stacks `s` that allow us to
register custom errors, which will then be raised during parsing.

Parameters: s, e
Constructor: 
MkBE

Methods:
error : sq->Refq (Maybe (BBErre))

Implementation: 
HasBBErr (DStackse) e
error : HasBBErrse=>sq->Refq (Maybe (BBErre))
Totality: total
Visibility: public export
interfaceHasStringLits : (Type->Type) ->Type
  An interface for mutable parser stacks `s` that facilitates
parsing string tokens containing escape sequences.

Parameters: s
Constructor: 
MkHSL

Methods:
strings : sq->Refq (SnocListString)

Implementation: 
HasStringLits (DStackse)
strings : HasStringLitss=>sq->Refq (SnocListString)
Totality: total
Visibility: public export
interfaceHasStack : (Type->Type) ->Type->Type
  An interface for mutable parser stacks `s` that facilitates
parsing string tokens containing escape sequences.

Parameters: s, a
Constructor: 
MkHS

Methods:
stack : sq->Refqa

Implementation: 
HasStack (DStackse) (StackTrues [<])
stack : HasStacksa=>sq->Refqa
Totality: total
Visibility: public export
go : a-> (sq=>F1q (Indexr)) -> (a, Stepqrs)
Totality: total
Visibility: export
ign : a-> (sq=>F1q ()) -> (a, Stepqrs)
Totality: total
Visibility: export
goBS : HasBytess=>a-> (sq=>ByteString->F1q (Indexr)) -> (a, Stepqrs)
Totality: total
Visibility: export
goStr : HasBytess=>a-> (sq=>String->F1q (Indexr)) -> (a, Stepqrs)
Totality: total
Visibility: export
writeAs : Refqa->a->r->F1qr
  Writes a mutable reference and returns the given result.

Totality: total
Visibility: export
push1 : Refq (SnocLista) ->a->F1'q
  Appends a value to mutable reference of a snoclist.

Totality: total
Visibility: export
pop1 : Refq (SnocLista) ->F1'q
  Drops and discards a the last entry from a snoclist
stored in a mutable reference.

Totality: total
Visibility: export
replace1 : Refqa->a->F1qa
  Returns the value stored in a mutable reference and
overwrites it with the given replacement.

Totality: total
Visibility: export
getList : Refq (SnocLista) ->F1q (Lista)
  Empties a mutable reference holding a snoclist and returns
the corresponding list.

Totality: total
Visibility: export
getStack : HasStacksa=>sq=>F1qa
  Returns the content of some mutable state implementing
`HasStack`.

Totality: total
Visibility: export
putStack : HasStacksa=>sq=>a->F1'q
  Overwrites the content of some mutable state implementing
`HasStack`.

Totality: total
Visibility: export
putStackAs : HasStacksa=>sq=>a->v->F1qv
  Like `putStack` but returns the given result.

Totality: total
Visibility: export
putStackAsC : Castbv=>HasStacksa=>sq=>a->b->F1qv
  Like `putStack` but returns the given result.

Totality: total
Visibility: export
modStackAs : (0s : (Type->Type)) ->HasStacksa=>sq=> (a->a) ->v->F1qv
  Reads and updates the stack.

Totality: total
Visibility: export
pushStack : HasStacks (SnocLista) =>sq=>a->F1'q
  Appends a value to some mutable state implementing `HasStack`.

Totality: total
Visibility: export
pushStackAs : HasStacks (SnocLista) =>sq=>a->v->F1qv
  Like `pushStack` but returns the given result.

Totality: total
Visibility: export
countdown : RefqNat->a->a->F1qa
  A small utility for counting down a parser and returning one
of two possible outcomes.

Totality: total
Visibility: export
countdownAct : RefqNat->F1qa->F1qa->F1qa
  A small utility for counting down a parser and returning one
of two possible actions.

Totality: total
Visibility: export
getStr : sq=>HasStringLitss=>F1qString
  Empties the `strings` field of some mutable state implementing
`HasStringLits` and returns the concatenated string literal.

Totality: total
Visibility: export
pushStr' : sq=>HasStringLitss=>String->F1'q
  Appends the given string to the `strings` field of some mutable
state implementing `HasStringLits`.

Totality: total
Visibility: export
pushStr : sq=>HasStringLitss=>Castt (Indexr) =>t->String->F1q (Indexr)
  Appends the given string to the `strings` field of some mutable
state implementing `HasStringLits` and returns the given result.

Totality: total
Visibility: export
pushChar : sq=>HasStringLitss=>Castt (Indexr) =>t->Char->F1q (Indexr)
  Appends the given character to the `strings` field of some mutable
state implementing `HasStringLits` and returns the given result.

Totality: total
Visibility: export
pushBits32 : sq=>HasStringLitss=>Castt (Indexr) =>t->Bits32->F1q (Indexr)
  Appends the given unicode code point to the `strings` field of some mutable
state implementing `HasStringLits` and returns the given result.

Totality: total
Visibility: export
startPos : sq=>HasBytess=>F1qBytePos
  Gets the absolute position of the
first byte of the current token.

Totality: total
Visibility: export
endPos : sq=>HasBytess=>F1qBytePos
  Gets the absolute position of the last byte of the current token.

Totality: total
Visibility: export
bounds : sq=>HasBytess=>F1qByteBounds
  Gets the bounds of the current token.

Totality: total
Visibility: export
bounded : sq=>HasBytess=>F1qa->F1q (ByteBoundeda)
  Computes the given value and pairs it with the token bounds.

Totality: total
Visibility: export
bounded' : sq=>HasBytess=>a->F1q (ByteBoundeda)
  Pairs the given value with the token bounds.

Totality: total
Visibility: export
pushPosition : sq=>HasBytess=>F1'q
  Pushes the current byte position onto the position stack.

This is often used when ecountering some "opening token"
(such as an opening quote or parenthesis) for which we later
expect a suitable closing token. If no closing token is encountered,
we typically want to fail with an error that lists the position
of the unclosed token.

Totality: total
Visibility: export
popPosition : sq=>HasBytess=>F1'q
  Discards the latest entry from the positions stack.

Totality: total
Visibility: export
closeBounds : sq=>HasBytess=>F1qByteBounds
  Returns the bounds from start to end of some "enclosed" or
quoted region of text such as an expression in parantheses
or some text in quotes.

Totality: total
Visibility: export
failWith : HasBBErrse=>sq=>BBErre->v->F1qv
  Writes the given exception to the `error` field of some
mutable state and returns the given result.

Totality: total
Visibility: export
failHere : HasBBErrse=>HasBytess=>sq=>InnerErrore->v->F1qv
  Like `failWith`, but generates the bounds of the error from the
current position and the bytes read until the error occurred.

Totality: total
Visibility: export
ignore : HasBytess=>a-> (sq=>F1q ()) -> (a, Stepqrs)
Totality: total
Visibility: export
ignore' : HasBytess=>a-> (a, Stepqrs)
Totality: total
Visibility: export
step : HasBytess=>a-> (sq=>F1q (Indexr)) -> (a, Stepqrs)
Totality: total
Visibility: export
step' : HasBytess=>a->Castt (Indexr) =>t-> (a, Stepqrs)
Totality: total
Visibility: export
bytes : HasBytess=>a-> (sq=>ByteString->F1q (Indexr)) -> (a, Stepqrs)
Totality: total
Visibility: export
string : HasBytess=>a-> (sq=>String->F1q (Indexr)) -> (a, Stepqrs)
Totality: total
Visibility: export
opn : HasBytess=>a-> (sq=>F1q (Indexr)) -> (a, Stepqrs)
  Recognizes the given character(s)
and uses it to update the parser state
as specified by `f`.

The current column is increased by one, and a new entry is pushed onto
the stack of bounds.

Totality: total
Visibility: export
opn' : HasBytess=>a->Castt (Indexr) =>t-> (a, Stepqrs)
  Convenience alias for `copen . pure`.

Totality: total
Visibility: export
close : HasBytess=>a-> (sq=>F1q (Indexr)) -> (a, Stepqrs)
  Recognizes the given character(s) and uses it to update the parser state
as specified by `f`.

The current column is increased by `n`, and one `Position` entry
is popped from the stack.

Totality: total
Visibility: export
closeStr : HasBytess=>a->HasStringLitss=> (sq=>String->F1q (Indexr)) -> (a, Stepqrs)
  Recognizes the given character(s) and uses it to
finalize and assemble a string literal.

The current column is increased by `n`, and one `Position` entry
is popped from the stack.

Totality: total
Visibility: export
closeWithBounds : HasBytess=>a-> (sq=>ByteBounds->F1q (Indexr)) -> (a, Stepqrs)
  Recognizes the given character(s) and uses it to update the parser state
as specified by `f`.

The current column is increased by one, and on `Bounds` entry
is popped from the stack.

Totality: total
Visibility: export
closeBoundedStr : HasBytess=>a->HasStringLitss=> (sq=>ByteBoundedString->F1q (Indexr)) -> (a, Stepqrs)
  Recognizes the given character(s) and uses it to
finalize and assemble a string literal.

The current column is increased by `n`, and one `Position` entry
is popped from the stack.

Totality: total
Visibility: export
val : HasBytess=> (a->String) -> (a->Step1qrs) ->a->Maybe (RExpTrue, Stepqrs)
  Lexes a single value based on its printed form. Returns
`Nothing` in case `display` returns the empty string.

For instance, `val show soSomething True` would recognice
the token `"True"` and invoke act with `True`.

Totality: total
Visibility: export
valN : HasBytess=> (a->ListString) -> (a->Step1qrs) ->a->List (RExpTrue, Stepqrs)
  Like `val` but for a value that can be displayed in
different ways.

Totality: total
Visibility: export
writeVal : HasBytess=> (a->String) -> (sq->Refqa) ->Indexr->a->Maybe (RExpTrue, Stepqrs)
  Specialized version of `val` that writes the lexed value
to a predefined mutable field of the parser stack.

Totality: total
Visibility: export
writeValN : HasBytess=> (a->ListString) -> (sq->Refqa) ->Indexr->a->List (RExpTrue, Stepqrs)
  Specialized version of `valN` that writes the lexed value
to a predefined mutable field of the parser stack.

Totality: total
Visibility: export
vals : HasBytess=> (a->String) -> (a->Step1qrs) ->Lista->List (RExpTrue, Stepqrs)
  Applies `val` to a list of values.

Highly useful in combination with the `Finite` interface from
the idris2-finite library.

Totality: total
Visibility: export
valsN : HasBytess=> (a->ListString) -> (a->Step1qrs) ->Lista->List (RExpTrue, Stepqrs)
  Like `vals` but for values that can be displayed in
several ways.

Highly useful in combination with the `Finite` interface from
the idris2-finite library.

Totality: total
Visibility: export
writeVals : HasBytess=> (a->String) -> (sq->Refqa) ->Indexr->Lista->List (RExpTrue, Stepqrs)
  Specialized version of `vals` that writes the lexed value
to a predefined mutable field of the parser stack.

Totality: total
Visibility: export
writeValsN : HasBytess=> (a->ListString) -> (sq->Refqa) ->Indexr->Lista->List (RExpTrue, Stepqrs)
  Specialized version of `valsN` that writes the lexed value
to a predefined mutable field of the parser stack.

Totality: total
Visibility: export
jsonSpace : RExpTrue
Totality: total
Visibility: export
jsonSpaces : RExpTrue
Totality: total
Visibility: export
jsonSpaced : HasBytess=>Stepsqrs->Stepsqrs
Totality: total
Visibility: export
raise : HasBBErrse=>HasBytess=>InnerErrore->Nat->sq=>v->F1qv
Totality: total
Visibility: export
unexpected : HasBBErrse=>HasBytess=>ListString->sq->F1q (BBErre)
Totality: total
Visibility: export
unclosed : HasBBErrse=>HasBytess=>String->sq->F1q (BBErre)
Totality: total
Visibility: export
unclosedIfEOI : HasBBErrse=>HasBytess=>String->ListString->sq->F1q (BBErre)
  Fails with `unclosed` if this is the end of input, otherwise
invokes `unexpected`.

Totality: total
Visibility: export
unclosedIfNLorEOI : HasBBErrse=>HasBytess=>String->ListString->sq->F1q (BBErre)
  Fails with `unclosed` if this is the end of input or
a linefeed character (`\n`, byte `0x0a`) was encountered,
otherwise, invokes `unexpected`.

Totality: total
Visibility: export
errs : HasBBErrse=>HasBytess=>List (Entryn (sq->F1q (BBErre))) ->Arr32n (sq->F1q (BBErre))
Totality: total
Visibility: export
noChunk : s->F1q (Maybea)
  Never emits a chunk of values during streaming.

This is for parsers that produce a single value after consuming the
whole input. Such a parser can still be used with the facilities
from ilex-streams but will only emit a single value at the end of input.
In general, such a parser consumes a linear amount of memory and can
typically not be used to process very large amounts of data.

Totality: total
Visibility: export
snocChunk : HasStacks (SnocLista) =>sq->F1q (Maybe (Lista))
  Extracts the values parsed so far from the parser stack
and emits them during streaming.

Totality: total
Visibility: export