{-# OPTIONS --without-K --safe #-}
module Text.Parser.Types where
open import Level using (Level; Setω)
open import Level.Bounded
open import Data.Nat.Base using (ℕ; _<_; _≤_)
open import Function.Base using (_∘′_)
open import Relation.Binary.PropositionalEquality using (_≡_; refl; cong)
record Parameters (l : Level) : Setω where
field
Tok : Set≤ l
Toks : ℕ → Set≤ l
M : Set l → Set l
recordToken : theSet Tok → M (Lift ⊤)
infix 1 _^_,_
record Success {l} (Toks : ℕ → Set≤ l) (A : Set≤ l) (n : ℕ) : Set l where
constructor _^_,_
field
value : Lift A
{size} : ℕ
.small : size < n
leftovers : Lift (Toks size)
record Parser {l} (P : Parameters l) (A : Set≤ l) (n : ℕ) : Set l where
constructor mkParser
open Parameters P
field runParser : ∀ {m} → .(m ≤ n) → Lift (Toks m) → M (Success Toks A m)
open Parser public