record Stack : Type -> Type -> Bits32 -> Type -> TypeA general-purpose mutable parser stack that can be used in many common
situation, such as when needing just a lexer or wanting to parse
a single value of a simple type.
For concrete usage examples, see ilex-json and ilex-toml, which both
make use of this type as their mutable parser state.
If you are writing a parser for something complex such as a programming
language, you're probably going to need quite a few custom fields, so
feel free to come up with your own.
S : (bufSize_ : Nat) -> ByteString -> IBuffer bufSize_ -> Nat -> Nat -> Ref q (LTENat bufSize_) -> Ref q (LTENat bufSize_) -> Ref q (SnocList BytePos) -> Ref q a -> Ref q (Index r) -> Ref q (SnocList String) -> Ref q (Maybe (BBErr e)) -> Stack e a r q.bufSize_ : Stack e a r q -> Nat.curOffset_ : Stack e a r q -> Nat.cur_ : ({rec:0} : Stack e a r q) -> IBuffer (bufSize_ {rec:0}).error_ : Stack e a r q -> Ref q (Maybe (BBErr e)).from_ : ({rec:0} : Stack e a r q) -> Ref q (LTENat (bufSize_ {rec:0})).positions_ : Stack e a r q -> Ref q (SnocList BytePos).prevOffset_ : Stack e a r q -> Nat.prev_ : Stack e a r q -> ByteString.stack_ : Stack e a r q -> Ref q a.state_ : Stack e a r q -> Ref q (Index r).strings_ : Stack e a r q -> Ref q (SnocList String).till_ : ({rec:0} : Stack e a r q) -> Ref q (LTENat (bufSize_ {rec:0})).bufSize_ : Stack e a r q -> NatbufSize_ : Stack e a r q -> Nat.prev_ : Stack e a r q -> ByteStringprev_ : Stack e a r q -> ByteString.cur_ : ({rec:0} : Stack e a r q) -> IBuffer (bufSize_ {rec:0})cur_ : ({rec:0} : Stack e a r q) -> IBuffer (bufSize_ {rec:0}).prevOffset_ : Stack e a r q -> NatprevOffset_ : Stack e a r q -> Nat.curOffset_ : Stack e a r q -> NatcurOffset_ : Stack e a r q -> Nat.from_ : ({rec:0} : Stack e a r q) -> Ref q (LTENat (bufSize_ {rec:0}))from_ : ({rec:0} : Stack e a r q) -> Ref q (LTENat (bufSize_ {rec:0})).till_ : ({rec:0} : Stack e a r q) -> Ref q (LTENat (bufSize_ {rec:0}))till_ : ({rec:0} : Stack e a r q) -> Ref q (LTENat (bufSize_ {rec:0})).positions_ : Stack e a r q -> Ref q (SnocList BytePos)positions_ : Stack e a r q -> Ref q (SnocList BytePos).stack_ : Stack e a r q -> Ref q astack_ : Stack e a r q -> Ref q a.state_ : Stack e a r q -> Ref q (Index r)state_ : Stack e a r q -> Ref q (Index r).strings_ : Stack e a r q -> Ref q (SnocList String)strings_ : Stack e a r q -> Ref q (SnocList String).error_ : Stack e a r q -> Ref q (Maybe (BBErr e))error_ : Stack e a r q -> Ref q (Maybe (BBErr e))init : {auto 0 _ : 0 < r} -> a -> (n : Nat) -> IBuffer n -> F1 q (Stack e a r q)Initializes a new parser stack.
0 Tok : Type -> Type0 Toks : Type -> Type0 Skot : Type -> Type0 L1 : Type -> Type -> Type -> Type0 Lexer : Type -> Type -> TypepushBounded : HasBytes s => HasStack s (Skot a) => RExp True -> {auto 0 _ : 0 < r} -> s q => a -> F1 q (Index r)tok : HasBytes s => HasStack s (Skot a) => RExp True -> {auto 0 _ : 0 < r} -> a -> (RExp True, Step q r s)byteTok : HasBytes s => HasStack s (Skot a) => RExp True -> {auto 0 _ : 0 < r} -> (ByteString -> a) -> (RExp True, Step q r s)stringTok : HasBytes s => HasStack s (Skot a) => RExp True -> {auto 0 _ : 0 < r} -> (String -> a) -> (RExp True, Step q r s)lexEOI : {auto 0 _ : 0 < r} -> HasStack s (SnocList a) => HasBBErr s e => HasBytes s => Index r -> s q -> F1 q (Either (BBErr e) (List a))lexer : {auto 0 _ : 0 < r} -> Steps q r (Stack e (Skot a) r) -> L1 q e adata Token : Type -> Type -> TypeDescription of lexicographic tokens
Ignore : Token e aMarks a terminal state that does not produce a token.
This can be used for comments or whitespace that should be
ignored.
Const : a -> Token e aA constant token that allows us to emit a value directly.
Txt : (String -> Either e a) -> Token e aA token that needs to be parsed from its corresponding bytestring.
Bytes : (ByteString -> Either e a) -> Token e aA token that needs to be parsed from its corresponding bytestring.
const : a -> Token e atxt : (String -> a) -> Token e abytes : (ByteString -> a) -> Token e a0 PVal1 : Type -> Type -> Type -> Typevalue : Maybe a -> TokenMap (Token e a) -> PVal1 q e aParser for simple values based on regular expressions.