Type of regular expressions
- set
{α : Type u_1}
: (α → Bool) → RegEx α
Character set
- alt
{α : Type u_1}
: RegEx α → RegEx α → RegEx α
Alternation
- cat
{α : Type u_1}
: RegEx α → RegEx α → RegEx α
Concatenation
- repMany
{α : Type u_1}
: RegEx α → RegEx α
Unbounded repetition
- repUpTo
{α : Type u_1}
: Nat → RegEx α → RegEx α
Bounded repetition
- group
{α : Type u_1}
: RegEx α → RegEx α
Grouping
Instances For
Equations
- Parser.RegEx.instInhabited α = { default := Parser.RegEx.fail }
Universal character set
Equations
- Parser.RegEx.any = Parser.RegEx.set fun (x : α) => true
Instances For
Nil expression
Equations
Instances For
Repetition
Equations
- Parser.RegEx.rep 0 e = Parser.RegEx.repUpTo 0 e
- Parser.RegEx.rep 1 e = e
- Parser.RegEx.rep n_2.succ e = e.cat (Parser.RegEx.rep n_2 e)
Instances For
Unbounded repetition, at least n
times
Equations
- Parser.RegEx.repManyN 0 e = e.repMany
- Parser.RegEx.repManyN n_2.succ e = e.cat (Parser.RegEx.repManyN n_2 e)
Instances For
partial def
Parser.RegEx.foldr
{ε σ α β : Type (max u_1 u_2)}
[Parser.Stream σ α]
[Parser.Error ε σ α]
{m : Type (max u_1 u_2) → Type u_3}
[Monad m]
(f : α → β → β)
:
Fold over a regex match from the right
def
Parser.RegEx.take
{ε σ α : Type (max u_1 u_2)}
[Parser.Stream σ α]
[Parser.Error ε σ α]
{m : Type (max u_1 u_2) → Type u_3}
[Monad m]
(re : RegEx α)
:
take re
parses tokens matching regex re
returning the list of tokens, otherwise fails
Instances For
def
Parser.RegEx.drop
{ε σ α : Type}
[Parser.Stream σ α]
[Parser.Error ε σ α]
{m : Type → Type u_1}
[Monad m]
(re : RegEx α)
:
drop re
parses tokens matching regex re
, otherwise fails
Instances For
def
Parser.RegEx.count
{ε σ α : Type}
[Parser.Stream σ α]
[Parser.Error ε σ α]
{m : Type → Type u_1}
[Monad m]
(re : RegEx α)
:
count re
parses tokens matching regex re
returning the number of tokens, otherwise fails
Equations
- re.count = Parser.RegEx.foldr (fun (x : α) => Nat.succ) re (pure 0)
Instances For
def
Parser.RegEx.match
{ε σ α : Type (max u_1 u_2)}
[Parser.Stream σ α]
[Parser.Error ε σ α]
{m : Type (max u_1 u_2) → Type u_3}
[Monad m]
(re : RegEx α)
:
ParserT ε σ α m (Array (Option (Stream.Segment σ)))
Parses tokens matching regex re
returning all the matching group segments, otherwise fails
Instances For
partial def
Parser.RegEx.match.loop
{ε σ α : Type (max u_1 u_2)}
[Parser.Stream σ α]
[Parser.Error ε σ α]
{m : Type (max u_1 u_2) → Type u_3}
[Monad m]
:
RegEx α → Nat → Array (Option (Stream.Segment σ)) → ParserT ε σ α m (Array (Option (Stream.Segment σ)))