module UVMHS.Lib.Parser.Regex where

import UVMHS.Core

import UVMHS.Lib.Annotated
import UVMHS.Lib.Pretty
import UVMHS.Lib.Window

import UVMHS.Lib.Parser.Loc
import UVMHS.Lib.Parser.ParserContext
import UVMHS.Lib.Parser.ParserError
import UVMHS.Lib.Parser.ParserInput

----------------
-- Classified --
----------------

class Classified c t | t  c where classify  t  c

-----------------
-- RegexResult --
-----------------

data RegexResult o u = RegexResult
  { forall o u. RegexResult o u -> ℕ64
regexResultLevel  ℕ64
  , forall o u. RegexResult o u -> Formats
regexResultFormats  Formats
  , forall o u. RegexResult o u -> 𝑂 o
regexResultOutput  𝑂 o
  , forall o u. RegexResult o u -> u
regexResultUpdate  u
  } deriving (RegexResult o u -> RegexResult o u -> Bool
(RegexResult o u -> RegexResult o u -> Bool)
-> (RegexResult o u -> RegexResult o u -> Bool)
-> Eq (RegexResult o u)
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall o u.
(Eq o, Eq u) =>
RegexResult o u -> RegexResult o u -> Bool
$c== :: forall o u.
(Eq o, Eq u) =>
RegexResult o u -> RegexResult o u -> Bool
== :: RegexResult o u -> RegexResult o u -> Bool
$c/= :: forall o u.
(Eq o, Eq u) =>
RegexResult o u -> RegexResult o u -> Bool
/= :: RegexResult o u -> RegexResult o u -> Bool
Eq,Eq (RegexResult o u)
Eq (RegexResult o u) =>
(RegexResult o u -> RegexResult o u -> Ordering)
-> (RegexResult o u -> RegexResult o u -> Bool)
-> (RegexResult o u -> RegexResult o u -> Bool)
-> (RegexResult o u -> RegexResult o u -> Bool)
-> (RegexResult o u -> RegexResult o u -> Bool)
-> (RegexResult o u -> RegexResult o u -> RegexResult o u)
-> (RegexResult o u -> RegexResult o u -> RegexResult o u)
-> Ord (RegexResult o u)
RegexResult o u -> RegexResult o u -> Bool
RegexResult o u -> RegexResult o u -> Ordering
RegexResult o u -> RegexResult o u -> RegexResult o u
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall o u. (Ord o, Ord u) => Eq (RegexResult o u)
forall o u.
(Ord o, Ord u) =>
RegexResult o u -> RegexResult o u -> Bool
forall o u.
(Ord o, Ord u) =>
RegexResult o u -> RegexResult o u -> Ordering
forall o u.
(Ord o, Ord u) =>
RegexResult o u -> RegexResult o u -> RegexResult o u
$ccompare :: forall o u.
(Ord o, Ord u) =>
RegexResult o u -> RegexResult o u -> Ordering
compare :: RegexResult o u -> RegexResult o u -> Ordering
$c< :: forall o u.
(Ord o, Ord u) =>
RegexResult o u -> RegexResult o u -> Bool
< :: RegexResult o u -> RegexResult o u -> Bool
$c<= :: forall o u.
(Ord o, Ord u) =>
RegexResult o u -> RegexResult o u -> Bool
<= :: RegexResult o u -> RegexResult o u -> Bool
$c> :: forall o u.
(Ord o, Ord u) =>
RegexResult o u -> RegexResult o u -> Bool
> :: RegexResult o u -> RegexResult o u -> Bool
$c>= :: forall o u.
(Ord o, Ord u) =>
RegexResult o u -> RegexResult o u -> Bool
>= :: RegexResult o u -> RegexResult o u -> Bool
$cmax :: forall o u.
(Ord o, Ord u) =>
RegexResult o u -> RegexResult o u -> RegexResult o u
max :: RegexResult o u -> RegexResult o u -> RegexResult o u
$cmin :: forall o u.
(Ord o, Ord u) =>
RegexResult o u -> RegexResult o u -> RegexResult o u
min :: RegexResult o u -> RegexResult o u -> RegexResult o u
Ord,Int -> RegexResult o u -> ShowS
[RegexResult o u] -> ShowS
RegexResult o u -> [ℂ]
(Int -> RegexResult o u -> ShowS)
-> (RegexResult o u -> [ℂ])
-> ([RegexResult o u] -> ShowS)
-> Show (RegexResult o u)
forall a.
(Int -> a -> ShowS) -> (a -> [ℂ]) -> ([a] -> ShowS) -> Show a
forall o u. (Show o, Show u) => Int -> RegexResult o u -> ShowS
forall o u. (Show o, Show u) => [RegexResult o u] -> ShowS
forall o u. (Show o, Show u) => RegexResult o u -> [ℂ]
$cshowsPrec :: forall o u. (Show o, Show u) => Int -> RegexResult o u -> ShowS
showsPrec :: Int -> RegexResult o u -> ShowS
$cshow :: forall o u. (Show o, Show u) => RegexResult o u -> [ℂ]
show :: RegexResult o u -> [ℂ]
$cshowList :: forall o u. (Show o, Show u) => [RegexResult o u] -> ShowS
showList :: [RegexResult o u] -> ShowS
Show)
makePrettyRecord ''RegexResult
instance (Zero u)  Null (RegexResult o u) where
  null :: RegexResult o u
null = ℕ64 -> Formats -> 𝑂 o -> u -> RegexResult o u
forall o u. ℕ64 -> Formats -> 𝑂 o -> u -> RegexResult o u
RegexResult ℕ64
forall a. Zero a => a
zero Formats
forall a. Null a => a
null 𝑂 o
forall a. 𝑂 a
None u
forall a. Zero a => a
zero
instance (Ord u)  Append (RegexResult o u) where
  RegexResult o u
r₁ ⧺ :: RegexResult o u -> RegexResult o u -> RegexResult o u
 RegexResult o u
r₂ = if RegexResult o u -> ℕ64
forall o u. RegexResult o u -> ℕ64
regexResultLevel RegexResult o u
r₁ ℕ64 -> ℕ64 -> Bool
forall a. Ord a => a -> a -> Bool
 RegexResult o u -> ℕ64
forall o u. RegexResult o u -> ℕ64
regexResultLevel RegexResult o u
r₂ then RegexResult o u
r₁ else RegexResult o u
r₂
instance (Ord u,Zero u)  Monoid (RegexResult o u)

instance (Zero u)  Eps (RegexResult o u) where
  eps :: RegexResult o u
eps = ℕ64 -> Formats -> 𝑂 o -> u -> RegexResult o u
forall o u. ℕ64 -> Formats -> 𝑂 o -> u -> RegexResult o u
RegexResult ℕ64
forall a. Zero a => a
zero Formats
forall a. Null a => a
null 𝑂 o
forall a. 𝑂 a
None u
forall a. Zero a => a
zero
instance (Ord u,Plus u)  Seq (RegexResult o u) where
  RegexResult ℕ64
l₁ Formats
fm₁ 𝑂 o
o₁ u
u₁ ▷ :: RegexResult o u -> RegexResult o u -> RegexResult o u
 RegexResult ℕ64
l₂ Formats
fm₂ 𝑂 o
o₂ u
u₂ = 
    ℕ64 -> Formats -> 𝑂 o -> u -> RegexResult o u
forall o u. ℕ64 -> Formats -> 𝑂 o -> u -> RegexResult o u
RegexResult (ℕ64
l₁ ℕ64 -> ℕ64 -> ℕ64
forall a. Ord a => a -> a -> a
 ℕ64
l₂) (Formats
fm₁ Formats -> Formats -> Formats
forall a. Append a => a -> a -> a
 Formats
fm₂) (𝑂 o -> 𝑂 o -> 𝑂 o
forall a. 𝑂 a -> 𝑂 a -> 𝑂 a
first 𝑂 o
o₁ 𝑂 o
o₂) (u
u₁ u -> u -> u
forall a. Plus a => a -> a -> a
+ u
u₂)
instance (Ord u,Additive u)  Seqoid (RegexResult o u)

---------------
-- RegexInfo --
---------------

newtype RegexInfo o u = RegexInfo
  { forall o u. RegexInfo o u -> 𝑂 (RegexResult o u)
regexInfoResult  𝑂 (RegexResult o u)
  } deriving (RegexInfo o u -> RegexInfo o u -> Bool
(RegexInfo o u -> RegexInfo o u -> Bool)
-> (RegexInfo o u -> RegexInfo o u -> Bool) -> Eq (RegexInfo o u)
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall o u. (Eq o, Eq u) => RegexInfo o u -> RegexInfo o u -> Bool
$c== :: forall o u. (Eq o, Eq u) => RegexInfo o u -> RegexInfo o u -> Bool
== :: RegexInfo o u -> RegexInfo o u -> Bool
$c/= :: forall o u. (Eq o, Eq u) => RegexInfo o u -> RegexInfo o u -> Bool
/= :: RegexInfo o u -> RegexInfo o u -> Bool
Eq,Eq (RegexInfo o u)
Eq (RegexInfo o u) =>
(RegexInfo o u -> RegexInfo o u -> Ordering)
-> (RegexInfo o u -> RegexInfo o u -> Bool)
-> (RegexInfo o u -> RegexInfo o u -> Bool)
-> (RegexInfo o u -> RegexInfo o u -> Bool)
-> (RegexInfo o u -> RegexInfo o u -> Bool)
-> (RegexInfo o u -> RegexInfo o u -> RegexInfo o u)
-> (RegexInfo o u -> RegexInfo o u -> RegexInfo o u)
-> Ord (RegexInfo o u)
RegexInfo o u -> RegexInfo o u -> Bool
RegexInfo o u -> RegexInfo o u -> Ordering
RegexInfo o u -> RegexInfo o u -> RegexInfo o u
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall o u. (Ord o, Ord u) => Eq (RegexInfo o u)
forall o u.
(Ord o, Ord u) =>
RegexInfo o u -> RegexInfo o u -> Bool
forall o u.
(Ord o, Ord u) =>
RegexInfo o u -> RegexInfo o u -> Ordering
forall o u.
(Ord o, Ord u) =>
RegexInfo o u -> RegexInfo o u -> RegexInfo o u
$ccompare :: forall o u.
(Ord o, Ord u) =>
RegexInfo o u -> RegexInfo o u -> Ordering
compare :: RegexInfo o u -> RegexInfo o u -> Ordering
$c< :: forall o u.
(Ord o, Ord u) =>
RegexInfo o u -> RegexInfo o u -> Bool
< :: RegexInfo o u -> RegexInfo o u -> Bool
$c<= :: forall o u.
(Ord o, Ord u) =>
RegexInfo o u -> RegexInfo o u -> Bool
<= :: RegexInfo o u -> RegexInfo o u -> Bool
$c> :: forall o u.
(Ord o, Ord u) =>
RegexInfo o u -> RegexInfo o u -> Bool
> :: RegexInfo o u -> RegexInfo o u -> Bool
$c>= :: forall o u.
(Ord o, Ord u) =>
RegexInfo o u -> RegexInfo o u -> Bool
>= :: RegexInfo o u -> RegexInfo o u -> Bool
$cmax :: forall o u.
(Ord o, Ord u) =>
RegexInfo o u -> RegexInfo o u -> RegexInfo o u
max :: RegexInfo o u -> RegexInfo o u -> RegexInfo o u
$cmin :: forall o u.
(Ord o, Ord u) =>
RegexInfo o u -> RegexInfo o u -> RegexInfo o u
min :: RegexInfo o u -> RegexInfo o u -> RegexInfo o u
Ord,Int -> RegexInfo o u -> ShowS
[RegexInfo o u] -> ShowS
RegexInfo o u -> [ℂ]
(Int -> RegexInfo o u -> ShowS)
-> (RegexInfo o u -> [ℂ])
-> ([RegexInfo o u] -> ShowS)
-> Show (RegexInfo o u)
forall a.
(Int -> a -> ShowS) -> (a -> [ℂ]) -> ([a] -> ShowS) -> Show a
forall o u. (Show o, Show u) => Int -> RegexInfo o u -> ShowS
forall o u. (Show o, Show u) => [RegexInfo o u] -> ShowS
forall o u. (Show o, Show u) => RegexInfo o u -> [ℂ]
$cshowsPrec :: forall o u. (Show o, Show u) => Int -> RegexInfo o u -> ShowS
showsPrec :: Int -> RegexInfo o u -> ShowS
$cshow :: forall o u. (Show o, Show u) => RegexInfo o u -> [ℂ]
show :: RegexInfo o u -> [ℂ]
$cshowList :: forall o u. (Show o, Show u) => [RegexInfo o u] -> ShowS
showList :: [RegexInfo o u] -> ShowS
Show)
makePrettySum ''RegexInfo

instance (Zero u)  Null (RegexInfo o u) where 
  null :: RegexInfo o u
null = 𝑂 (RegexResult o u) -> RegexInfo o u
forall o u. 𝑂 (RegexResult o u) -> RegexInfo o u
RegexInfo 𝑂 (RegexResult o u)
forall a. 𝑂 a
None
instance (Ord u)  Append (RegexInfo o u) where 
  RegexInfo 𝑂 (RegexResult o u)
rO₁ ⧺ :: RegexInfo o u -> RegexInfo o u -> RegexInfo o u
 RegexInfo 𝑂 (RegexResult o u)
rO₂ = 𝑂 (RegexResult o u) -> RegexInfo o u
forall o u. 𝑂 (RegexResult o u) -> RegexInfo o u
RegexInfo (𝑂 (RegexResult o u) -> RegexInfo o u)
-> 𝑂 (RegexResult o u) -> RegexInfo o u
forall a b. (a -> b) -> a -> b
$ case (𝑂 (RegexResult o u)
rO₁,𝑂 (RegexResult o u)
rO₂) of
    (𝑂 (RegexResult o u)
None,𝑂 (RegexResult o u)
None)  𝑂 (RegexResult o u)
forall a. 𝑂 a
None
    (𝑂 (RegexResult o u)
None,Some RegexResult o u
r₂)  RegexResult o u -> 𝑂 (RegexResult o u)
forall a. a -> 𝑂 a
Some RegexResult o u
r₂
    (Some RegexResult o u
r₁,𝑂 (RegexResult o u)
None)  RegexResult o u -> 𝑂 (RegexResult o u)
forall a. a -> 𝑂 a
Some RegexResult o u
r₁
    (Some RegexResult o u
r₁,Some RegexResult o u
r₂)  RegexResult o u -> 𝑂 (RegexResult o u)
forall a. a -> 𝑂 a
Some (RegexResult o u -> 𝑂 (RegexResult o u))
-> RegexResult o u -> 𝑂 (RegexResult o u)
forall a b. (a -> b) -> a -> b
$ RegexResult o u
r₁ RegexResult o u -> RegexResult o u -> RegexResult o u
forall a. Append a => a -> a -> a
 RegexResult o u
r₂
instance (Ord u,Zero u)  Monoid (RegexInfo o u)

instance (Zero u)  Eps (RegexInfo o u) where
  eps :: RegexInfo o u
eps = 𝑂 (RegexResult o u) -> RegexInfo o u
forall o u. 𝑂 (RegexResult o u) -> RegexInfo o u
RegexInfo (𝑂 (RegexResult o u) -> RegexInfo o u)
-> 𝑂 (RegexResult o u) -> RegexInfo o u
forall a b. (a -> b) -> a -> b
$ RegexResult o u -> 𝑂 (RegexResult o u)
forall a. a -> 𝑂 a
Some RegexResult o u
forall a. Null a => a
null
instance (Ord u,Plus u)  Seq (RegexInfo o u) where
  RegexInfo 𝑂 (RegexResult o u)
rO₁ ▷ :: RegexInfo o u -> RegexInfo o u -> RegexInfo o u
 RegexInfo 𝑂 (RegexResult o u)
rO₂ = 𝑂 (RegexResult o u) -> RegexInfo o u
forall o u. 𝑂 (RegexResult o u) -> RegexInfo o u
RegexInfo (𝑂 (RegexResult o u) -> RegexInfo o u)
-> 𝑂 (RegexResult o u) -> RegexInfo o u
forall a b. (a -> b) -> a -> b
$ case (𝑂 (RegexResult o u)
rO₁,𝑂 (RegexResult o u)
rO₂) of
    (Some RegexResult o u
r₁,Some RegexResult o u
r₂)  RegexResult o u -> 𝑂 (RegexResult o u)
forall a. a -> 𝑂 a
Some (RegexResult o u -> 𝑂 (RegexResult o u))
-> RegexResult o u -> 𝑂 (RegexResult o u)
forall a b. (a -> b) -> a -> b
$ RegexResult o u
r₁ RegexResult o u -> RegexResult o u -> RegexResult o u
forall a. Seq a => a -> a -> a
 RegexResult o u
r₂
    (𝑂 (RegexResult o u), 𝑂 (RegexResult o u))
_  𝑂 (RegexResult o u)
forall a. 𝑂 a
None
instance (Ord u,Additive u)  Seqoid (RegexInfo o u)

-----------
-- Regex --
-----------

newtype Regex c t o u = Regex { forall c t o u. Regex c t o u -> 𝐴 (RegexInfo o u) (RegexU c t o u)
unRegex  𝐴 (RegexInfo o u) (RegexU c t o u) }
  deriving (Regex c t o u -> Regex c t o u -> Bool
(Regex c t o u -> Regex c t o u -> Bool)
-> (Regex c t o u -> Regex c t o u -> Bool) -> Eq (Regex c t o u)
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall c t o u.
(Eq o, Eq u, Eq t, Eq c) =>
Regex c t o u -> Regex c t o u -> Bool
$c== :: forall c t o u.
(Eq o, Eq u, Eq t, Eq c) =>
Regex c t o u -> Regex c t o u -> Bool
== :: Regex c t o u -> Regex c t o u -> Bool
$c/= :: forall c t o u.
(Eq o, Eq u, Eq t, Eq c) =>
Regex c t o u -> Regex c t o u -> Bool
/= :: Regex c t o u -> Regex c t o u -> Bool
Eq,Eq (Regex c t o u)
Eq (Regex c t o u) =>
(Regex c t o u -> Regex c t o u -> Ordering)
-> (Regex c t o u -> Regex c t o u -> Bool)
-> (Regex c t o u -> Regex c t o u -> Bool)
-> (Regex c t o u -> Regex c t o u -> Bool)
-> (Regex c t o u -> Regex c t o u -> Bool)
-> (Regex c t o u -> Regex c t o u -> Regex c t o u)
-> (Regex c t o u -> Regex c t o u -> Regex c t o u)
-> Ord (Regex c t o u)
Regex c t o u -> Regex c t o u -> Bool
Regex c t o u -> Regex c t o u -> Ordering
Regex c t o u -> Regex c t o u -> Regex c t o u
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall c t o u. (Ord o, Ord u, Ord t, Ord c) => Eq (Regex c t o u)
forall c t o u.
(Ord o, Ord u, Ord t, Ord c) =>
Regex c t o u -> Regex c t o u -> Bool
forall c t o u.
(Ord o, Ord u, Ord t, Ord c) =>
Regex c t o u -> Regex c t o u -> Ordering
forall c t o u.
(Ord o, Ord u, Ord t, Ord c) =>
Regex c t o u -> Regex c t o u -> Regex c t o u
$ccompare :: forall c t o u.
(Ord o, Ord u, Ord t, Ord c) =>
Regex c t o u -> Regex c t o u -> Ordering
compare :: Regex c t o u -> Regex c t o u -> Ordering
$c< :: forall c t o u.
(Ord o, Ord u, Ord t, Ord c) =>
Regex c t o u -> Regex c t o u -> Bool
< :: Regex c t o u -> Regex c t o u -> Bool
$c<= :: forall c t o u.
(Ord o, Ord u, Ord t, Ord c) =>
Regex c t o u -> Regex c t o u -> Bool
<= :: Regex c t o u -> Regex c t o u -> Bool
$c> :: forall c t o u.
(Ord o, Ord u, Ord t, Ord c) =>
Regex c t o u -> Regex c t o u -> Bool
> :: Regex c t o u -> Regex c t o u -> Bool
$c>= :: forall c t o u.
(Ord o, Ord u, Ord t, Ord c) =>
Regex c t o u -> Regex c t o u -> Bool
>= :: Regex c t o u -> Regex c t o u -> Bool
$cmax :: forall c t o u.
(Ord o, Ord u, Ord t, Ord c) =>
Regex c t o u -> Regex c t o u -> Regex c t o u
max :: Regex c t o u -> Regex c t o u -> Regex c t o u
$cmin :: forall c t o u.
(Ord o, Ord u, Ord t, Ord c) =>
Regex c t o u -> Regex c t o u -> Regex c t o u
min :: Regex c t o u -> Regex c t o u -> Regex c t o u
Ord,Int -> Regex c t o u -> ShowS
[Regex c t o u] -> ShowS
Regex c t o u -> [ℂ]
(Int -> Regex c t o u -> ShowS)
-> (Regex c t o u -> [ℂ])
-> ([Regex c t o u] -> ShowS)
-> Show (Regex c t o u)
forall a.
(Int -> a -> ShowS) -> (a -> [ℂ]) -> ([a] -> ShowS) -> Show a
forall c t o u.
(Show o, Show u, Show t, Show c) =>
Int -> Regex c t o u -> ShowS
forall c t o u.
(Show o, Show u, Show t, Show c) =>
[Regex c t o u] -> ShowS
forall c t o u.
(Show o, Show u, Show t, Show c) =>
Regex c t o u -> [ℂ]
$cshowsPrec :: forall c t o u.
(Show o, Show u, Show t, Show c) =>
Int -> Regex c t o u -> ShowS
showsPrec :: Int -> Regex c t o u -> ShowS
$cshow :: forall c t o u.
(Show o, Show u, Show t, Show c) =>
Regex c t o u -> [ℂ]
show :: Regex c t o u -> [ℂ]
$cshowList :: forall c t o u.
(Show o, Show u, Show t, Show c) =>
[Regex c t o u] -> ShowS
showList :: [Regex c t o u] -> ShowS
Show)
data RegexU c t o u =
    NullR
  | ResR (RegexResult o u)
  | AtomR (RegexResult o u) (RegexAtom c t o u)
  | SumsR (𝑃 (Regex c t o u))
  | SeqsR (𝐿 (Regex c t o u))
  | StarR (RegexResult o u) (Regex c t o u)
  deriving (RegexU c t o u -> RegexU c t o u -> Bool
(RegexU c t o u -> RegexU c t o u -> Bool)
-> (RegexU c t o u -> RegexU c t o u -> Bool)
-> Eq (RegexU c t o u)
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall c t o u.
(Eq o, Eq u, Eq t, Eq c) =>
RegexU c t o u -> RegexU c t o u -> Bool
$c== :: forall c t o u.
(Eq o, Eq u, Eq t, Eq c) =>
RegexU c t o u -> RegexU c t o u -> Bool
== :: RegexU c t o u -> RegexU c t o u -> Bool
$c/= :: forall c t o u.
(Eq o, Eq u, Eq t, Eq c) =>
RegexU c t o u -> RegexU c t o u -> Bool
/= :: RegexU c t o u -> RegexU c t o u -> Bool
Eq,Eq (RegexU c t o u)
Eq (RegexU c t o u) =>
(RegexU c t o u -> RegexU c t o u -> Ordering)
-> (RegexU c t o u -> RegexU c t o u -> Bool)
-> (RegexU c t o u -> RegexU c t o u -> Bool)
-> (RegexU c t o u -> RegexU c t o u -> Bool)
-> (RegexU c t o u -> RegexU c t o u -> Bool)
-> (RegexU c t o u -> RegexU c t o u -> RegexU c t o u)
-> (RegexU c t o u -> RegexU c t o u -> RegexU c t o u)
-> Ord (RegexU c t o u)
RegexU c t o u -> RegexU c t o u -> Bool
RegexU c t o u -> RegexU c t o u -> Ordering
RegexU c t o u -> RegexU c t o u -> RegexU c t o u
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall c t o u. (Ord o, Ord u, Ord t, Ord c) => Eq (RegexU c t o u)
forall c t o u.
(Ord o, Ord u, Ord t, Ord c) =>
RegexU c t o u -> RegexU c t o u -> Bool
forall c t o u.
(Ord o, Ord u, Ord t, Ord c) =>
RegexU c t o u -> RegexU c t o u -> Ordering
forall c t o u.
(Ord o, Ord u, Ord t, Ord c) =>
RegexU c t o u -> RegexU c t o u -> RegexU c t o u
$ccompare :: forall c t o u.
(Ord o, Ord u, Ord t, Ord c) =>
RegexU c t o u -> RegexU c t o u -> Ordering
compare :: RegexU c t o u -> RegexU c t o u -> Ordering
$c< :: forall c t o u.
(Ord o, Ord u, Ord t, Ord c) =>
RegexU c t o u -> RegexU c t o u -> Bool
< :: RegexU c t o u -> RegexU c t o u -> Bool
$c<= :: forall c t o u.
(Ord o, Ord u, Ord t, Ord c) =>
RegexU c t o u -> RegexU c t o u -> Bool
<= :: RegexU c t o u -> RegexU c t o u -> Bool
$c> :: forall c t o u.
(Ord o, Ord u, Ord t, Ord c) =>
RegexU c t o u -> RegexU c t o u -> Bool
> :: RegexU c t o u -> RegexU c t o u -> Bool
$c>= :: forall c t o u.
(Ord o, Ord u, Ord t, Ord c) =>
RegexU c t o u -> RegexU c t o u -> Bool
>= :: RegexU c t o u -> RegexU c t o u -> Bool
$cmax :: forall c t o u.
(Ord o, Ord u, Ord t, Ord c) =>
RegexU c t o u -> RegexU c t o u -> RegexU c t o u
max :: RegexU c t o u -> RegexU c t o u -> RegexU c t o u
$cmin :: forall c t o u.
(Ord o, Ord u, Ord t, Ord c) =>
RegexU c t o u -> RegexU c t o u -> RegexU c t o u
min :: RegexU c t o u -> RegexU c t o u -> RegexU c t o u
Ord,Int -> RegexU c t o u -> ShowS
[RegexU c t o u] -> ShowS
RegexU c t o u -> [ℂ]
(Int -> RegexU c t o u -> ShowS)
-> (RegexU c t o u -> [ℂ])
-> ([RegexU c t o u] -> ShowS)
-> Show (RegexU c t o u)
forall a.
(Int -> a -> ShowS) -> (a -> [ℂ]) -> ([a] -> ShowS) -> Show a
forall c t o u.
(Show o, Show u, Show t, Show c) =>
Int -> RegexU c t o u -> ShowS
forall c t o u.
(Show o, Show u, Show t, Show c) =>
[RegexU c t o u] -> ShowS
forall c t o u.
(Show o, Show u, Show t, Show c) =>
RegexU c t o u -> [ℂ]
$cshowsPrec :: forall c t o u.
(Show o, Show u, Show t, Show c) =>
Int -> RegexU c t o u -> ShowS
showsPrec :: Int -> RegexU c t o u -> ShowS
$cshow :: forall c t o u.
(Show o, Show u, Show t, Show c) =>
RegexU c t o u -> [ℂ]
show :: RegexU c t o u -> [ℂ]
$cshowList :: forall c t o u.
(Show o, Show u, Show t, Show c) =>
[RegexU c t o u] -> ShowS
showList :: [RegexU c t o u] -> ShowS
Show)
data RegexAtom c t o u =
    TokRA t
  | NTokRA (𝑃 t)
  | ClassRA c
  deriving (RegexAtom c t o u -> RegexAtom c t o u -> Bool
(RegexAtom c t o u -> RegexAtom c t o u -> Bool)
-> (RegexAtom c t o u -> RegexAtom c t o u -> Bool)
-> Eq (RegexAtom c t o u)
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall c t k (o :: k) k (u :: k).
(Eq t, Eq c) =>
RegexAtom c t o u -> RegexAtom c t o u -> Bool
$c== :: forall c t k (o :: k) k (u :: k).
(Eq t, Eq c) =>
RegexAtom c t o u -> RegexAtom c t o u -> Bool
== :: RegexAtom c t o u -> RegexAtom c t o u -> Bool
$c/= :: forall c t k (o :: k) k (u :: k).
(Eq t, Eq c) =>
RegexAtom c t o u -> RegexAtom c t o u -> Bool
/= :: RegexAtom c t o u -> RegexAtom c t o u -> Bool
Eq,Eq (RegexAtom c t o u)
Eq (RegexAtom c t o u) =>
(RegexAtom c t o u -> RegexAtom c t o u -> Ordering)
-> (RegexAtom c t o u -> RegexAtom c t o u -> Bool)
-> (RegexAtom c t o u -> RegexAtom c t o u -> Bool)
-> (RegexAtom c t o u -> RegexAtom c t o u -> Bool)
-> (RegexAtom c t o u -> RegexAtom c t o u -> Bool)
-> (RegexAtom c t o u -> RegexAtom c t o u -> RegexAtom c t o u)
-> (RegexAtom c t o u -> RegexAtom c t o u -> RegexAtom c t o u)
-> Ord (RegexAtom c t o u)
RegexAtom c t o u -> RegexAtom c t o u -> Bool
RegexAtom c t o u -> RegexAtom c t o u -> Ordering
RegexAtom c t o u -> RegexAtom c t o u -> RegexAtom c t o u
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall c t k (o :: k) k (u :: k).
(Ord t, Ord c) =>
Eq (RegexAtom c t o u)
forall c t k (o :: k) k (u :: k).
(Ord t, Ord c) =>
RegexAtom c t o u -> RegexAtom c t o u -> Bool
forall c t k (o :: k) k (u :: k).
(Ord t, Ord c) =>
RegexAtom c t o u -> RegexAtom c t o u -> Ordering
forall c t k (o :: k) k (u :: k).
(Ord t, Ord c) =>
RegexAtom c t o u -> RegexAtom c t o u -> RegexAtom c t o u
$ccompare :: forall c t k (o :: k) k (u :: k).
(Ord t, Ord c) =>
RegexAtom c t o u -> RegexAtom c t o u -> Ordering
compare :: RegexAtom c t o u -> RegexAtom c t o u -> Ordering
$c< :: forall c t k (o :: k) k (u :: k).
(Ord t, Ord c) =>
RegexAtom c t o u -> RegexAtom c t o u -> Bool
< :: RegexAtom c t o u -> RegexAtom c t o u -> Bool
$c<= :: forall c t k (o :: k) k (u :: k).
(Ord t, Ord c) =>
RegexAtom c t o u -> RegexAtom c t o u -> Bool
<= :: RegexAtom c t o u -> RegexAtom c t o u -> Bool
$c> :: forall c t k (o :: k) k (u :: k).
(Ord t, Ord c) =>
RegexAtom c t o u -> RegexAtom c t o u -> Bool
> :: RegexAtom c t o u -> RegexAtom c t o u -> Bool
$c>= :: forall c t k (o :: k) k (u :: k).
(Ord t, Ord c) =>
RegexAtom c t o u -> RegexAtom c t o u -> Bool
>= :: RegexAtom c t o u -> RegexAtom c t o u -> Bool
$cmax :: forall c t k (o :: k) k (u :: k).
(Ord t, Ord c) =>
RegexAtom c t o u -> RegexAtom c t o u -> RegexAtom c t o u
max :: RegexAtom c t o u -> RegexAtom c t o u -> RegexAtom c t o u
$cmin :: forall c t k (o :: k) k (u :: k).
(Ord t, Ord c) =>
RegexAtom c t o u -> RegexAtom c t o u -> RegexAtom c t o u
min :: RegexAtom c t o u -> RegexAtom c t o u -> RegexAtom c t o u
Ord,Int -> RegexAtom c t o u -> ShowS
[RegexAtom c t o u] -> ShowS
RegexAtom c t o u -> [ℂ]
(Int -> RegexAtom c t o u -> ShowS)
-> (RegexAtom c t o u -> [ℂ])
-> ([RegexAtom c t o u] -> ShowS)
-> Show (RegexAtom c t o u)
forall a.
(Int -> a -> ShowS) -> (a -> [ℂ]) -> ([a] -> ShowS) -> Show a
forall c t k (o :: k) k (u :: k).
(Show t, Show c) =>
Int -> RegexAtom c t o u -> ShowS
forall c t k (o :: k) k (u :: k).
(Show t, Show c) =>
[RegexAtom c t o u] -> ShowS
forall c t k (o :: k) k (u :: k).
(Show t, Show c) =>
RegexAtom c t o u -> [ℂ]
$cshowsPrec :: forall c t k (o :: k) k (u :: k).
(Show t, Show c) =>
Int -> RegexAtom c t o u -> ShowS
showsPrec :: Int -> RegexAtom c t o u -> ShowS
$cshow :: forall c t k (o :: k) k (u :: k).
(Show t, Show c) =>
RegexAtom c t o u -> [ℂ]
show :: RegexAtom c t o u -> [ℂ]
$cshowList :: forall c t k (o :: k) k (u :: k).
(Show t, Show c) =>
[RegexAtom c t o u] -> ShowS
showList :: [RegexAtom c t o u] -> ShowS
Show)
makePrettySum ''RegexU
makePrettySum ''RegexAtom

-- Construction --

instance (Zero u)                              Null   (Regex c t o u) where null :: Regex c t o u
null = Regex c t o u
forall u c t o. Zero u => Regex c t o u
nullRegex
instance (Ord c,Ord t,Ord o,Ord u,Plus u)      Append (Regex c t o u) where ⧺ :: Regex c t o u -> Regex c t o u -> Regex c t o u
(⧺) = Regex c t o u -> Regex c t o u -> Regex c t o u
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Plus u) =>
Regex c t o u -> Regex c t o u -> Regex c t o u
sumRegex
instance (Ord c,Ord t,Ord o,Ord u,Zero u)      Eps    (Regex c t o u) where eps :: Regex c t o u
eps = Regex c t o u
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
Regex c t o u
epsRegex
instance (Ord c,Ord t,Ord o,Ord u,Additive u)  Seq    (Regex c t o u) where ▷ :: Regex c t o u -> Regex c t o u -> Regex c t o u
(▷) = Regex c t o u -> Regex c t o u -> Regex c t o u
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Additive u) =>
Regex c t o u -> Regex c t o u -> Regex c t o u
seqRegex
instance (Ord c,Ord t,Ord o,Ord u,Zero u)      Star   (Regex c t o u) where star :: Regex c t o u -> Regex c t o u
star = Regex c t o u -> Regex c t o u
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
Regex c t o u -> Regex c t o u
starRegex

instance (Ord c,Ord t,Ord o,Ord u,Additive u)  Monoid (Regex c t o u)
instance (Ord c,Ord t,Ord o,Ord u,Additive u)  Seqoid (Regex c t o u)
instance (Ord c,Ord t,Ord o,Ord u,Additive u)  Kleene (Regex c t o u)

nullRegex  (Zero u)  Regex c t o u
nullRegex :: forall u c t o. Zero u => Regex c t o u
nullRegex = 𝐴 (RegexInfo o u) (RegexU c t o u) -> Regex c t o u
forall c t o u. 𝐴 (RegexInfo o u) (RegexU c t o u) -> Regex c t o u
Regex (𝐴 (RegexInfo o u) (RegexU c t o u) -> Regex c t o u)
-> 𝐴 (RegexInfo o u) (RegexU c t o u) -> Regex c t o u
forall a b. (a -> b) -> a -> b
$ RegexInfo o u
-> RegexU c t o u -> 𝐴 (RegexInfo o u) (RegexU c t o u)
forall e a. e -> a -> 𝐴 e a
𝐴 RegexInfo o u
forall a. Null a => a
null RegexU c t o u
forall c t o u. RegexU c t o u
NullR

resRegex  (Ord c,Ord t,Ord o,Ord u,Zero u)  RegexResult o u  Regex c t o u
resRegex :: forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
RegexResult o u -> Regex c t o u
resRegex RegexResult o u
r = 𝐴 (RegexInfo o u) (RegexU c t o u) -> Regex c t o u
forall c t o u. 𝐴 (RegexInfo o u) (RegexU c t o u) -> Regex c t o u
Regex (𝐴 (RegexInfo o u) (RegexU c t o u) -> Regex c t o u)
-> 𝐴 (RegexInfo o u) (RegexU c t o u) -> Regex c t o u
forall a b. (a -> b) -> a -> b
$ RegexInfo o u
-> RegexU c t o u -> 𝐴 (RegexInfo o u) (RegexU c t o u)
forall e a. e -> a -> 𝐴 e a
𝐴 (𝑂 (RegexResult o u) -> RegexInfo o u
forall o u. 𝑂 (RegexResult o u) -> RegexInfo o u
RegexInfo (𝑂 (RegexResult o u) -> RegexInfo o u)
-> 𝑂 (RegexResult o u) -> RegexInfo o u
forall a b. (a -> b) -> a -> b
$ RegexResult o u -> 𝑂 (RegexResult o u)
forall a. a -> 𝑂 a
Some RegexResult o u
r) (RegexU c t o u -> 𝐴 (RegexInfo o u) (RegexU c t o u))
-> RegexU c t o u -> 𝐴 (RegexInfo o u) (RegexU c t o u)
forall a b. (a -> b) -> a -> b
$ RegexResult o u -> RegexU c t o u
forall c t o u. RegexResult o u -> RegexU c t o u
ResR RegexResult o u
r

epsRegex  (Ord c,Ord t,Ord o,Ord u,Zero u)  Regex c t o u
epsRegex :: forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
Regex c t o u
epsRegex = RegexResult o u -> Regex c t o u
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
RegexResult o u -> Regex c t o u
resRegex RegexResult o u
forall a. Null a => a
null

retRegex  (Ord c,Ord t,Ord o,Ord u,Zero u)  ℕ64  Formats  𝑂 o  u  Regex c t o u
retRegex :: forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
ℕ64 -> Formats -> 𝑂 o -> u -> Regex c t o u
retRegex ℕ64
n Formats
fm 𝑂 o
oO u
u = RegexResult o u -> Regex c t o u
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
RegexResult o u -> Regex c t o u
resRegex (RegexResult o u -> Regex c t o u)
-> RegexResult o u -> Regex c t o u
forall a b. (a -> b) -> a -> b
$ ℕ64 -> Formats -> 𝑂 o -> u -> RegexResult o u
forall o u. ℕ64 -> Formats -> 𝑂 o -> u -> RegexResult o u
RegexResult ℕ64
n Formats
fm 𝑂 o
oO u
u

outRegex  (Ord c,Ord t,Ord o,Ord u,Zero u)  ℕ64  Formats  o  Regex c t o u
outRegex :: forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
ℕ64 -> Formats -> o -> Regex c t o u
outRegex ℕ64
n Formats
fm o
o = ℕ64 -> Formats -> 𝑂 o -> u -> Regex c t o u
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
ℕ64 -> Formats -> 𝑂 o -> u -> Regex c t o u
retRegex ℕ64
n Formats
fm (o -> 𝑂 o
forall a. a -> 𝑂 a
Some o
o) u
forall a. Zero a => a
zero

lepsRegex  (Ord c,Ord t,Ord o,Ord u,Zero u)  ℕ64  Regex c t o u
lepsRegex :: forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
ℕ64 -> Regex c t o u
lepsRegex ℕ64
n = ℕ64 -> Formats -> 𝑂 o -> u -> Regex c t o u
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
ℕ64 -> Formats -> 𝑂 o -> u -> Regex c t o u
retRegex ℕ64
n Formats
forall a. Null a => a
null 𝑂 o
forall a. 𝑂 a
None u
forall a. Zero a => a
zero

fepsRegex  (Ord c,Ord t,Ord o,Ord u,Zero u)  Formats  Regex c t o u
fepsRegex :: forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
Formats -> Regex c t o u
fepsRegex Formats
fm = ℕ64 -> Formats -> 𝑂 o -> u -> Regex c t o u
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
ℕ64 -> Formats -> 𝑂 o -> u -> Regex c t o u
retRegex ℕ64
forall a. Zero a => a
zero Formats
fm 𝑂 o
forall a. 𝑂 a
None u
forall a. Zero a => a
zero

oepsRegex  (Ord c,Ord t,Ord o,Ord u,Zero u)  o  Regex c t o u
oepsRegex :: forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
o -> Regex c t o u
oepsRegex o
o = ℕ64 -> Formats -> 𝑂 o -> u -> Regex c t o u
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
ℕ64 -> Formats -> 𝑂 o -> u -> Regex c t o u
retRegex ℕ64
forall a. Zero a => a
zero Formats
forall a. Null a => a
null (o -> 𝑂 o
forall a. a -> 𝑂 a
Some o
o) u
forall a. Zero a => a
zero

uepsRegex  (Ord c,Ord t,Ord o,Ord u,Zero u)  u  Regex c t o u
uepsRegex :: forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
u -> Regex c t o u
uepsRegex u
u = ℕ64 -> Formats -> 𝑂 o -> u -> Regex c t o u
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
ℕ64 -> Formats -> 𝑂 o -> u -> Regex c t o u
retRegex ℕ64
forall a. Zero a => a
zero Formats
forall a. Null a => a
null 𝑂 o
forall a. 𝑂 a
None u
u

atomRegex  (Ord c,Ord t,Ord o,Ord u,Zero u)  RegexAtom c t o u  Regex c t o u
atomRegex :: forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
RegexAtom c t o u -> Regex c t o u
atomRegex = 𝐴 (RegexInfo o u) (RegexU c t o u) -> Regex c t o u
forall c t o u. 𝐴 (RegexInfo o u) (RegexU c t o u) -> Regex c t o u
Regex (𝐴 (RegexInfo o u) (RegexU c t o u) -> Regex c t o u)
-> (RegexU c t o u -> 𝐴 (RegexInfo o u) (RegexU c t o u))
-> RegexU c t o u
-> Regex c t o u
forall b c a. (b -> c) -> (a -> b) -> a -> c
 RegexInfo o u
-> RegexU c t o u -> 𝐴 (RegexInfo o u) (RegexU c t o u)
forall e a. e -> a -> 𝐴 e a
𝐴 RegexInfo o u
forall a. Null a => a
null (RegexU c t o u -> Regex c t o u)
-> (RegexAtom c t o u -> RegexU c t o u)
-> RegexAtom c t o u
-> Regex c t o u
forall b c a. (b -> c) -> (a -> b) -> a -> c
 RegexResult o u -> RegexAtom c t o u -> RegexU c t o u
forall c t o u.
RegexResult o u -> RegexAtom c t o u -> RegexU c t o u
AtomR RegexResult o u
forall a. Eps a => a
eps

tokRegex  (Ord c,Ord t,Ord o,Ord u,Zero u)  t  Regex c t o u
tokRegex :: forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
t -> Regex c t o u
tokRegex t
t = RegexAtom c t o u -> Regex c t o u
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
RegexAtom c t o u -> Regex c t o u
atomRegex (RegexAtom c t o u -> Regex c t o u)
-> RegexAtom c t o u -> Regex c t o u
forall a b. (a -> b) -> a -> b
$ t -> RegexAtom c t o u
forall {k} {k} c t (o :: k) (u :: k). t -> RegexAtom c t o u
TokRA t
t

ntokRegex  (Ord c,Ord t,Ord o,Ord u,Zero u)  𝑃 t  Regex c t o u
ntokRegex :: forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
𝑃 t -> Regex c t o u
ntokRegex 𝑃 t
t = RegexAtom c t o u -> Regex c t o u
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
RegexAtom c t o u -> Regex c t o u
atomRegex (RegexAtom c t o u -> Regex c t o u)
-> RegexAtom c t o u -> Regex c t o u
forall a b. (a -> b) -> a -> b
$ 𝑃 t -> RegexAtom c t o u
forall {k} {k} c t (o :: k) (u :: k). 𝑃 t -> RegexAtom c t o u
NTokRA 𝑃 t
t

classRegex  (Ord c,Ord t,Ord o,Ord u,Zero u)  c  Regex c t o u
classRegex :: forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
c -> Regex c t o u
classRegex c
c = RegexAtom c t o u -> Regex c t o u
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
RegexAtom c t o u -> Regex c t o u
atomRegex (RegexAtom c t o u -> Regex c t o u)
-> RegexAtom c t o u -> Regex c t o u
forall a b. (a -> b) -> a -> b
$ c -> RegexAtom c t o u
forall {k} {k} c t (o :: k) (u :: k). c -> RegexAtom c t o u
ClassRA c
c

consEpsRegex  (Ord c,Ord t,Ord o,Ord u,Plus u)  RegexResult o u  Regex c t o u  Regex c t o u
consEpsRegex :: forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Plus u) =>
RegexResult o u -> Regex c t o u -> Regex c t o u
consEpsRegex RegexResult o u
r (Regex (𝐴 RegexInfo o u
i RegexU c t o u
e)) = 𝐴 (RegexInfo o u) (RegexU c t o u) -> Regex c t o u
forall c t o u. 𝐴 (RegexInfo o u) (RegexU c t o u) -> Regex c t o u
Regex (𝐴 (RegexInfo o u) (RegexU c t o u) -> Regex c t o u)
-> 𝐴 (RegexInfo o u) (RegexU c t o u) -> Regex c t o u
forall a b. (a -> b) -> a -> b
$ RegexInfo o u
-> RegexU c t o u -> 𝐴 (RegexInfo o u) (RegexU c t o u)
forall e a. e -> a -> 𝐴 e a
𝐴 (𝑂 (RegexResult o u) -> RegexInfo o u
forall o u. 𝑂 (RegexResult o u) -> RegexInfo o u
RegexInfo (RegexResult o u -> 𝑂 (RegexResult o u)
forall a. a -> 𝑂 a
Some RegexResult o u
r) RegexInfo o u -> RegexInfo o u -> RegexInfo o u
forall a. Seq a => a -> a -> a
 RegexInfo o u
i) (RegexU c t o u -> 𝐴 (RegexInfo o u) (RegexU c t o u))
-> RegexU c t o u -> 𝐴 (RegexInfo o u) (RegexU c t o u)
forall a b. (a -> b) -> a -> b
$ RegexResult o u -> RegexU c t o u -> RegexU c t o u
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Plus u) =>
RegexResult o u -> RegexU c t o u -> RegexU c t o u
consEpsRegexU RegexResult o u
r RegexU c t o u
e

consEpsRegexU  (Ord c,Ord t,Ord o,Ord u,Plus u)  RegexResult o u  RegexU c t o u  RegexU c t o u
consEpsRegexU :: forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Plus u) =>
RegexResult o u -> RegexU c t o u -> RegexU c t o u
consEpsRegexU RegexResult o u
r = \case
  RegexU c t o u
NullR  RegexU c t o u
forall c t o u. RegexU c t o u
NullR
  ResR RegexResult o u
r'  RegexResult o u -> RegexU c t o u
forall c t o u. RegexResult o u -> RegexU c t o u
ResR (RegexResult o u -> RegexU c t o u)
-> RegexResult o u -> RegexU c t o u
forall a b. (a -> b) -> a -> b
$ RegexResult o u
r RegexResult o u -> RegexResult o u -> RegexResult o u
forall a. Seq a => a -> a -> a
 RegexResult o u
r'
  AtomR RegexResult o u
r' RegexAtom c t o u
a  RegexResult o u -> RegexAtom c t o u -> RegexU c t o u
forall c t o u.
RegexResult o u -> RegexAtom c t o u -> RegexU c t o u
AtomR (RegexResult o u
r RegexResult o u -> RegexResult o u -> RegexResult o u
forall a. Seq a => a -> a -> a
 RegexResult o u
r') RegexAtom c t o u
a
  SumsR 𝑃 (Regex c t o u)
es  𝑃 (Regex c t o u) -> RegexU c t o u
forall c t o u. 𝑃 (Regex c t o u) -> RegexU c t o u
SumsR (𝑃 (Regex c t o u) -> RegexU c t o u)
-> 𝑃 (Regex c t o u) -> RegexU c t o u
forall a b. (a -> b) -> a -> b
$ 𝐼 (Regex c t o u) -> 𝑃 (Regex c t o u)
forall s t e. (ToIter e t, Set e s) => t -> s
pow (𝐼 (Regex c t o u) -> 𝑃 (Regex c t o u))
-> 𝐼 (Regex c t o u) -> 𝑃 (Regex c t o u)
forall a b. (a -> b) -> a -> b
$ (Regex c t o u -> Regex c t o u)
-> 𝐼 (Regex c t o u) -> 𝐼 (Regex c t o u)
forall a b. (a -> b) -> 𝐼 a -> 𝐼 b
forall (t :: * -> *) a b. Functor t => (a -> b) -> t a -> t b
map (RegexResult o u -> Regex c t o u -> Regex c t o u
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Plus u) =>
RegexResult o u -> Regex c t o u -> Regex c t o u
consEpsRegex RegexResult o u
r) (𝐼 (Regex c t o u) -> 𝐼 (Regex c t o u))
-> 𝐼 (Regex c t o u) -> 𝐼 (Regex c t o u)
forall a b. (a -> b) -> a -> b
$ 𝑃 (Regex c t o u) -> 𝐼 (Regex c t o u)
forall a t. ToIter a t => t -> 𝐼 a
iter 𝑃 (Regex c t o u)
es
  SeqsR 𝐿 (Regex c t o u)
Nil  RegexU c t o u
forall c t o u. RegexU c t o u
NullR
  SeqsR (Regex c t o u
e :& 𝐿 (Regex c t o u)
es)  𝐿 (Regex c t o u) -> RegexU c t o u
forall c t o u. 𝐿 (Regex c t o u) -> RegexU c t o u
SeqsR (𝐿 (Regex c t o u) -> RegexU c t o u)
-> 𝐿 (Regex c t o u) -> RegexU c t o u
forall a b. (a -> b) -> a -> b
$ RegexResult o u -> Regex c t o u -> Regex c t o u
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Plus u) =>
RegexResult o u -> Regex c t o u -> Regex c t o u
consEpsRegex RegexResult o u
r Regex c t o u
e Regex c t o u -> 𝐿 (Regex c t o u) -> 𝐿 (Regex c t o u)
forall a. a -> 𝐿 a -> 𝐿 a
:& 𝐿 (Regex c t o u)
es
  StarR RegexResult o u
r' Regex c t o u
e  RegexResult o u -> Regex c t o u -> RegexU c t o u
forall c t o u. RegexResult o u -> Regex c t o u -> RegexU c t o u
StarR (RegexResult o u
r RegexResult o u -> RegexResult o u -> RegexResult o u
forall a. Seq a => a -> a -> a
 RegexResult o u
r') Regex c t o u
e

snocEpsRegex  (Ord c,Ord t,Ord o,Ord u,Plus u)  RegexResult o u  Regex c t o u  Regex c t o u
snocEpsRegex :: forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Plus u) =>
RegexResult o u -> Regex c t o u -> Regex c t o u
snocEpsRegex RegexResult o u
r (Regex (𝐴 RegexInfo o u
i RegexU c t o u
e)) = 𝐴 (RegexInfo o u) (RegexU c t o u) -> Regex c t o u
forall c t o u. 𝐴 (RegexInfo o u) (RegexU c t o u) -> Regex c t o u
Regex (𝐴 (RegexInfo o u) (RegexU c t o u) -> Regex c t o u)
-> 𝐴 (RegexInfo o u) (RegexU c t o u) -> Regex c t o u
forall a b. (a -> b) -> a -> b
$ RegexInfo o u
-> RegexU c t o u -> 𝐴 (RegexInfo o u) (RegexU c t o u)
forall e a. e -> a -> 𝐴 e a
𝐴 (RegexInfo o u
i RegexInfo o u -> RegexInfo o u -> RegexInfo o u
forall a. Seq a => a -> a -> a
 𝑂 (RegexResult o u) -> RegexInfo o u
forall o u. 𝑂 (RegexResult o u) -> RegexInfo o u
RegexInfo (RegexResult o u -> 𝑂 (RegexResult o u)
forall a. a -> 𝑂 a
Some RegexResult o u
r)) (RegexU c t o u -> 𝐴 (RegexInfo o u) (RegexU c t o u))
-> RegexU c t o u -> 𝐴 (RegexInfo o u) (RegexU c t o u)
forall a b. (a -> b) -> a -> b
$ RegexResult o u -> RegexU c t o u -> RegexU c t o u
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Plus u) =>
RegexResult o u -> RegexU c t o u -> RegexU c t o u
snocEpsRegexU RegexResult o u
r RegexU c t o u
e

snocEpsRegexU  (Ord c,Ord t,Ord o,Ord u,Plus u)  RegexResult o u  RegexU c t o u  RegexU c t o u
snocEpsRegexU :: forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Plus u) =>
RegexResult o u -> RegexU c t o u -> RegexU c t o u
snocEpsRegexU RegexResult o u
r = \case
  RegexU c t o u
NullR  RegexU c t o u
forall c t o u. RegexU c t o u
NullR
  ResR RegexResult o u
r'  RegexResult o u -> RegexU c t o u
forall c t o u. RegexResult o u -> RegexU c t o u
ResR (RegexResult o u -> RegexU c t o u)
-> RegexResult o u -> RegexU c t o u
forall a b. (a -> b) -> a -> b
$ RegexResult o u
r' RegexResult o u -> RegexResult o u -> RegexResult o u
forall a. Seq a => a -> a -> a
 RegexResult o u
r
  AtomR RegexResult o u
r' RegexAtom c t o u
a  RegexResult o u -> RegexAtom c t o u -> RegexU c t o u
forall c t o u.
RegexResult o u -> RegexAtom c t o u -> RegexU c t o u
AtomR (RegexResult o u
r' RegexResult o u -> RegexResult o u -> RegexResult o u
forall a. Seq a => a -> a -> a
 RegexResult o u
r) RegexAtom c t o u
a
  SumsR 𝑃 (Regex c t o u)
es  𝑃 (Regex c t o u) -> RegexU c t o u
forall c t o u. 𝑃 (Regex c t o u) -> RegexU c t o u
SumsR (𝑃 (Regex c t o u) -> RegexU c t o u)
-> 𝑃 (Regex c t o u) -> RegexU c t o u
forall a b. (a -> b) -> a -> b
$ 𝐼 (Regex c t o u) -> 𝑃 (Regex c t o u)
forall s t e. (ToIter e t, Set e s) => t -> s
pow (𝐼 (Regex c t o u) -> 𝑃 (Regex c t o u))
-> 𝐼 (Regex c t o u) -> 𝑃 (Regex c t o u)
forall a b. (a -> b) -> a -> b
$ (Regex c t o u -> Regex c t o u)
-> 𝐼 (Regex c t o u) -> 𝐼 (Regex c t o u)
forall a b. (a -> b) -> 𝐼 a -> 𝐼 b
forall (t :: * -> *) a b. Functor t => (a -> b) -> t a -> t b
map (RegexResult o u -> Regex c t o u -> Regex c t o u
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Plus u) =>
RegexResult o u -> Regex c t o u -> Regex c t o u
consEpsRegex RegexResult o u
r) (𝐼 (Regex c t o u) -> 𝐼 (Regex c t o u))
-> 𝐼 (Regex c t o u) -> 𝐼 (Regex c t o u)
forall a b. (a -> b) -> a -> b
$ 𝑃 (Regex c t o u) -> 𝐼 (Regex c t o u)
forall a t. ToIter a t => t -> 𝐼 a
iter 𝑃 (Regex c t o u)
es
  SeqsR 𝐿 (Regex c t o u)
Nil  RegexU c t o u
forall c t o u. RegexU c t o u
NullR
  SeqsR (Regex c t o u
e :& 𝐿 (Regex c t o u)
es)  
    let (𝐿 (Regex c t o u)
es' :* Regex c t o u
e') = Regex c t o u
-> 𝐿 (Regex c t o u) -> 𝐿 (Regex c t o u) ∧ Regex c t o u
forall a. a -> 𝐿 a -> 𝐿 a ∧ a
swivelR Regex c t o u
e 𝐿 (Regex c t o u)
es
        e'' :: Regex c t o u
e'' = RegexResult o u -> Regex c t o u -> Regex c t o u
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Plus u) =>
RegexResult o u -> Regex c t o u -> Regex c t o u
snocEpsRegex RegexResult o u
r Regex c t o u
e'
        (Regex c t o u
e''' :* 𝐿 (Regex c t o u)
es'') = 𝐿 (Regex c t o u)
-> Regex c t o u -> Regex c t o u ∧ 𝐿 (Regex c t o u)
forall a. 𝐿 a -> a -> a ∧ 𝐿 a
swivelL 𝐿 (Regex c t o u)
es' Regex c t o u
e''
    in 𝐿 (Regex c t o u) -> RegexU c t o u
forall c t o u. 𝐿 (Regex c t o u) -> RegexU c t o u
SeqsR (𝐿 (Regex c t o u) -> RegexU c t o u)
-> 𝐿 (Regex c t o u) -> RegexU c t o u
forall a b. (a -> b) -> a -> b
$ Regex c t o u
e''' Regex c t o u -> 𝐿 (Regex c t o u) -> 𝐿 (Regex c t o u)
forall a. a -> 𝐿 a -> 𝐿 a
:& 𝐿 (Regex c t o u)
es''
  StarR RegexResult o u
r' Regex c t o u
e  RegexResult o u -> Regex c t o u -> RegexU c t o u
forall c t o u. RegexResult o u -> Regex c t o u -> RegexU c t o u
StarR (RegexResult o u
r' RegexResult o u -> RegexResult o u -> RegexResult o u
forall a. Seq a => a -> a -> a
 RegexResult o u
r) Regex c t o u
e

sumRegex  (Ord c,Ord t,Ord o,Ord u,Plus u)  Regex c t o u  Regex c t o u  Regex c t o u
sumRegex :: forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Plus u) =>
Regex c t o u -> Regex c t o u -> Regex c t o u
sumRegex e₁ :: Regex c t o u
e₁@(Regex (𝐴 RegexInfo o u
i₁ RegexU c t o u
e₁')) e₂ :: Regex c t o u
e₂@(Regex (𝐴 RegexInfo o u
i₂ RegexU c t o u
e₂')) = 𝐴 (RegexInfo o u) (RegexU c t o u) -> Regex c t o u
forall c t o u. 𝐴 (RegexInfo o u) (RegexU c t o u) -> Regex c t o u
Regex (𝐴 (RegexInfo o u) (RegexU c t o u) -> Regex c t o u)
-> 𝐴 (RegexInfo o u) (RegexU c t o u) -> Regex c t o u
forall a b. (a -> b) -> a -> b
$ RegexInfo o u
-> RegexU c t o u -> 𝐴 (RegexInfo o u) (RegexU c t o u)
forall e a. e -> a -> 𝐴 e a
𝐴 (RegexInfo o u
i₁ RegexInfo o u -> RegexInfo o u -> RegexInfo o u
forall a. Append a => a -> a -> a
 RegexInfo o u
i₂) (RegexU c t o u -> 𝐴 (RegexInfo o u) (RegexU c t o u))
-> RegexU c t o u -> 𝐴 (RegexInfo o u) (RegexU c t o u)
forall a b. (a -> b) -> a -> b
$ case (RegexU c t o u
e₁',RegexU c t o u
e₂') of
  (RegexU c t o u
NullR,RegexU c t o u
_)  RegexU c t o u
e₂'
  (RegexU c t o u
_,RegexU c t o u
NullR)  RegexU c t o u
e₁'
  (ResR RegexResult o u
r₁,ResR RegexResult o u
r₂)  RegexResult o u -> RegexU c t o u
forall c t o u. RegexResult o u -> RegexU c t o u
ResR (RegexResult o u -> RegexU c t o u)
-> RegexResult o u -> RegexU c t o u
forall a b. (a -> b) -> a -> b
$ RegexResult o u
r₁ RegexResult o u -> RegexResult o u -> RegexResult o u
forall a. Append a => a -> a -> a
 RegexResult o u
r₂
  (SumsR 𝑃 (Regex c t o u)
es₁,SumsR 𝑃 (Regex c t o u)
es₂)  𝑃 (Regex c t o u) -> RegexU c t o u
forall c t o u. 𝑃 (Regex c t o u) -> RegexU c t o u
SumsR (𝑃 (Regex c t o u) -> RegexU c t o u)
-> 𝑃 (Regex c t o u) -> RegexU c t o u
forall a b. (a -> b) -> a -> b
$ 𝑃 (Regex c t o u)
es₁ 𝑃 (Regex c t o u) -> 𝑃 (Regex c t o u) -> 𝑃 (Regex c t o u)
forall e s. Set e s => s -> s -> s
 𝑃 (Regex c t o u)
es₂
  (SumsR 𝑃 (Regex c t o u)
es₁,RegexU c t o u
_)  𝑃 (Regex c t o u) -> RegexU c t o u
forall c t o u. 𝑃 (Regex c t o u) -> RegexU c t o u
SumsR (𝑃 (Regex c t o u) -> RegexU c t o u)
-> 𝑃 (Regex c t o u) -> RegexU c t o u
forall a b. (a -> b) -> a -> b
$ 𝑃 (Regex c t o u)
es₁ 𝑃 (Regex c t o u) -> 𝑃 (Regex c t o u) -> 𝑃 (Regex c t o u)
forall e s. Set e s => s -> s -> s
 Regex c t o u -> 𝑃 (Regex c t o u)
forall a t. Single a t => a -> t
single Regex c t o u
e₂
  (RegexU c t o u
_,SumsR 𝑃 (Regex c t o u)
es₂)  𝑃 (Regex c t o u) -> RegexU c t o u
forall c t o u. 𝑃 (Regex c t o u) -> RegexU c t o u
SumsR (𝑃 (Regex c t o u) -> RegexU c t o u)
-> 𝑃 (Regex c t o u) -> RegexU c t o u
forall a b. (a -> b) -> a -> b
$ Regex c t o u -> 𝑃 (Regex c t o u)
forall a t. Single a t => a -> t
single Regex c t o u
e₁ 𝑃 (Regex c t o u) -> 𝑃 (Regex c t o u) -> 𝑃 (Regex c t o u)
forall e s. Set e s => s -> s -> s
 𝑃 (Regex c t o u)
es₂
  (RegexU c t o u, RegexU c t o u)
_  𝑃 (Regex c t o u) -> RegexU c t o u
forall c t o u. 𝑃 (Regex c t o u) -> RegexU c t o u
SumsR (𝑃 (Regex c t o u) -> RegexU c t o u)
-> 𝑃 (Regex c t o u) -> RegexU c t o u
forall a b. (a -> b) -> a -> b
$ [Regex c t o u] -> 𝑃 (Regex c t o u)
forall s t e. (ToIter e t, Set e s) => t -> s
pow [Regex c t o u
e₁,Regex c t o u
e₂]
  
seqRegex  (Ord c,Ord t,Ord o,Ord u,Additive u)  Regex c t o u  Regex c t o u  Regex c t o u
seqRegex :: forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Additive u) =>
Regex c t o u -> Regex c t o u -> Regex c t o u
seqRegex e₁ :: Regex c t o u
e₁@(Regex (𝐴 RegexInfo o u
i₁ RegexU c t o u
e₁')) e₂ :: Regex c t o u
e₂@(Regex (𝐴 RegexInfo o u
i₂ RegexU c t o u
e₂')) = 𝐴 (RegexInfo o u) (RegexU c t o u) -> Regex c t o u
forall c t o u. 𝐴 (RegexInfo o u) (RegexU c t o u) -> Regex c t o u
Regex (𝐴 (RegexInfo o u) (RegexU c t o u) -> Regex c t o u)
-> 𝐴 (RegexInfo o u) (RegexU c t o u) -> Regex c t o u
forall a b. (a -> b) -> a -> b
$ RegexInfo o u
-> RegexU c t o u -> 𝐴 (RegexInfo o u) (RegexU c t o u)
forall e a. e -> a -> 𝐴 e a
𝐴 (RegexInfo o u
i₁ RegexInfo o u -> RegexInfo o u -> RegexInfo o u
forall a. Seq a => a -> a -> a
 RegexInfo o u
i₂) (RegexU c t o u -> 𝐴 (RegexInfo o u) (RegexU c t o u))
-> RegexU c t o u -> 𝐴 (RegexInfo o u) (RegexU c t o u)
forall a b. (a -> b) -> a -> b
$ case (RegexU c t o u
e₁',RegexU c t o u
e₂') of
  (RegexU c t o u
NullR,RegexU c t o u
_)  RegexU c t o u
forall c t o u. RegexU c t o u
NullR
  (RegexU c t o u
_,RegexU c t o u
NullR)  RegexU c t o u
forall c t o u. RegexU c t o u
NullR
  (ResR RegexResult o u
r₁,RegexU c t o u
_)  RegexResult o u -> RegexU c t o u -> RegexU c t o u
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Plus u) =>
RegexResult o u -> RegexU c t o u -> RegexU c t o u
consEpsRegexU RegexResult o u
r₁ RegexU c t o u
e₂'
  (RegexU c t o u
_,ResR RegexResult o u
r₂)  RegexResult o u -> RegexU c t o u -> RegexU c t o u
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Plus u) =>
RegexResult o u -> RegexU c t o u -> RegexU c t o u
snocEpsRegexU RegexResult o u
r₂ RegexU c t o u
e₁'
  (SeqsR 𝐿 (Regex c t o u)
es₁,SeqsR 𝐿 (Regex c t o u)
es₂)  𝐿 (Regex c t o u) -> RegexU c t o u
forall c t o u. 𝐿 (Regex c t o u) -> RegexU c t o u
SeqsR (𝐿 (Regex c t o u) -> RegexU c t o u)
-> 𝐿 (Regex c t o u) -> RegexU c t o u
forall a b. (a -> b) -> a -> b
$ 𝐿 (Regex c t o u)
es₁ 𝐿 (Regex c t o u) -> 𝐿 (Regex c t o u) -> 𝐿 (Regex c t o u)
forall a. Append a => a -> a -> a
 𝐿 (Regex c t o u)
es₂
  (SeqsR 𝐿 (Regex c t o u)
es₁,RegexU c t o u
_)  𝐿 (Regex c t o u) -> RegexU c t o u
forall c t o u. 𝐿 (Regex c t o u) -> RegexU c t o u
SeqsR (𝐿 (Regex c t o u) -> RegexU c t o u)
-> 𝐿 (Regex c t o u) -> RegexU c t o u
forall a b. (a -> b) -> a -> b
$ 𝐿 (Regex c t o u)
es₁ 𝐿 (Regex c t o u) -> 𝐿 (Regex c t o u) -> 𝐿 (Regex c t o u)
forall a. Append a => a -> a -> a
 Regex c t o u -> 𝐿 (Regex c t o u)
forall a t. Single a t => a -> t
single Regex c t o u
e₂
  (RegexU c t o u
_,SeqsR 𝐿 (Regex c t o u)
es₂)  𝐿 (Regex c t o u) -> RegexU c t o u
forall c t o u. 𝐿 (Regex c t o u) -> RegexU c t o u
SeqsR (𝐿 (Regex c t o u) -> RegexU c t o u)
-> 𝐿 (Regex c t o u) -> RegexU c t o u
forall a b. (a -> b) -> a -> b
$ Regex c t o u -> 𝐿 (Regex c t o u)
forall a t. Single a t => a -> t
single Regex c t o u
e₁ 𝐿 (Regex c t o u) -> 𝐿 (Regex c t o u) -> 𝐿 (Regex c t o u)
forall a. Append a => a -> a -> a
 𝐿 (Regex c t o u)
es₂
  (AtomR RegexResult o u
r₁ RegexAtom c t o u
a₁,SumsR 𝑃 (Regex c t o u)
es₂)  𝑃 (Regex c t o u) -> RegexU c t o u
forall c t o u. 𝑃 (Regex c t o u) -> RegexU c t o u
SumsR (𝑃 (Regex c t o u) -> RegexU c t o u)
-> 𝑃 (Regex c t o u) -> RegexU c t o u
forall a b. (a -> b) -> a -> b
$ 𝐼 (Regex c t o u) -> 𝑃 (Regex c t o u)
forall s t e. (ToIter e t, Set e s) => t -> s
pow (𝐼 (Regex c t o u) -> 𝑃 (Regex c t o u))
-> 𝐼 (Regex c t o u) -> 𝑃 (Regex c t o u)
forall a b. (a -> b) -> a -> b
$ (Regex c t o u -> Regex c t o u)
-> 𝐼 (Regex c t o u) -> 𝐼 (Regex c t o u)
forall a b. (a -> b) -> 𝐼 a -> 𝐼 b
forall (t :: * -> *) a b. Functor t => (a -> b) -> t a -> t b
map (\ Regex c t o u
e  RegexResult o u -> Regex c t o u -> Regex c t o u
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Plus u) =>
RegexResult o u -> Regex c t o u -> Regex c t o u
consEpsRegex RegexResult o u
r₁ (RegexAtom c t o u -> Regex c t o u
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
RegexAtom c t o u -> Regex c t o u
atomRegex RegexAtom c t o u
a₁) Regex c t o u -> Regex c t o u -> Regex c t o u
forall a. Seq a => a -> a -> a
 Regex c t o u
e) (𝐼 (Regex c t o u) -> 𝐼 (Regex c t o u))
-> 𝐼 (Regex c t o u) -> 𝐼 (Regex c t o u)
forall a b. (a -> b) -> a -> b
$ 𝑃 (Regex c t o u) -> 𝐼 (Regex c t o u)
forall a t. ToIter a t => t -> 𝐼 a
iter 𝑃 (Regex c t o u)
es₂
  (SumsR 𝑃 (Regex c t o u)
es₁,AtomR RegexResult o u
r₂ RegexAtom c t o u
a₂)  𝑃 (Regex c t o u) -> RegexU c t o u
forall c t o u. 𝑃 (Regex c t o u) -> RegexU c t o u
SumsR (𝑃 (Regex c t o u) -> RegexU c t o u)
-> 𝑃 (Regex c t o u) -> RegexU c t o u
forall a b. (a -> b) -> a -> b
$ 𝐼 (Regex c t o u) -> 𝑃 (Regex c t o u)
forall s t e. (ToIter e t, Set e s) => t -> s
pow (𝐼 (Regex c t o u) -> 𝑃 (Regex c t o u))
-> 𝐼 (Regex c t o u) -> 𝑃 (Regex c t o u)
forall a b. (a -> b) -> a -> b
$ (Regex c t o u -> Regex c t o u)
-> 𝐼 (Regex c t o u) -> 𝐼 (Regex c t o u)
forall a b. (a -> b) -> 𝐼 a -> 𝐼 b
forall (t :: * -> *) a b. Functor t => (a -> b) -> t a -> t b
map (\ Regex c t o u
e  Regex c t o u
e Regex c t o u -> Regex c t o u -> Regex c t o u
forall a. Seq a => a -> a -> a
 RegexResult o u -> Regex c t o u -> Regex c t o u
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Plus u) =>
RegexResult o u -> Regex c t o u -> Regex c t o u
consEpsRegex RegexResult o u
r₂ (RegexAtom c t o u -> Regex c t o u
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
RegexAtom c t o u -> Regex c t o u
atomRegex RegexAtom c t o u
a₂)) (𝐼 (Regex c t o u) -> 𝐼 (Regex c t o u))
-> 𝐼 (Regex c t o u) -> 𝐼 (Regex c t o u)
forall a b. (a -> b) -> a -> b
$ 𝑃 (Regex c t o u) -> 𝐼 (Regex c t o u)
forall a t. ToIter a t => t -> 𝐼 a
iter 𝑃 (Regex c t o u)
es₁
  (RegexU c t o u, RegexU c t o u)
_  𝐿 (Regex c t o u) -> RegexU c t o u
forall c t o u. 𝐿 (Regex c t o u) -> RegexU c t o u
SeqsR (𝐿 (Regex c t o u) -> RegexU c t o u)
-> 𝐿 (Regex c t o u) -> RegexU c t o u
forall a b. (a -> b) -> a -> b
$ [Regex c t o u] -> 𝐿 (Regex c t o u)
forall a t. ToIter a t => t -> 𝐿 a
list [Regex c t o u
e₁,Regex c t o u
e₂]

starRegex  (Ord c,Ord t,Ord o,Ord u,Zero u)  Regex c t o u  Regex c t o u
starRegex :: forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
Regex c t o u -> Regex c t o u
starRegex e :: Regex c t o u
e@(Regex (𝐴 RegexInfo o u
i RegexU c t o u
e')) = case RegexU c t o u
e' of
  RegexU c t o u
NullR  Regex c t o u
forall u c t o. Zero u => Regex c t o u
nullRegex
  ResR RegexResult o u
r  RegexResult o u -> Regex c t o u
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
RegexResult o u -> Regex c t o u
resRegex RegexResult o u
r
  StarR RegexResult o u
_ Regex c t o u
_  Regex c t o u
e
  RegexU c t o u
_  𝐴 (RegexInfo o u) (RegexU c t o u) -> Regex c t o u
forall c t o u. 𝐴 (RegexInfo o u) (RegexU c t o u) -> Regex c t o u
Regex (𝐴 (RegexInfo o u) (RegexU c t o u) -> Regex c t o u)
-> 𝐴 (RegexInfo o u) (RegexU c t o u) -> Regex c t o u
forall a b. (a -> b) -> a -> b
$ RegexInfo o u
-> RegexU c t o u -> 𝐴 (RegexInfo o u) (RegexU c t o u)
forall e a. e -> a -> 𝐴 e a
𝐴 (RegexInfo o u
forall a. Eps a => a
eps RegexInfo o u -> RegexInfo o u -> RegexInfo o u
forall a. Append a => a -> a -> a
 RegexInfo o u
i) (RegexU c t o u -> 𝐴 (RegexInfo o u) (RegexU c t o u))
-> RegexU c t o u -> 𝐴 (RegexInfo o u) (RegexU c t o u)
forall a b. (a -> b) -> a -> b
$ RegexResult o u -> Regex c t o u -> RegexU c t o u
forall c t o u. RegexResult o u -> Regex c t o u -> RegexU c t o u
StarR RegexResult o u
forall a. Eps a => a
eps Regex c t o u
e

-- Derivative --

derRegex  (Ord c,Ord t,Classified c t,Ord o,Ord u,Additive u)  t  c  Regex c t o u  Regex c t o u
derRegex :: forall c t o u.
(Ord c, Ord t, Classified c t, Ord o, Ord u, Additive u) =>
(t ∨ c) -> Regex c t o u -> Regex c t o u
derRegex t ∨ c
xc Regex c t o u
e₀ = case 𝐴 (RegexInfo o u) (RegexU c t o u) -> RegexU c t o u
forall a. 𝐴 (RegexInfo o u) a -> a
forall (w :: * -> *) a. Extract w => w a -> a
extract (𝐴 (RegexInfo o u) (RegexU c t o u) -> RegexU c t o u)
-> 𝐴 (RegexInfo o u) (RegexU c t o u) -> RegexU c t o u
forall a b. (a -> b) -> a -> b
$ Regex c t o u -> 𝐴 (RegexInfo o u) (RegexU c t o u)
forall c t o u. Regex c t o u -> 𝐴 (RegexInfo o u) (RegexU c t o u)
unRegex Regex c t o u
e₀ of
  RegexU c t o u
NullR  Regex c t o u
forall a. Null a => a
null
  ResR RegexResult o u
_  Regex c t o u
forall a. Null a => a
null
  AtomR RegexResult o u
r RegexAtom c t o u
a  RegexResult o u -> Regex c t o u -> Regex c t o u
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Plus u) =>
RegexResult o u -> Regex c t o u -> Regex c t o u
consEpsRegex RegexResult o u
r (Regex c t o u -> Regex c t o u) -> Regex c t o u -> Regex c t o u
forall a b. (a -> b) -> a -> b
$ (t ∨ c) -> RegexAtom c t o u -> Regex c t o u
forall c t o u.
(Ord c, Ord t, Classified c t, Ord o, Ord u, Additive u) =>
(t ∨ c) -> RegexAtom c t o u -> Regex c t o u
derRegexAtom t ∨ c
xc RegexAtom c t o u
a
  SumsR 𝑃 (Regex c t o u)
es  𝐼 (Regex c t o u) -> Regex c t o u
forall a t. (Monoid a, ToIter a t) => t -> a
concat (𝐼 (Regex c t o u) -> Regex c t o u)
-> 𝐼 (Regex c t o u) -> Regex c t o u
forall a b. (a -> b) -> a -> b
$ (Regex c t o u -> Regex c t o u)
-> 𝐼 (Regex c t o u) -> 𝐼 (Regex c t o u)
forall a b. (a -> b) -> 𝐼 a -> 𝐼 b
forall (t :: * -> *) a b. Functor t => (a -> b) -> t a -> t b
map ((t ∨ c) -> Regex c t o u -> Regex c t o u
forall c t o u.
(Ord c, Ord t, Classified c t, Ord o, Ord u, Additive u) =>
(t ∨ c) -> Regex c t o u -> Regex c t o u
derRegex t ∨ c
xc) (𝐼 (Regex c t o u) -> 𝐼 (Regex c t o u))
-> 𝐼 (Regex c t o u) -> 𝐼 (Regex c t o u)
forall a b. (a -> b) -> a -> b
$ 𝑃 (Regex c t o u) -> 𝐼 (Regex c t o u)
forall a t. ToIter a t => t -> 𝐼 a
iter 𝑃 (Regex c t o u)
es
  SeqsR 𝐿 (Regex c t o u)
es  (t ∨ c) -> 𝐿 (Regex c t o u) -> Regex c t o u
forall t c o u.
(Ord t, Ord c, Classified c t, Ord o, Ord u, Additive u) =>
(t ∨ c) -> 𝐿 (Regex c t o u) -> Regex c t o u
derRegexSequence t ∨ c
xc 𝐿 (Regex c t o u)
es
  StarR RegexResult o u
r Regex c t o u
e  RegexResult o u -> Regex c t o u -> Regex c t o u
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Plus u) =>
RegexResult o u -> Regex c t o u -> Regex c t o u
consEpsRegex RegexResult o u
r ((t ∨ c) -> Regex c t o u -> Regex c t o u
forall c t o u.
(Ord c, Ord t, Classified c t, Ord o, Ord u, Additive u) =>
(t ∨ c) -> Regex c t o u -> Regex c t o u
derRegex t ∨ c
xc Regex c t o u
e) Regex c t o u -> Regex c t o u -> Regex c t o u
forall a. Seq a => a -> a -> a
 Regex c t o u -> Regex c t o u
forall a. Star a => a -> a
star Regex c t o u
e

derRegexAtom  (Ord c,Ord t,Classified c t,Ord o,Ord u,Additive u)  t  c  RegexAtom c t o u  Regex c t o u
derRegexAtom :: forall c t o u.
(Ord c, Ord t, Classified c t, Ord o, Ord u, Additive u) =>
(t ∨ c) -> RegexAtom c t o u -> Regex c t o u
derRegexAtom t ∨ c
xc = \case
  TokRA t
t  case t ∨ c
xc of
    Inl t
t' 
      | t
t t -> t -> Bool
forall a. Eq a => a -> a -> Bool
 t
t'  Regex c t o u
forall a. Eps a => a
eps
      | Bool
otherwise  Regex c t o u
forall a. Null a => a
null
    Inr c
_  Regex c t o u
forall a. Null a => a
null
  NTokRA 𝑃 t
ts  case t ∨ c
xc of
    Inl t
t'
      | Bool -> Bool
not (Bool -> Bool) -> Bool -> Bool
forall a b. (a -> b) -> a -> b
$ t
t' t -> 𝑃 t -> Bool
forall e s. Set e s => e -> s -> Bool
 𝑃 t
ts  Regex c t o u
forall a. Eps a => a
eps
      | Bool
otherwise  Regex c t o u
forall a. Null a => a
null
    Inr c
_  Regex c t o u
forall a. Eps a => a
eps
  ClassRA c
c  case t ∨ c
xc of
    Inl t
t
      | t -> c
forall c t. Classified c t => t -> c
classify t
t c -> c -> Bool
forall a. Eq a => a -> a -> Bool
 c
c  Regex c t o u
forall a. Eps a => a
eps
      | Bool
otherwise  Regex c t o u
forall a. Null a => a
null
    Inr c
c'
      | c
c c -> c -> Bool
forall a. Eq a => a -> a -> Bool
 c
c'  Regex c t o u
forall a. Eps a => a
eps
      | Bool
otherwise  Regex c t o u
forall a. Null a => a
null

derRegexSequence  (Ord t,Ord c,Classified c t,Ord o,Ord u,Additive u)  t  c  𝐿 (Regex c t o u)  Regex c t o u
derRegexSequence :: forall t c o u.
(Ord t, Ord c, Classified c t, Ord o, Ord u, Additive u) =>
(t ∨ c) -> 𝐿 (Regex c t o u) -> Regex c t o u
derRegexSequence t ∨ c
_ 𝐿 (Regex c t o u)
Nil = Regex c t o u
forall a. Null a => a
null
derRegexSequence t ∨ c
xc (e :: Regex c t o u
e@(Regex (𝐴 RegexInfo o u
i RegexU c t o u
_)) :& 𝐿 (Regex c t o u)
es) = case RegexInfo o u -> 𝑂 (RegexResult o u)
forall o u. RegexInfo o u -> 𝑂 (RegexResult o u)
regexInfoResult RegexInfo o u
i of
  𝑂 (RegexResult o u)
None  (t ∨ c) -> Regex c t o u -> Regex c t o u
forall c t o u.
(Ord c, Ord t, Classified c t, Ord o, Ord u, Additive u) =>
(t ∨ c) -> Regex c t o u -> Regex c t o u
derRegex t ∨ c
xc Regex c t o u
e Regex c t o u -> Regex c t o u -> Regex c t o u
forall a. Seq a => a -> a -> a
 𝐿 (Regex c t o u) -> Regex c t o u
forall a t. (Seqoid a, ToIter a t) => t -> a
sequence 𝐿 (Regex c t o u)
es
  Some RegexResult o u
r  [Regex c t o u] -> Regex c t o u
forall a t. (Monoid a, ToIter a t) => t -> a
concat
    [ (t ∨ c) -> Regex c t o u -> Regex c t o u
forall c t o u.
(Ord c, Ord t, Classified c t, Ord o, Ord u, Additive u) =>
(t ∨ c) -> Regex c t o u -> Regex c t o u
derRegex t ∨ c
xc Regex c t o u
e Regex c t o u -> Regex c t o u -> Regex c t o u
forall a. Seq a => a -> a -> a
 𝐿 (Regex c t o u) -> Regex c t o u
forall a t. (Seqoid a, ToIter a t) => t -> a
sequence 𝐿 (Regex c t o u)
es
    , RegexResult o u -> Regex c t o u
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
RegexResult o u -> Regex c t o u
resRegex RegexResult o u
r Regex c t o u -> Regex c t o u -> Regex c t o u
forall a. Seq a => a -> a -> a
 (t ∨ c) -> 𝐿 (Regex c t o u) -> Regex c t o u
forall t c o u.
(Ord t, Ord c, Classified c t, Ord o, Ord u, Additive u) =>
(t ∨ c) -> 𝐿 (Regex c t o u) -> Regex c t o u
derRegexSequence t ∨ c
xc 𝐿 (Regex c t o u)
es
    ]

-- Literals --
  
regexLits  (Ord t)  Regex c t o u  𝑃 t
regexLits :: forall t c o u. Ord t => Regex c t o u -> 𝑃 t
regexLits Regex c t o u
e₀ = case 𝐴 (RegexInfo o u) (RegexU c t o u) -> RegexU c t o u
forall a. 𝐴 (RegexInfo o u) a -> a
forall (w :: * -> *) a. Extract w => w a -> a
extract (𝐴 (RegexInfo o u) (RegexU c t o u) -> RegexU c t o u)
-> 𝐴 (RegexInfo o u) (RegexU c t o u) -> RegexU c t o u
forall a b. (a -> b) -> a -> b
$ Regex c t o u -> 𝐴 (RegexInfo o u) (RegexU c t o u)
forall c t o u. Regex c t o u -> 𝐴 (RegexInfo o u) (RegexU c t o u)
unRegex Regex c t o u
e₀ of
  RegexU c t o u
NullR  𝑃 t
forall e s. Set e s => s

  ResR RegexResult o u
_  𝑃 t
forall e s. Set e s => s

  AtomR RegexResult o u
_ RegexAtom c t o u
a  RegexAtom c t o u -> 𝑃 t
forall {k} {k} t c (o :: k) (u :: k).
Ord t =>
RegexAtom c t o u -> 𝑃 t
regexLitsAtom RegexAtom c t o u
a
  SumsR 𝑃 (Regex c t o u)
es  𝐼 (𝑃 t) -> 𝑃 t
forall a t. (JoinLattice a, ToIter a t) => t -> a
joins (𝐼 (𝑃 t) -> 𝑃 t) -> 𝐼 (𝑃 t) -> 𝑃 t
forall a b. (a -> b) -> a -> b
$ (Regex c t o u -> 𝑃 t) -> 𝐼 (Regex c t o u) -> 𝐼 (𝑃 t)
forall a b. (a -> b) -> 𝐼 a -> 𝐼 b
forall (t :: * -> *) a b. Functor t => (a -> b) -> t a -> t b
map Regex c t o u -> 𝑃 t
forall t c o u. Ord t => Regex c t o u -> 𝑃 t
regexLits (𝐼 (Regex c t o u) -> 𝐼 (𝑃 t)) -> 𝐼 (Regex c t o u) -> 𝐼 (𝑃 t)
forall a b. (a -> b) -> a -> b
$ 𝑃 (Regex c t o u) -> 𝐼 (Regex c t o u)
forall a t. ToIter a t => t -> 𝐼 a
iter 𝑃 (Regex c t o u)
es
  SeqsR 𝐿 (Regex c t o u)
es  𝐼 (𝑃 t) -> 𝑃 t
forall a t. (JoinLattice a, ToIter a t) => t -> a
joins (𝐼 (𝑃 t) -> 𝑃 t) -> 𝐼 (𝑃 t) -> 𝑃 t
forall a b. (a -> b) -> a -> b
$ (Regex c t o u -> 𝑃 t) -> 𝐼 (Regex c t o u) -> 𝐼 (𝑃 t)
forall a b. (a -> b) -> 𝐼 a -> 𝐼 b
forall (t :: * -> *) a b. Functor t => (a -> b) -> t a -> t b
map Regex c t o u -> 𝑃 t
forall t c o u. Ord t => Regex c t o u -> 𝑃 t
regexLits (𝐼 (Regex c t o u) -> 𝐼 (𝑃 t)) -> 𝐼 (Regex c t o u) -> 𝐼 (𝑃 t)
forall a b. (a -> b) -> a -> b
$ 𝐿 (Regex c t o u) -> 𝐼 (Regex c t o u)
forall a t. ToIter a t => t -> 𝐼 a
iter 𝐿 (Regex c t o u)
es
  StarR RegexResult o u
_ Regex c t o u
e  Regex c t o u -> 𝑃 t
forall t c o u. Ord t => Regex c t o u -> 𝑃 t
regexLits Regex c t o u
e

regexLitsAtom  (Ord t)  RegexAtom c t o u  𝑃 t
regexLitsAtom :: forall {k} {k} t c (o :: k) (u :: k).
Ord t =>
RegexAtom c t o u -> 𝑃 t
regexLitsAtom = \case
  TokRA t
t  t -> 𝑃 t
forall a t. Single a t => a -> t
single t
t
  NTokRA 𝑃 t
ts  𝑃 t
ts
  ClassRA c
_  𝑃 t
forall e s. Set e s => s


----------------------
-- DFA Construction --
----------------------

data RegexState c t o u = RegexState
  { forall c t o u. RegexState c t o u -> ℕ64
regexStateNextID  ℕ64
  , forall c t o u. RegexState c t o u -> Regex c t o u ⇰ ℕ64
regexStateMap  Regex c t o u  ℕ64
  , forall c t o u. RegexState c t o u -> (t ∨ c) ⇰ (ℕ64 ⇰ ℕ64)
regexStateTransitions  (t  c)  (ℕ64  ℕ64)
  , forall c t o u. RegexState c t o u -> ℕ64 ⇰ 𝑂 (RegexResult o u)
regexStateResults  ℕ64  𝑂 (RegexResult o u)
  , forall c t o u. RegexState c t o u -> ℕ64 ⇰ Bool
regexStateDead  ℕ64  𝔹
  }
makeLenses ''RegexState

regexState₀  RegexState c t o u
regexState₀ :: forall c t o u. RegexState c t o u
regexState₀ = ℕ64
-> (Regex c t o u ⇰ ℕ64)
-> ((t ∨ c) ⇰ (ℕ64 ⇰ ℕ64))
-> (ℕ64 ⇰ 𝑂 (RegexResult o u))
-> (ℕ64 ⇰ Bool)
-> RegexState c t o u
forall c t o u.
ℕ64
-> (Regex c t o u ⇰ ℕ64)
-> ((t ∨ c) ⇰ (ℕ64 ⇰ ℕ64))
-> (ℕ64 ⇰ 𝑂 (RegexResult o u))
-> (ℕ64 ⇰ Bool)
-> RegexState c t o u
RegexState ℕ64
forall a. Zero a => a
zero Regex c t o u ⇰ ℕ64
forall k a. k ⇰ a
dø𝐷 (t ∨ c) ⇰ (ℕ64 ⇰ ℕ64)
forall k a. k ⇰ a
dø𝐷 ℕ64 ⇰ 𝑂 (RegexResult o u)
forall k a. k ⇰ a
dø𝐷 ℕ64 ⇰ Bool
forall k a. k ⇰ a
dø𝐷

data DFA c t o u = DFA
  { forall c t o u. DFA c t o u -> 𝑃 t
dfaLits  𝑃 t
  , forall c t o u. DFA c t o u -> ℕ64
dfaStart  ℕ64
  , forall c t o u. DFA c t o u -> (t ∨ c) ⇰ 𝕍 ℕ64
dfaTransitions  (t  c)  𝕍 ℕ64
  , forall c t o u. DFA c t o u -> 𝕍 (𝑂 (RegexResult o u))
dfaSuccess  𝕍 (𝑂 (RegexResult o u))
  , forall c t o u. DFA c t o u -> 𝕍 Bool
dfaDead  𝕍 𝔹
  }
makePrettySum ''DFA

compileRegex   c t o u. (Pretty t,Pretty o,Pretty u,Ord c,Ord t,Classified c t,All c,Ord o,Ord u,Additive u)  Regex c t o u  DFA c t o u
compileRegex :: forall c t o u.
(Pretty t, Pretty o, Pretty u, Ord c, Ord t, Classified c t, All c,
 Ord o, Ord u, Additive u) =>
Regex c t o u -> DFA c t o u
compileRegex Regex c t o u
e₀ =
  let RegexState ℕ64
_ Regex c t o u ⇰ ℕ64
_ (t ∨ c) ⇰ (ℕ64 ⇰ ℕ64)
tr ℕ64 ⇰ 𝑂 (RegexResult o u)
re ℕ64 ⇰ Bool
de :* ℕ64
n = RegexState c t o u
-> State (RegexState c t o u) ℕ64 -> RegexState c t o u ∧ ℕ64
forall s a. s -> State s a -> s ∧ a
runState RegexState c t o u
forall c t o u. RegexState c t o u
regexState₀ (State (RegexState c t o u) ℕ64 -> RegexState c t o u ∧ ℕ64)
-> State (RegexState c t o u) ℕ64 -> RegexState c t o u ∧ ℕ64
forall a b. (a -> b) -> a -> b
$ Regex c t o u -> State (RegexState c t o u) ℕ64
compile Regex c t o u
e₀
  in 𝑃 t
-> ℕ64
-> ((t ∨ c) ⇰ 𝕍 ℕ64)
-> 𝕍 (𝑂 (RegexResult o u))
-> 𝕍 Bool
-> DFA c t o u
forall c t o u.
𝑃 t
-> ℕ64
-> ((t ∨ c) ⇰ 𝕍 ℕ64)
-> 𝕍 (𝑂 (RegexResult o u))
-> 𝕍 Bool
-> DFA c t o u
DFA 𝑃 t
lits ℕ64
n (((ℕ64 ⇰ ℕ64) -> 𝕍 ℕ64)
-> ((t ∨ c) ⇰ (ℕ64 ⇰ ℕ64)) -> (t ∨ c) ⇰ 𝕍 ℕ64
forall a b. (a -> b) -> ((t ∨ c) ⇰ a) -> (t ∨ c) ⇰ b
forall (t :: * -> *) a b. Functor t => (a -> b) -> t a -> t b
map (ℕ64 ⇰ ℕ64) -> 𝕍 ℕ64
forall a. (ℕ64 ⇰ a) -> 𝕍 a
vecDΩ (t ∨ c) ⇰ (ℕ64 ⇰ ℕ64)
tr) ((ℕ64 ⇰ 𝑂 (RegexResult o u)) -> 𝕍 (𝑂 (RegexResult o u))
forall a. (ℕ64 ⇰ a) -> 𝕍 a
vecDΩ ℕ64 ⇰ 𝑂 (RegexResult o u)
re) (𝕍 Bool -> DFA c t o u) -> 𝕍 Bool -> DFA c t o u
forall a b. (a -> b) -> a -> b
$ (ℕ64 ⇰ Bool) -> 𝕍 Bool
forall a. (ℕ64 ⇰ a) -> 𝕍 a
vecDΩ ℕ64 ⇰ Bool
de
  where 
    lits  𝑃 t
    lits :: 𝑃 t
lits = Regex c t o u -> 𝑃 t
forall t c o u. Ord t => Regex c t o u -> 𝑃 t
regexLits Regex c t o u
e₀
    codes  𝑃 (t  c)
    codes :: 𝑃 (t ∨ c)
codes = 𝐼 (t ∨ c) -> 𝑃 (t ∨ c)
forall s t e. (ToIter e t, Set e s) => t -> s
pow (𝐼 (t ∨ c) -> 𝑃 (t ∨ c)) -> 𝐼 (t ∨ c) -> 𝑃 (t ∨ c)
forall a b. (a -> b) -> a -> b
$ (t -> t ∨ c) -> 𝐼 t -> 𝐼 (t ∨ c)
forall a b. (a -> b) -> 𝐼 a -> 𝐼 b
forall (t :: * -> *) a b. Functor t => (a -> b) -> t a -> t b
map t -> t ∨ c
forall a b. a -> a ∨ b
Inl (𝑃 t -> 𝐼 t
forall a t. ToIter a t => t -> 𝐼 a
iter 𝑃 t
lits) 𝐼 (t ∨ c) -> 𝐼 (t ∨ c) -> 𝐼 (t ∨ c)
forall a. Append a => a -> a -> a
 (c -> t ∨ c) -> 𝐼 c -> 𝐼 (t ∨ c)
forall a b. (a -> b) -> 𝐼 a -> 𝐼 b
forall (t :: * -> *) a b. Functor t => (a -> b) -> t a -> t b
map c -> t ∨ c
forall a b. b -> a ∨ b
Inr 𝐼 c
forall a. All a => 𝐼 a
all
    compile  Regex c t o u  State (RegexState c t o u) ℕ64
    compile :: Regex c t o u -> State (RegexState c t o u) ℕ64
compile Regex c t o u
e = do
      Regex c t o u ⇰ ℕ64
m  (RegexState c t o u ⟢ (Regex c t o u ⇰ ℕ64))
-> StateT (RegexState c t o u) ID (Regex c t o u ⇰ ℕ64)
forall (m :: * -> *) s a.
(Monad m, MonadState s m) =>
(s ⟢ a) -> m a
getL RegexState c t o u ⟢ (Regex c t o u ⇰ ℕ64)
forall c t o u. RegexState c t o u ⟢ (Regex c t o u ⇰ ℕ64)
regexStateMapL
      case Regex c t o u ⇰ ℕ64
m (Regex c t o u ⇰ ℕ64) -> Regex c t o u -> 𝑂 ℕ64
forall k v t. Lookup k v t => t -> k -> 𝑂 v
⋕? Regex c t o u
e of
        Some ℕ64
n  ℕ64 -> State (RegexState c t o u) ℕ64
forall a. a -> StateT (RegexState c t o u) ID a
forall (m :: * -> *) a. Return m => a -> m a
return ℕ64
n
        𝑂 ℕ64
None  do
          ℕ64
n  Regex c t o u -> State (RegexState c t o u) ℕ64
newRegexEntry Regex c t o u
e
          (RegexState c t o u ⟢ (ℕ64 ⇰ 𝑂 (RegexResult o u)))
-> ((ℕ64 ⇰ 𝑂 (RegexResult o u)) -> ℕ64 ⇰ 𝑂 (RegexResult o u))
-> StateT (RegexState c t o u) ID ()
forall (m :: * -> *) s a.
(Monad m, MonadState s m) =>
(s ⟢ a) -> (a -> a) -> m ()
modifyL RegexState c t o u ⟢ (ℕ64 ⇰ 𝑂 (RegexResult o u))
forall c t o u. RegexState c t o u ⟢ (ℕ64 ⇰ 𝑂 (RegexResult o u))
regexStateResultsL (((ℕ64 ⇰ 𝑂 (RegexResult o u)) -> ℕ64 ⇰ 𝑂 (RegexResult o u))
 -> StateT (RegexState c t o u) ID ())
-> ((ℕ64 ⇰ 𝑂 (RegexResult o u)) -> ℕ64 ⇰ 𝑂 (RegexResult o u))
-> StateT (RegexState c t o u) ID ()
forall a b. (a -> b) -> a -> b
$ (ℕ64 ⇰ 𝑂 (RegexResult o u))
-> (ℕ64 ⇰ 𝑂 (RegexResult o u)) -> ℕ64 ⇰ 𝑂 (RegexResult o u)
forall a. (ℕ64 ⇰ a) -> (ℕ64 ⇰ a) -> ℕ64 ⇰ a
forall k s (d :: * -> *) a. Dict k s d => d a -> d a -> d a
(⩌) ((ℕ64 ⇰ 𝑂 (RegexResult o u))
 -> (ℕ64 ⇰ 𝑂 (RegexResult o u)) -> ℕ64 ⇰ 𝑂 (RegexResult o u))
-> (ℕ64 ⇰ 𝑂 (RegexResult o u))
-> (ℕ64 ⇰ 𝑂 (RegexResult o u))
-> ℕ64 ⇰ 𝑂 (RegexResult o u)
forall a b. (a -> b) -> a -> b
$ ℕ64
n ℕ64 -> 𝑂 (RegexResult o u) -> ℕ64 ⇰ 𝑂 (RegexResult o u)
forall a. ℕ64 -> a -> ℕ64 ⇰ a
forall k s (d :: * -> *) a. Dict k s d => k -> a -> d a
 RegexInfo o u -> 𝑂 (RegexResult o u)
forall o u. RegexInfo o u -> 𝑂 (RegexResult o u)
regexInfoResult (𝐴 (RegexInfo o u) (RegexU c t o u) -> RegexInfo o u
forall e a. 𝐴 e a -> e
atag (𝐴 (RegexInfo o u) (RegexU c t o u) -> RegexInfo o u)
-> 𝐴 (RegexInfo o u) (RegexU c t o u) -> RegexInfo o u
forall a b. (a -> b) -> a -> b
$ Regex c t o u -> 𝐴 (RegexInfo o u) (RegexU c t o u)
forall c t o u. Regex c t o u -> 𝐴 (RegexInfo o u) (RegexU c t o u)
unRegex Regex c t o u
e)
          (RegexState c t o u ⟢ (ℕ64 ⇰ Bool))
-> ((ℕ64 ⇰ Bool) -> ℕ64 ⇰ Bool)
-> StateT (RegexState c t o u) ID ()
forall (m :: * -> *) s a.
(Monad m, MonadState s m) =>
(s ⟢ a) -> (a -> a) -> m ()
modifyL RegexState c t o u ⟢ (ℕ64 ⇰ Bool)
forall c t o u. RegexState c t o u ⟢ (ℕ64 ⇰ Bool)
regexStateDeadL (((ℕ64 ⇰ Bool) -> ℕ64 ⇰ Bool) -> StateT (RegexState c t o u) ID ())
-> ((ℕ64 ⇰ Bool) -> ℕ64 ⇰ Bool)
-> StateT (RegexState c t o u) ID ()
forall a b. (a -> b) -> a -> b
$ (ℕ64 ⇰ Bool) -> (ℕ64 ⇰ Bool) -> ℕ64 ⇰ Bool
forall a. (ℕ64 ⇰ a) -> (ℕ64 ⇰ a) -> ℕ64 ⇰ a
forall k s (d :: * -> *) a. Dict k s d => d a -> d a -> d a
(⩌) ((ℕ64 ⇰ Bool) -> (ℕ64 ⇰ Bool) -> ℕ64 ⇰ Bool)
-> (ℕ64 ⇰ Bool) -> (ℕ64 ⇰ Bool) -> ℕ64 ⇰ Bool
forall a b. (a -> b) -> a -> b
$ ℕ64
n ℕ64 -> Bool -> ℕ64 ⇰ Bool
forall a. ℕ64 -> a -> ℕ64 ⇰ a
forall k s (d :: * -> *) a. Dict k s d => k -> a -> d a
 (𝐴 (RegexInfo o u) (RegexU c t o u) -> RegexU c t o u
forall a. 𝐴 (RegexInfo o u) a -> a
forall (w :: * -> *) a. Extract w => w a -> a
extract (Regex c t o u -> 𝐴 (RegexInfo o u) (RegexU c t o u)
forall c t o u. Regex c t o u -> 𝐴 (RegexInfo o u) (RegexU c t o u)
unRegex Regex c t o u
e) RegexU c t o u -> RegexU c t o u -> Bool
forall a. Eq a => a -> a -> Bool
 RegexU c t o u
forall c t o u. RegexU c t o u
NullR)
          𝑃 (t ∨ c)
-> ((t ∨ c) -> StateT (RegexState c t o u) ID ())
-> StateT (RegexState c t o u) ID ()
forall (m :: * -> *) a t.
(Monad m, ToIter a t) =>
t -> (a -> m ()) -> m ()
eachOn 𝑃 (t ∨ c)
codes (((t ∨ c) -> StateT (RegexState c t o u) ID ())
 -> StateT (RegexState c t o u) ID ())
-> ((t ∨ c) -> StateT (RegexState c t o u) ID ())
-> StateT (RegexState c t o u) ID ()
forall a b. (a -> b) -> a -> b
$ \ t ∨ c
xc  do
            ℕ64
n'  Regex c t o u -> State (RegexState c t o u) ℕ64
compile (Regex c t o u -> State (RegexState c t o u) ℕ64)
-> Regex c t o u -> State (RegexState c t o u) ℕ64
forall a b. (a -> b) -> a -> b
$ (t ∨ c) -> Regex c t o u -> Regex c t o u
forall c t o u.
(Ord c, Ord t, Classified c t, Ord o, Ord u, Additive u) =>
(t ∨ c) -> Regex c t o u -> Regex c t o u
derRegex t ∨ c
xc Regex c t o u
e
            (RegexState c t o u ⟢ ((t ∨ c) ⇰ (ℕ64 ⇰ ℕ64)))
-> (((t ∨ c) ⇰ (ℕ64 ⇰ ℕ64)) -> (t ∨ c) ⇰ (ℕ64 ⇰ ℕ64))
-> StateT (RegexState c t o u) ID ()
forall (m :: * -> *) s a.
(Monad m, MonadState s m) =>
(s ⟢ a) -> (a -> a) -> m ()
modifyL RegexState c t o u ⟢ ((t ∨ c) ⇰ (ℕ64 ⇰ ℕ64))
forall c t o u. RegexState c t o u ⟢ ((t ∨ c) ⇰ (ℕ64 ⇰ ℕ64))
regexStateTransitionsL ((((t ∨ c) ⇰ (ℕ64 ⇰ ℕ64)) -> (t ∨ c) ⇰ (ℕ64 ⇰ ℕ64))
 -> StateT (RegexState c t o u) ID ())
-> (((t ∨ c) ⇰ (ℕ64 ⇰ ℕ64)) -> (t ∨ c) ⇰ (ℕ64 ⇰ ℕ64))
-> StateT (RegexState c t o u) ID ()
forall a b. (a -> b) -> a -> b
$ ((ℕ64 ⇰ ℕ64) -> (ℕ64 ⇰ ℕ64) -> ℕ64 ⇰ ℕ64)
-> ((t ∨ c) ⇰ (ℕ64 ⇰ ℕ64))
-> ((t ∨ c) ⇰ (ℕ64 ⇰ ℕ64))
-> (t ∨ c) ⇰ (ℕ64 ⇰ ℕ64)
forall a.
(a -> a -> a) -> ((t ∨ c) ⇰ a) -> ((t ∨ c) ⇰ a) -> (t ∨ c) ⇰ a
forall k s (d :: * -> *) a.
Dict k s d =>
(a -> a -> a) -> d a -> d a -> d a
dunionBy (ℕ64 ⇰ ℕ64) -> (ℕ64 ⇰ ℕ64) -> ℕ64 ⇰ ℕ64
forall a. (ℕ64 ⇰ a) -> (ℕ64 ⇰ a) -> ℕ64 ⇰ a
forall k s (d :: * -> *) a. Dict k s d => d a -> d a -> d a
(⩌) (((t ∨ c) ⇰ (ℕ64 ⇰ ℕ64))
 -> ((t ∨ c) ⇰ (ℕ64 ⇰ ℕ64)) -> (t ∨ c) ⇰ (ℕ64 ⇰ ℕ64))
-> ((t ∨ c) ⇰ (ℕ64 ⇰ ℕ64))
-> ((t ∨ c) ⇰ (ℕ64 ⇰ ℕ64))
-> (t ∨ c) ⇰ (ℕ64 ⇰ ℕ64)
forall a b. (a -> b) -> a -> b
$ t ∨ c
xc (t ∨ c) -> (ℕ64 ⇰ ℕ64) -> (t ∨ c) ⇰ (ℕ64 ⇰ ℕ64)
forall a. (t ∨ c) -> a -> (t ∨ c) ⇰ a
forall k s (d :: * -> *) a. Dict k s d => k -> a -> d a
 (ℕ64
n ℕ64 -> ℕ64 -> ℕ64 ⇰ ℕ64
forall a. ℕ64 -> a -> ℕ64 ⇰ a
forall k s (d :: * -> *) a. Dict k s d => k -> a -> d a
 ℕ64
n')
          ℕ64 -> State (RegexState c t o u) ℕ64
forall a. a -> StateT (RegexState c t o u) ID a
forall (m :: * -> *) a. Return m => a -> m a
return ℕ64
n
    newRegexEntry  Regex c t o u  State (RegexState c t o u) ℕ64
    newRegexEntry :: Regex c t o u -> State (RegexState c t o u) ℕ64
newRegexEntry Regex c t o u
e = do
      ℕ64
n  (RegexState c t o u ⟢ ℕ64) -> State (RegexState c t o u) ℕ64
forall (m :: * -> *) s a.
(Monad m, MonadState s m) =>
(s ⟢ a) -> m a
getL RegexState c t o u ⟢ ℕ64
forall c t o u. RegexState c t o u ⟢ ℕ64
regexStateNextIDL
      (RegexState c t o u ⟢ ℕ64)
-> ℕ64 -> StateT (RegexState c t o u) ID ()
forall (m :: * -> *) s a.
(Monad m, MonadState s m) =>
(s ⟢ a) -> a -> m ()
putL RegexState c t o u ⟢ ℕ64
forall c t o u. RegexState c t o u ⟢ ℕ64
regexStateNextIDL (ℕ64 -> StateT (RegexState c t o u) ID ())
-> ℕ64 -> StateT (RegexState c t o u) ID ()
forall a b. (a -> b) -> a -> b
$ ℕ64
n ℕ64 -> ℕ64 -> ℕ64
forall a. Plus a => a -> a -> a
+ ℕ64
forall a. One a => a
one
      (RegexState c t o u ⟢ (Regex c t o u ⇰ ℕ64))
-> ((Regex c t o u ⇰ ℕ64) -> Regex c t o u ⇰ ℕ64)
-> StateT (RegexState c t o u) ID ()
forall (m :: * -> *) s a.
(Monad m, MonadState s m) =>
(s ⟢ a) -> (a -> a) -> m ()
modifyL RegexState c t o u ⟢ (Regex c t o u ⇰ ℕ64)
forall c t o u. RegexState c t o u ⟢ (Regex c t o u ⇰ ℕ64)
regexStateMapL (((Regex c t o u ⇰ ℕ64) -> Regex c t o u ⇰ ℕ64)
 -> StateT (RegexState c t o u) ID ())
-> ((Regex c t o u ⇰ ℕ64) -> Regex c t o u ⇰ ℕ64)
-> StateT (RegexState c t o u) ID ()
forall a b. (a -> b) -> a -> b
$ (Regex c t o u ⇰ ℕ64)
-> (Regex c t o u ⇰ ℕ64) -> Regex c t o u ⇰ ℕ64
forall a.
(Regex c t o u ⇰ a) -> (Regex c t o u ⇰ a) -> Regex c t o u ⇰ a
forall k s (d :: * -> *) a. Dict k s d => d a -> d a -> d a
(⩌) ((Regex c t o u ⇰ ℕ64)
 -> (Regex c t o u ⇰ ℕ64) -> Regex c t o u ⇰ ℕ64)
-> (Regex c t o u ⇰ ℕ64)
-> (Regex c t o u ⇰ ℕ64)
-> Regex c t o u ⇰ ℕ64
forall a b. (a -> b) -> a -> b
$ Regex c t o u
e Regex c t o u -> ℕ64 -> Regex c t o u ⇰ ℕ64
forall a. Regex c t o u -> a -> Regex c t o u ⇰ a
forall k s (d :: * -> *) a. Dict k s d => k -> a -> d a
 ℕ64
n
      ℕ64 -> State (RegexState c t o u) ℕ64
forall a. a -> StateT (RegexState c t o u) ID a
forall (m :: * -> *) a. Return m => a -> m a
return ℕ64
n

data LexDFAState t = LexDFAState
  { forall t. LexDFAState t -> WindowR Doc Doc
lexDFAStatePrefix  WindowR Doc Doc
  , forall t. LexDFAState t -> ParserContext
lexDFAStateContext  ParserContext
  , forall t. LexDFAState t -> 𝑆 (ParserToken t)
lexDFAStateInput  𝑆 (ParserToken t)
  , forall t. LexDFAState t -> 𝐼C t
lexDFAStateTokens  𝐼C t
  }
makePrettySum ''LexDFAState

data Lexer c t o u w = Lexer
  { forall c t o u w. Lexer c t o u w -> u -> DFA c t o u
lexerDFA  u  DFA c t o u
  , forall c t o u w. Lexer c t o u w -> 𝐼C t -> 𝑂 o -> Bool ∧ w
lexerMkToken  𝐼C t  𝑂 o  𝔹  w
  , forall c t o u w. Lexer c t o u w -> u
lexerInitState  u
  }

tokenize  
   c t o u w. (Show u,Ord c,Ord t,Pretty t,Classified c t,Eq o,Eq u,Plus u) 
   Lexer c t o u w  𝕊  𝕍 (ParserToken t)  Doc  𝕍 (PreParserToken w)
tokenize :: forall c t o u w.
(Show u, Ord c, Ord t, Pretty t, Classified c t, Eq o, Eq u,
 Plus u) =>
Lexer c t o u w
-> 𝕊 -> 𝕍 (ParserToken t) -> Doc ∨ 𝕍 (PreParserToken w)
tokenize (Lexer u -> DFA c t o u
dfas 𝐼C t -> 𝑂 o -> Bool ∧ w
f u
u₀) 𝕊
so 𝕍 (ParserToken t)
ts₀ = 𝐼C (PreParserToken w) -> 𝕍 (PreParserToken w)
forall a t. ToIterC a t => t -> 𝕍 a
vecC (𝐼C (PreParserToken w) -> 𝕍 (PreParserToken w))
-> (Doc ∨ 𝐼C (PreParserToken w)) -> Doc ∨ 𝕍 (PreParserToken w)
forall (t :: * -> *) a b. Functor t => (a -> b) -> t a -> t b
^$ u
-> DFA c t o u
-> WindowR Doc Doc
-> 𝑆 (ParserToken t)
-> Doc ∨ 𝐼C (PreParserToken w)
oloop u
u₀ (u -> DFA c t o u
dfas u
u₀) WindowR Doc Doc
forall a. Null a => a
null (𝑆 (ParserToken t) -> Doc ∨ 𝐼C (PreParserToken w))
-> 𝑆 (ParserToken t) -> Doc ∨ 𝐼C (PreParserToken w)
forall a b. (a -> b) -> a -> b
$ 𝕍 (ParserToken t) -> 𝑆 (ParserToken t)
forall a t. ToIter a t => t -> 𝑆 a
stream 𝕍 (ParserToken t)
ts₀
  where
  oloop  u  DFA c t o u  WindowR Doc Doc  𝑆 (ParserToken t)  Doc  𝐼C (PreParserToken w)
  oloop :: u
-> DFA c t o u
-> WindowR Doc Doc
-> 𝑆 (ParserToken t)
-> Doc ∨ 𝐼C (PreParserToken w)
oloop u
u (DFA 𝑃 t
lits ℕ64
n₀ (t ∨ c) ⇰ 𝕍 ℕ64
δt 𝕍 (𝑂 (RegexResult o u))
δs 𝕍 Bool
δd) WindowR Doc Doc
pp₀ 𝑆 (ParserToken t)
pi₀' = ℕ64
-> LexDFAState t
-> 𝑂 (ParserToken t ∧ LexDFAState t)
-> 𝑂 (RegexResult o u ∧ LexDFAState t)
-> Doc ∨ 𝐼C (PreParserToken w)
iloop ℕ64
n₀ (WindowR Doc Doc
-> ParserContext -> 𝑆 (ParserToken t) -> 𝐼C t -> LexDFAState t
forall t.
WindowR Doc Doc
-> ParserContext -> 𝑆 (ParserToken t) -> 𝐼C t -> LexDFAState t
LexDFAState WindowR Doc Doc
pp₀ ParserContext
forall a. Null a => a
null 𝑆 (ParserToken t)
pi₀' 𝐼C t
forall a. Null a => a
null) 𝑂 (ParserToken t ∧ LexDFAState t)
forall a. 𝑂 a
None 𝑂 (RegexResult o u ∧ LexDFAState t)
forall a. 𝑂 a
None
    where
      success  RegexResult o u  LexDFAState t  Doc  𝐼C (PreParserToken w)
      success :: RegexResult o u -> LexDFAState t -> Doc ∨ 𝐼C (PreParserToken w)
success (RegexResult ℕ64
_ Formats
fm 𝑂 o
oO u
u') (LexDFAState WindowR Doc Doc
pp ParserContext
pc 𝑆 (ParserToken t)
pi 𝐼C t
ts) = do
        let u'' :: u
u'' = u
u u -> u -> u
forall a. Plus a => a -> a -> a
+ u
u'
            pc' :: ParserContext
pc' = Formats -> ParserContext -> ParserContext
formatParserContext Formats
fm ParserContext
pc
        𝐼C (PreParserToken w)
wts  u
-> DFA c t o u
-> WindowR Doc Doc
-> 𝑆 (ParserToken t)
-> Doc ∨ 𝐼C (PreParserToken w)
oloop u
u'' (u -> DFA c t o u
dfas u
u'') (WindowR Doc Doc
pp WindowR Doc Doc -> WindowR Doc Doc -> WindowR Doc Doc
forall a. Append a => a -> a -> a
 ParserContext -> WindowR Doc Doc
parserContextDisplayR ParserContext
pc') 𝑆 (ParserToken t)
pi
        let Bool
sk :* w
w = 𝐼C t -> 𝑂 o -> Bool ∧ w
f 𝐼C t
ts 𝑂 o
oO
            wt :: PreParserToken w
wt = w -> Bool -> ParserContext -> PreParserToken w
forall t. t -> Bool -> ParserContext -> PreParserToken t
PreParserToken w
w Bool
sk ParserContext
pc'
        𝐼C (PreParserToken w) -> Doc ∨ 𝐼C (PreParserToken w)
forall a. a -> Doc ∨ a
forall (m :: * -> *) a. Return m => a -> m a
return (𝐼C (PreParserToken w) -> Doc ∨ 𝐼C (PreParserToken w))
-> 𝐼C (PreParserToken w) -> Doc ∨ 𝐼C (PreParserToken w)
forall a b. (a -> b) -> a -> b
$ (PreParserToken w -> 𝐼C (PreParserToken w)
forall a t. Single a t => a -> t
single PreParserToken w
wt 𝐼C (PreParserToken w)
-> 𝐼C (PreParserToken w) -> 𝐼C (PreParserToken w)
forall a. Append a => a -> a -> a
 𝐼C (PreParserToken w)
wts)
      failure  LexDFAState t  ParserToken t  Doc
      failure :: LexDFAState t -> ParserToken t -> Doc
failure (LexDFAState WindowR Doc Doc
pp ParserContext
pc 𝑆 (ParserToken t)
_ 𝐼C t
_) (ParserToken t
_ Bool
_ ParserContext
tc WindowL Doc Doc
s) =
        let le :: AddBT Loc
le = LocRange -> AddBT Loc
locRangeEnd (LocRange -> AddBT Loc) -> LocRange -> AddBT Loc
forall a b. (a -> b) -> a -> b
$ ParserContext -> LocRange
parserContextLocRange ParserContext
tc
            d :: WindowR Doc Doc
d = ParserContext -> WindowR Doc Doc
parserContextError ParserContext
tc
        in 𝕊 -> AddNull (ParserError Any) -> Doc
forall {k} (t :: k). 𝕊 -> AddNull (ParserError t) -> Doc
displaySourceError 𝕊
so (AddNull (ParserError Any) -> Doc)
-> AddNull (ParserError Any) -> Doc
forall a b. (a -> b) -> a -> b
$ ParserError Any -> AddNull (ParserError Any)
forall a. a -> AddNull a
AddNull (ParserError Any -> AddNull (ParserError Any))
-> ParserError Any -> AddNull (ParserError Any)
forall a b. (a -> b) -> a -> b
$ AddBT Loc
-> WindowR Doc Doc
-> WindowL Doc Doc
-> 𝐼 ParserErrorInfo
-> ParserError Any
forall {k} (t :: k).
AddBT Loc
-> WindowR Doc Doc
-> WindowL Doc Doc
-> 𝐼 ParserErrorInfo
-> ParserError t
ParserError AddBT Loc
le WindowR Doc Doc
d WindowL Doc Doc
s (𝐼 ParserErrorInfo -> ParserError Any)
-> 𝐼 ParserErrorInfo -> ParserError Any
forall a b. (a -> b) -> a -> b
$ ParserErrorInfo -> 𝐼 ParserErrorInfo
forall a t. Single a t => a -> t
single (ParserErrorInfo -> 𝐼 ParserErrorInfo)
-> ParserErrorInfo -> 𝐼 ParserErrorInfo
forall a b. (a -> b) -> a -> b
$ WindowR Doc Doc -> WindowR Doc Doc -> 𝕊 -> 𝐼 𝕊 -> ParserErrorInfo
ParserErrorInfo WindowR Doc Doc
pp (ParserContext -> WindowR Doc Doc
parserContextDisplayR ParserContext
pc) 𝕊
"<token>" 𝐼 𝕊
forall a. Null a => a
null
      iloop  ℕ64  LexDFAState t  𝑂 (ParserToken t  LexDFAState t)  𝑂 (RegexResult o u  LexDFAState t)  Doc  𝐼C (PreParserToken w)
      iloop :: ℕ64
-> LexDFAState t
-> 𝑂 (ParserToken t ∧ LexDFAState t)
-> 𝑂 (RegexResult o u ∧ LexDFAState t)
-> Doc ∨ 𝐼C (PreParserToken w)
iloop ℕ64
n σ :: LexDFAState t
σ@(LexDFAState WindowR Doc Doc
pp ParserContext
pc 𝑆 (ParserToken t)
pi 𝐼C t
ts) 𝑂 (ParserToken t ∧ LexDFAState t)
tO 𝑂 (RegexResult o u ∧ LexDFAState t)
rO = case 𝑆 (ParserToken t) -> () -> 𝑂 (ParserToken t ∧ 𝑆 (ParserToken t))
forall a. 𝑆 a -> () -> 𝑂 (a ∧ 𝑆 a)
un𝑆 𝑆 (ParserToken t)
pi () of
        -- end of stream
        𝑂 (ParserToken t ∧ 𝑆 (ParserToken t))
None  case 𝑂 (RegexResult o u ∧ LexDFAState t)
rO of
          -- end of stream
          -- no results to report
          𝑂 (RegexResult o u ∧ LexDFAState t)
None  case 𝑂 (ParserToken t ∧ LexDFAState t)
tO of
            -- end of stream
            -- no results to report
            -- no prior token
            -- DONE
            𝑂 (ParserToken t ∧ LexDFAState t)
None  𝐼C (PreParserToken w) -> Doc ∨ 𝐼C (PreParserToken w)
forall a. a -> Doc ∨ a
forall (m :: * -> *) a. Return m => a -> m a
return (𝐼C (PreParserToken w) -> Doc ∨ 𝐼C (PreParserToken w))
-> 𝐼C (PreParserToken w) -> Doc ∨ 𝐼C (PreParserToken w)
forall a b. (a -> b) -> a -> b
$ 𝐼C (PreParserToken w)
forall a. Null a => a
null -- :* null
            -- end of stream
            -- no results to report
            -- yes prior token
            -- ERROR
            Some (ParserToken t
t :* LexDFAState t
σ')  Doc -> Doc ∨ 𝐼C (PreParserToken w)
forall a. Doc -> Doc ∨ a
forall {k} e (m :: k -> *) (a :: k). MonadError e m => e -> m a
throw (Doc -> Doc ∨ 𝐼C (PreParserToken w))
-> Doc -> Doc ∨ 𝐼C (PreParserToken w)
forall a b. (a -> b) -> a -> b
$ LexDFAState t -> ParserToken t -> Doc
failure LexDFAState t
σ' ParserToken t
t
          -- end of stream
          -- results to report
          -- SUCCESS
          Some (RegexResult o u
r :* LexDFAState t
σ')  RegexResult o u -> LexDFAState t -> Doc ∨ 𝐼C (PreParserToken w)
success RegexResult o u
r LexDFAState t
σ'
        -- middle of stream
        Some (t :: ParserToken t
t@(ParserToken t
x Bool
_ ParserContext
tc WindowL Doc Doc
_) :* 𝑆 (ParserToken t)
pi')  do
          if 𝕍 Bool
δd 𝕍 Bool -> ℕ64 -> Bool
forall k v t. (Lookup k v t, STACK) => t -> k -> v
⋕! ℕ64
n
            -- middle of stream
            -- parser is dead
            then case 𝑂 (RegexResult o u ∧ LexDFAState t)
rO of
              -- middle of stream
              -- parser is dead
              -- no results to report
              -- ERROR
              𝑂 (RegexResult o u ∧ LexDFAState t)
None  case 𝑂 (ParserToken t ∧ LexDFAState t)
tO of
                𝑂 (ParserToken t ∧ LexDFAState t)
None  𝕊 -> Doc ∨ 𝐼C (PreParserToken w)
forall a. STACK => 𝕊 -> a
error 𝕊
"lexer was dead before it even tried to read input :("
                Some (ParserToken t
t' :* LexDFAState t
σ'')  Doc -> Doc ∨ 𝐼C (PreParserToken w)
forall a. Doc -> Doc ∨ a
forall {k} e (m :: k -> *) (a :: k). MonadError e m => e -> m a
throw (Doc -> Doc ∨ 𝐼C (PreParserToken w))
-> Doc -> Doc ∨ 𝐼C (PreParserToken w)
forall a b. (a -> b) -> a -> b
$ LexDFAState t -> ParserToken t -> Doc
failure LexDFAState t
σ'' ParserToken t
t'
              -- middle of stream
              -- parser is dead
              -- a result to report
              -- SUCCESS
              Some (RegexResult o u
r :* LexDFAState t
σ'')  RegexResult o u -> LexDFAState t -> Doc ∨ 𝐼C (PreParserToken w)
success RegexResult o u
r LexDFAState t
σ''
            -- middle of stream
            -- parser is not dead
            -- KEEP GOING
            else do
              let n' :: ℕ64
n' = if t
x t -> 𝑃 t -> Bool
forall e s. Set e s => e -> s -> Bool
 𝑃 t
lits then (t ∨ c) ⇰ 𝕍 ℕ64
δt ((t ∨ c) ⇰ 𝕍 ℕ64) -> (t ∨ c) -> 𝕍 ℕ64
forall k v t. (Lookup k v t, STACK) => t -> k -> v
⋕! (t -> t ∨ c
forall a b. a -> a ∨ b
Inl t
x) 𝕍 ℕ64 -> ℕ64 -> ℕ64
forall k v t. (Lookup k v t, STACK) => t -> k -> v
⋕! ℕ64
n else (t ∨ c) ⇰ 𝕍 ℕ64
δt ((t ∨ c) ⇰ 𝕍 ℕ64) -> (t ∨ c) -> 𝕍 ℕ64
forall k v t. (Lookup k v t, STACK) => t -> k -> v
⋕! (c -> t ∨ c
forall a b. b -> a ∨ b
Inr (c -> t ∨ c) -> c -> t ∨ c
forall a b. (a -> b) -> a -> b
$ t -> c
forall c t. Classified c t => t -> c
classify t
x) 𝕍 ℕ64 -> ℕ64 -> ℕ64
forall k v t. (Lookup k v t, STACK) => t -> k -> v
⋕! ℕ64
n
                  σ' :: LexDFAState t
σ' = WindowR Doc Doc
-> ParserContext -> 𝑆 (ParserToken t) -> 𝐼C t -> LexDFAState t
forall t.
WindowR Doc Doc
-> ParserContext -> 𝑆 (ParserToken t) -> 𝐼C t -> LexDFAState t
LexDFAState WindowR Doc Doc
pp (ParserContext
pc ParserContext -> ParserContext -> ParserContext
forall a. Append a => a -> a -> a
 ParserContext
tc) 𝑆 (ParserToken t)
pi' (𝐼C t
ts 𝐼C t -> 𝐼C t -> 𝐼C t
forall a. Append a => a -> a -> a
 t -> 𝐼C t
forall a t. Single a t => a -> t
single t
x)
                  rO' :: 𝑂 (RegexResult o u ∧ LexDFAState t)
rO' = case 𝕍 (𝑂 (RegexResult o u))
δs 𝕍 (𝑂 (RegexResult o u)) -> ℕ64 -> 𝑂 (RegexResult o u)
forall k v t. (Lookup k v t, STACK) => t -> k -> v
⋕! ℕ64
n' of
                    𝑂 (RegexResult o u)
None  𝑂 (RegexResult o u ∧ LexDFAState t)
rO
                    Some RegexResult o u
r  (RegexResult o u ∧ LexDFAState t)
-> 𝑂 (RegexResult o u ∧ LexDFAState t)
forall a. a -> 𝑂 a
Some (RegexResult o u
r RegexResult o u -> LexDFAState t -> RegexResult o u ∧ LexDFAState t
forall a b. a -> b -> a ∧ b
:* LexDFAState t
σ')
              ℕ64
-> LexDFAState t
-> 𝑂 (ParserToken t ∧ LexDFAState t)
-> 𝑂 (RegexResult o u ∧ LexDFAState t)
-> Doc ∨ 𝐼C (PreParserToken w)
iloop ℕ64
n' LexDFAState t
σ' ((ParserToken t ∧ LexDFAState t)
-> 𝑂 (ParserToken t ∧ LexDFAState t)
forall a. a -> 𝑂 a
Some (ParserToken t
t ParserToken t -> LexDFAState t -> ParserToken t ∧ LexDFAState t
forall a b. a -> b -> a ∧ b
:* LexDFAState t
σ)) 𝑂 (RegexResult o u ∧ LexDFAState t)
rO'

tokenizeFIO 
   c t o u w w'. (Show u,Ord c,Ord t,Pretty t,Classified c t,Eq o,Eq u,Plus u) 
   Lexer c t o u w  𝕊  (𝕍 (PreParserToken w)  𝕍 (PreParserToken w'))  𝕍 (ParserToken t)  IO (𝕍 (ParserToken w'))
tokenizeFIO :: forall c t o u w w'.
(Show u, Ord c, Ord t, Pretty t, Classified c t, Eq o, Eq u,
 Plus u) =>
Lexer c t o u w
-> 𝕊
-> (𝕍 (PreParserToken w) -> 𝕍 (PreParserToken w'))
-> 𝕍 (ParserToken t)
-> IO (𝕍 (ParserToken w'))
tokenizeFIO Lexer c t o u w
l 𝕊
so 𝕍 (PreParserToken w) -> 𝕍 (PreParserToken w')
f 𝕍 (ParserToken t)
pi = case (𝕍 (PreParserToken w) -> 𝕍 (PreParserToken w'))
-> (Doc ∨ 𝕍 (PreParserToken w)) -> Doc ∨ 𝕍 (PreParserToken w')
forall a b. (a -> b) -> (Doc ∨ a) -> Doc ∨ b
forall (t :: * -> *) a b. Functor t => (a -> b) -> t a -> t b
map 𝕍 (PreParserToken w) -> 𝕍 (PreParserToken w')
f ((Doc ∨ 𝕍 (PreParserToken w)) -> Doc ∨ 𝕍 (PreParserToken w'))
-> (Doc ∨ 𝕍 (PreParserToken w)) -> Doc ∨ 𝕍 (PreParserToken w')
forall a b. (a -> b) -> a -> b
$ Lexer c t o u w
-> 𝕊 -> 𝕍 (ParserToken t) -> Doc ∨ 𝕍 (PreParserToken w)
forall c t o u w.
(Show u, Ord c, Ord t, Pretty t, Classified c t, Eq o, Eq u,
 Plus u) =>
Lexer c t o u w
-> 𝕊 -> 𝕍 (ParserToken t) -> Doc ∨ 𝕍 (PreParserToken w)
tokenize Lexer c t o u w
l 𝕊
so 𝕍 (ParserToken t)
pi of
  Inl Doc
d  Doc -> IO ()
forall a. Pretty a => a -> IO ()
pprint Doc
d IO () -> IO (𝕍 (ParserToken w')) -> IO (𝕍 (ParserToken w'))
forall (m :: * -> *) a b. Bind m => m a -> m b -> m b
 IO (𝕍 (ParserToken w'))
forall a. IO a
abortIO
  Inr 𝕍 (PreParserToken w')
xs  𝕍 (ParserToken w') -> IO (𝕍 (ParserToken w'))
forall a. a -> IO a
forall (m :: * -> *) a. Return m => a -> m a
return (𝕍 (ParserToken w') -> IO (𝕍 (ParserToken w')))
-> 𝕍 (ParserToken w') -> IO (𝕍 (ParserToken w'))
forall a b. (a -> b) -> a -> b
$ 𝕍 (PreParserToken w') -> 𝕍 (ParserToken w')
forall t. 𝕍 (PreParserToken t) -> 𝕍 (ParserToken t)
finalizeTokens 𝕍 (PreParserToken w')
xs

tokenizeIO  
   c t o u w. (Show u,Ord c,Ord t,Pretty t,Classified c t,Eq o,Eq u,Plus u) 
   Lexer c t o u w  𝕊  𝕍 (ParserToken t)  IO (𝕍 (ParserToken w))
tokenizeIO :: forall c t o u w.
(Show u, Ord c, Ord t, Pretty t, Classified c t, Eq o, Eq u,
 Plus u) =>
Lexer c t o u w -> 𝕊 -> 𝕍 (ParserToken t) -> IO (𝕍 (ParserToken w))
tokenizeIO Lexer c t o u w
l 𝕊
so = Lexer c t o u w
-> 𝕊
-> (𝕍 (PreParserToken w) -> 𝕍 (PreParserToken w))
-> 𝕍 (ParserToken t)
-> IO (𝕍 (ParserToken w))
forall c t o u w w'.
(Show u, Ord c, Ord t, Pretty t, Classified c t, Eq o, Eq u,
 Plus u) =>
Lexer c t o u w
-> 𝕊
-> (𝕍 (PreParserToken w) -> 𝕍 (PreParserToken w'))
-> 𝕍 (ParserToken t)
-> IO (𝕍 (ParserToken w'))
tokenizeFIO Lexer c t o u w
l 𝕊
so 𝕍 (PreParserToken w) -> 𝕍 (PreParserToken w)
forall a. a -> a
id

tokenizeFIOMain  
   c t o u w w'. (Show u,Ord c,Ord t,Pretty t,Classified c t,Eq o,Eq u,Plus u,Pretty w') 
   Lexer c t o u w  𝕊  (𝕍 (PreParserToken w)  𝕍 (PreParserToken w'))  𝕍 (ParserToken t)  IO ()
tokenizeFIOMain :: forall c t o u w w'.
(Show u, Ord c, Ord t, Pretty t, Classified c t, Eq o, Eq u,
 Plus u, Pretty w') =>
Lexer c t o u w
-> 𝕊
-> (𝕍 (PreParserToken w) -> 𝕍 (PreParserToken w'))
-> 𝕍 (ParserToken t)
-> IO ()
tokenizeFIOMain Lexer c t o u w
l 𝕊
so 𝕍 (PreParserToken w) -> 𝕍 (PreParserToken w')
f 𝕍 (ParserToken t)
pi = do
  𝕍 (ParserToken w')
xs  Lexer c t o u w
-> 𝕊
-> (𝕍 (PreParserToken w) -> 𝕍 (PreParserToken w'))
-> 𝕍 (ParserToken t)
-> IO (𝕍 (ParserToken w'))
forall c t o u w w'.
(Show u, Ord c, Ord t, Pretty t, Classified c t, Eq o, Eq u,
 Plus u) =>
Lexer c t o u w
-> 𝕊
-> (𝕍 (PreParserToken w) -> 𝕍 (PreParserToken w'))
-> 𝕍 (ParserToken t)
-> IO (𝕍 (ParserToken w'))
tokenizeFIO Lexer c t o u w
l 𝕊
so 𝕍 (PreParserToken w) -> 𝕍 (PreParserToken w')
f 𝕍 (ParserToken t)
pi
  Doc -> IO ()
forall a. Pretty a => a -> IO ()
pprint (Doc -> IO ()) -> Doc -> IO ()
forall a b. (a -> b) -> a -> b
$ [Doc] -> Doc
forall t. ToIter Doc t => t -> Doc
ppVertical 
    [ 𝕊 -> Doc
ppHeader 𝕊
"Success"
    , 𝕍 (w' ∧ LocRange) -> Doc
forall a. Pretty a => a -> Doc
pretty (𝕍 (w' ∧ LocRange) -> Doc) -> 𝕍 (w' ∧ LocRange) -> Doc
forall a b. (a -> b) -> a -> b
$ 𝕍 (ParserToken w')
-> (ParserToken w' -> w' ∧ LocRange) -> 𝕍 (w' ∧ LocRange)
forall (t :: * -> *) a b. Functor t => t a -> (a -> b) -> t b
mapOn 𝕍 (ParserToken w')
xs ((ParserToken w' -> w' ∧ LocRange) -> 𝕍 (w' ∧ LocRange))
-> (ParserToken w' -> w' ∧ LocRange) -> 𝕍 (w' ∧ LocRange)
forall a b. (a -> b) -> a -> b
$ \ ParserToken w'
x  ParserToken w' -> w'
forall t. ParserToken t -> t
parserTokenValue ParserToken w'
x w' -> LocRange -> w' ∧ LocRange
forall a b. a -> b -> a ∧ b
:* ParserContext -> LocRange
parserContextLocRange (ParserToken w' -> ParserContext
forall t. ParserToken t -> ParserContext
parserTokenContext ParserToken w'
x)
    ]
  Doc -> IO ()
forall a. Pretty a => a -> IO ()
pprint (Doc -> IO ()) -> Doc -> IO ()
forall a b. (a -> b) -> a -> b
$ 𝕍 Doc -> Doc
forall a t. (Monoid a, ToIter a t) => t -> a
concat (𝕍 Doc -> Doc) -> 𝕍 Doc -> Doc
forall a b. (a -> b) -> a -> b
$ (ParserToken w' -> Doc) -> 𝕍 (ParserToken w') -> 𝕍 Doc
forall a b. (a -> b) -> 𝕍 a -> 𝕍 b
forall (t :: * -> *) a b. Functor t => (a -> b) -> t a -> t b
map (𝐼 Doc -> Doc
forall a t. (Monoid a, ToIter a t) => t -> a
concat (𝐼 Doc -> Doc)
-> (WindowL Doc Doc -> 𝐼 Doc) -> WindowL Doc Doc -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
 WindowL Doc Doc -> 𝐼 Doc
forall a t. ToIter a t => t -> 𝐼 a
iter (WindowL Doc Doc -> Doc)
-> (ParserContext -> WindowL Doc Doc) -> ParserContext -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
 ParserContext -> WindowL Doc Doc
parserContextDisplayL (ParserContext -> Doc)
-> (ParserToken w' -> ParserContext) -> ParserToken w' -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
 ParserToken w' -> ParserContext
forall t. ParserToken t -> ParserContext
parserTokenContext) 𝕍 (ParserToken w')
xs

tokenizeIOMain 
   c t o u w. (Show u,Ord c,Ord t,Pretty t,Classified c t,Eq o,Eq u,Plus u,Pretty w) 
   Lexer c t o u w  𝕊  𝕍 (ParserToken t)  IO ()
tokenizeIOMain :: forall c t o u w.
(Show u, Ord c, Ord t, Pretty t, Classified c t, Eq o, Eq u,
 Plus u, Pretty w) =>
Lexer c t o u w -> 𝕊 -> 𝕍 (ParserToken t) -> IO ()
tokenizeIOMain Lexer c t o u w
l 𝕊
so = Lexer c t o u w
-> 𝕊
-> (𝕍 (PreParserToken w) -> 𝕍 (PreParserToken w))
-> 𝕍 (ParserToken t)
-> IO ()
forall c t o u w w'.
(Show u, Ord c, Ord t, Pretty t, Classified c t, Eq o, Eq u,
 Plus u, Pretty w') =>
Lexer c t o u w
-> 𝕊
-> (𝕍 (PreParserToken w) -> 𝕍 (PreParserToken w'))
-> 𝕍 (ParserToken t)
-> IO ()
tokenizeFIOMain Lexer c t o u w
l 𝕊
so 𝕍 (PreParserToken w) -> 𝕍 (PreParserToken w)
forall a. a -> a
id

-- API --

data CharClass = LetterClass | NumberClass | SpaceClass | NewlineClass | OtherClass
  deriving (CharClass -> CharClass -> Bool
(CharClass -> CharClass -> Bool)
-> (CharClass -> CharClass -> Bool) -> Eq CharClass
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CharClass -> CharClass -> Bool
== :: CharClass -> CharClass -> Bool
$c/= :: CharClass -> CharClass -> Bool
/= :: CharClass -> CharClass -> Bool
Eq,Eq CharClass
Eq CharClass =>
(CharClass -> CharClass -> Ordering)
-> (CharClass -> CharClass -> Bool)
-> (CharClass -> CharClass -> Bool)
-> (CharClass -> CharClass -> Bool)
-> (CharClass -> CharClass -> Bool)
-> (CharClass -> CharClass -> CharClass)
-> (CharClass -> CharClass -> CharClass)
-> Ord CharClass
CharClass -> CharClass -> Bool
CharClass -> CharClass -> Ordering
CharClass -> CharClass -> CharClass
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: CharClass -> CharClass -> Ordering
compare :: CharClass -> CharClass -> Ordering
$c< :: CharClass -> CharClass -> Bool
< :: CharClass -> CharClass -> Bool
$c<= :: CharClass -> CharClass -> Bool
<= :: CharClass -> CharClass -> Bool
$c> :: CharClass -> CharClass -> Bool
> :: CharClass -> CharClass -> Bool
$c>= :: CharClass -> CharClass -> Bool
>= :: CharClass -> CharClass -> Bool
$cmax :: CharClass -> CharClass -> CharClass
max :: CharClass -> CharClass -> CharClass
$cmin :: CharClass -> CharClass -> CharClass
min :: CharClass -> CharClass -> CharClass
Ord,Int -> CharClass -> ShowS
[CharClass] -> ShowS
CharClass -> [ℂ]
(Int -> CharClass -> ShowS)
-> (CharClass -> [ℂ]) -> ([CharClass] -> ShowS) -> Show CharClass
forall a.
(Int -> a -> ShowS) -> (a -> [ℂ]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CharClass -> ShowS
showsPrec :: Int -> CharClass -> ShowS
$cshow :: CharClass -> [ℂ]
show :: CharClass -> [ℂ]
$cshowList :: [CharClass] -> ShowS
showList :: [CharClass] -> ShowS
Show)
makePrettySum ''CharClass

instance All CharClass where all :: 𝐼 CharClass
all = [CharClass] -> 𝐼 CharClass
forall a t. ToIter a t => t -> 𝐼 a
iter [CharClass
LetterClass,CharClass
NumberClass,CharClass
SpaceClass,CharClass
NewlineClass,CharClass
OtherClass]

instance Classified CharClass  where
  classify :: ℂ -> CharClass
classify c
    | ℂ -> Bool
isLetter c = CharClass
LetterClass
    | ℂ -> Bool
isNumber c = CharClass
NumberClass
    | ℂ -> Bool
isSpace c Bool -> Bool -> Bool
 c ℂ -> ℂ -> Bool
forall a. Eq a => a -> a -> Bool
 '\n' Bool -> Bool -> Bool
 c ℂ -> ℂ -> Bool
forall a. Eq a => a -> a -> Bool
 '\r' = CharClass
SpaceClass
    | c ℂ -> ℂ -> Bool
forall a. Eq a => a -> a -> Bool
 '\n' Bool -> Bool -> Bool
 c ℂ -> ℂ -> Bool
forall a. Eq a => a -> a -> Bool
 '\r' = CharClass
NewlineClass
    | Bool
otherwise = CharClass
OtherClass

lWord  (Zero u,Ord o,Ord u,Additive u)  𝕊  Regex CharClass  o u
lWord :: forall u o.
(Zero u, Ord o, Ord u, Additive u) =>
𝕊 -> Regex CharClass ℂ o u
lWord = Regex CharClass ℂ o u
-> (ℂ -> Regex CharClass ℂ o u -> Regex CharClass ℂ o u)
-> 𝕊
-> Regex CharClass ℂ o u
forall a t b. ToIter a t => b -> (a -> b -> b) -> t -> b
fold Regex CharClass ℂ o u
forall a. Eps a => a
eps ((ℂ -> Regex CharClass ℂ o u -> Regex CharClass ℂ o u)
 -> 𝕊 -> Regex CharClass ℂ o u)
-> (ℂ -> Regex CharClass ℂ o u -> Regex CharClass ℂ o u)
-> 𝕊
-> Regex CharClass ℂ o u
forall a b. (a -> b) -> a -> b
$ \ c Regex CharClass ℂ o u
r  Regex CharClass ℂ o u
r Regex CharClass ℂ o u
-> Regex CharClass ℂ o u -> Regex CharClass ℂ o u
forall a. Seq a => a -> a -> a
 ℂ -> Regex CharClass ℂ o u
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
t -> Regex c t o u
tokRegex c

lSpaceOrNl  (Zero u,Ord o,Ord u,Additive u)  Regex CharClass  o u
lSpaceOrNl :: forall u o.
(Zero u, Ord o, Ord u, Additive u) =>
Regex CharClass ℂ o u
lSpaceOrNl = Regex CharClass ℂ o u -> Regex CharClass ℂ o u
forall a. Kleene a => a -> a
oom (Regex CharClass ℂ o u -> Regex CharClass ℂ o u)
-> Regex CharClass ℂ o u -> Regex CharClass ℂ o u
forall a b. (a -> b) -> a -> b
$ CharClass -> Regex CharClass ℂ o u
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
c -> Regex c t o u
classRegex CharClass
SpaceClass Regex CharClass ℂ o u
-> Regex CharClass ℂ o u -> Regex CharClass ℂ o u
forall a. Append a => a -> a -> a
 CharClass -> Regex CharClass ℂ o u
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
c -> Regex c t o u
classRegex CharClass
NewlineClass

lSpace  (Zero u,Ord o,Ord u,Additive u)  Regex CharClass  o u
lSpace :: forall u o.
(Zero u, Ord o, Ord u, Additive u) =>
Regex CharClass ℂ o u
lSpace = Regex CharClass ℂ o u -> Regex CharClass ℂ o u
forall a. Kleene a => a -> a
oom (Regex CharClass ℂ o u -> Regex CharClass ℂ o u)
-> Regex CharClass ℂ o u -> Regex CharClass ℂ o u
forall a b. (a -> b) -> a -> b
$ CharClass -> Regex CharClass ℂ o u
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
c -> Regex c t o u
classRegex CharClass
SpaceClass

lNl  (Zero u,Ord o,Ord u,Additive u)  Regex CharClass  o u
lNl :: forall u o.
(Zero u, Ord o, Ord u, Additive u) =>
Regex CharClass ℂ o u
lNl = Regex CharClass ℂ o u -> Regex CharClass ℂ o u
forall a. Kleene a => a -> a
oom (Regex CharClass ℂ o u -> Regex CharClass ℂ o u)
-> Regex CharClass ℂ o u -> Regex CharClass ℂ o u
forall a b. (a -> b) -> a -> b
$ CharClass -> Regex CharClass ℂ o u
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
c -> Regex c t o u
classRegex CharClass
NewlineClass

lName  (Zero u,Ord u,Ord o,Additive u)  Regex CharClass  o u
lName :: forall u o.
(Zero u, Ord u, Ord o, Additive u) =>
Regex CharClass ℂ o u
lName = 
  let begTok :: Regex CharClass ℂ o u
begTok = [Regex CharClass ℂ o u] -> Regex CharClass ℂ o u
forall a t. (Monoid a, ToIter a t) => t -> a
concat
        [ CharClass -> Regex CharClass ℂ o u
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
c -> Regex c t o u
classRegex CharClass
LetterClass
        , 𝐼 (Regex CharClass ℂ o u) -> Regex CharClass ℂ o u
forall a t. (Monoid a, ToIter a t) => t -> a
concat (𝐼 (Regex CharClass ℂ o u) -> Regex CharClass ℂ o u)
-> 𝐼 (Regex CharClass ℂ o u) -> Regex CharClass ℂ o u
forall a b. (a -> b) -> a -> b
$ (ℂ -> Regex CharClass ℂ o u) -> 𝐼 ℂ -> 𝐼 (Regex CharClass ℂ o u)
forall a b. (a -> b) -> 𝐼 a -> 𝐼 b
forall (t :: * -> *) a b. Functor t => (a -> b) -> t a -> t b
map ℂ -> Regex CharClass ℂ o u
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
t -> Regex c t o u
tokRegex (𝐼 ℂ -> 𝐼 (Regex CharClass ℂ o u))
-> 𝐼 ℂ -> 𝐼 (Regex CharClass ℂ o u)
forall a b. (a -> b) -> a -> b
$ 𝕊 -> 𝐼 ℂ
forall a t. ToIter a t => t -> 𝐼 a
iter (𝕊 -> 𝐼 ℂ) -> 𝕊 -> 𝐼 ℂ
forall a b. (a -> b) -> a -> b
$ [ℂ] -> 𝕊
𝕤 [ℂ]
"_'′″‴"
        ]
      endTok :: Regex CharClass ℂ o u
endTok = [Regex CharClass ℂ o u] -> Regex CharClass ℂ o u
forall a t. (Monoid a, ToIter a t) => t -> a
concat
        [ Regex CharClass ℂ o u
begTok
        , CharClass -> Regex CharClass ℂ o u
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
c -> Regex c t o u
classRegex CharClass
NumberClass
        ]
      midTok :: Regex CharClass ℂ o u
midTok = Regex CharClass ℂ o u
begTok Regex CharClass ℂ o u
-> Regex CharClass ℂ o u -> Regex CharClass ℂ o u
forall a. Append a => a -> a -> a
 Regex CharClass ℂ o u
endTok Regex CharClass ℂ o u
-> Regex CharClass ℂ o u -> Regex CharClass ℂ o u
forall a. Append a => a -> a -> a
 ℂ -> Regex CharClass ℂ o u
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
t -> Regex c t o u
tokRegex '-'
  in 
  [Regex CharClass ℂ o u] -> Regex CharClass ℂ o u
forall a t. (Seqoid a, ToIter a t) => t -> a
sequence
    [ Regex CharClass ℂ o u
begTok
    , Regex CharClass ℂ o u -> Regex CharClass ℂ o u
forall a. (Append a, Eps a) => a -> a
opt (Regex CharClass ℂ o u -> Regex CharClass ℂ o u)
-> Regex CharClass ℂ o u -> Regex CharClass ℂ o u
forall a b. (a -> b) -> a -> b
$ [Regex CharClass ℂ o u] -> Regex CharClass ℂ o u
forall a t. (Seqoid a, ToIter a t) => t -> a
sequence
        [ Regex CharClass ℂ o u -> Regex CharClass ℂ o u
forall a. Star a => a -> a
star Regex CharClass ℂ o u
midTok
        , Regex CharClass ℂ o u
endTok
        ]
    ]

lNatPre  (Zero u,Ord u,Ord o,Additive u)  Regex CharClass  o u
lNatPre :: forall u o.
(Zero u, Ord u, Ord o, Additive u) =>
Regex CharClass ℂ o u
lNatPre = [Regex CharClass ℂ o u] -> Regex CharClass ℂ o u
forall a t. (Seqoid a, ToIter a t) => t -> a
sequence
  [ [Regex CharClass ℂ o u] -> Regex CharClass ℂ o u
forall a t. (Monoid a, ToIter a t) => t -> a
concat ([Regex CharClass ℂ o u] -> Regex CharClass ℂ o u)
-> [Regex CharClass ℂ o u] -> Regex CharClass ℂ o u
forall a b. (a -> b) -> a -> b
$ (ℂ -> Regex CharClass ℂ o u) -> [ℂ] -> [Regex CharClass ℂ o u]
forall a b. (a -> b) -> [a] -> [b]
forall (t :: * -> *) a b. Functor t => (a -> b) -> t a -> t b
map ℂ -> Regex CharClass ℂ o u
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
t -> Regex c t o u
tokRegex ['0'..'9']
  , Regex CharClass ℂ o u -> Regex CharClass ℂ o u
forall a. Star a => a -> a
star (Regex CharClass ℂ o u -> Regex CharClass ℂ o u)
-> Regex CharClass ℂ o u -> Regex CharClass ℂ o u
forall a b. (a -> b) -> a -> b
$ [Regex CharClass ℂ o u] -> Regex CharClass ℂ o u
forall a t. (Monoid a, ToIter a t) => t -> a
concat
      [ [Regex CharClass ℂ o u] -> Regex CharClass ℂ o u
forall a t. (Monoid a, ToIter a t) => t -> a
concat ([Regex CharClass ℂ o u] -> Regex CharClass ℂ o u)
-> [Regex CharClass ℂ o u] -> Regex CharClass ℂ o u
forall a b. (a -> b) -> a -> b
$ (ℂ -> Regex CharClass ℂ o u) -> [ℂ] -> [Regex CharClass ℂ o u]
forall a b. (a -> b) -> [a] -> [b]
forall (t :: * -> *) a b. Functor t => (a -> b) -> t a -> t b
map ℂ -> Regex CharClass ℂ o u
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
t -> Regex c t o u
tokRegex ['0'..'9']
      , ℂ -> Regex CharClass ℂ o u
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
t -> Regex c t o u
tokRegex '_'
      ]
  , Formats -> Regex CharClass ℂ o u
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
Formats -> Regex c t o u
fepsRegex (Formats -> Regex CharClass ℂ o u)
-> Formats -> Regex CharClass ℂ o u
forall a b. (a -> b) -> a -> b
$ [Format] -> Formats
forall t. ToIter Format t => t -> Formats
formats [Color -> Format
FG Color
red]
  ]

lNat  (Zero u,Ord u,Ord o,Additive u)  Regex CharClass  o u
lNat :: forall u o.
(Zero u, Ord u, Ord o, Additive u) =>
Regex CharClass ℂ o u
lNat = [Regex CharClass ℂ o u] -> Regex CharClass ℂ o u
forall a t. (Seqoid a, ToIter a t) => t -> a
sequence
  [ Regex CharClass ℂ o u
forall u o.
(Zero u, Ord u, Ord o, Additive u) =>
Regex CharClass ℂ o u
lNatPre
  , ℕ64 -> Regex CharClass ℂ o u
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
ℕ64 -> Regex c t o u
lepsRegex (ℕ64 -> Regex CharClass ℂ o u) -> ℕ64 -> Regex CharClass ℂ o u
forall a b. (a -> b) -> a -> b
$ ℕ -> ℕ64
𝕟64 102
  ]

lNatCoded  (Zero u,Ord u,Ord o,Additive u)  Regex CharClass  o u
lNatCoded :: forall u o.
(Zero u, Ord u, Ord o, Additive u) =>
Regex CharClass ℂ o u
lNatCoded = [Regex CharClass ℂ o u] -> Regex CharClass ℂ o u
forall a t. (Seqoid a, ToIter a t) => t -> a
sequence
  [ Regex CharClass ℂ o u
forall u o.
(Zero u, Ord u, Ord o, Additive u) =>
Regex CharClass ℂ o u
lNatPre
  , ℂ -> Regex CharClass ℂ o u
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
t -> Regex c t o u
tokRegex 'n'
  , ℕ64 -> Regex CharClass ℂ o u
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
ℕ64 -> Regex c t o u
lepsRegex (ℕ64 -> Regex CharClass ℂ o u) -> ℕ64 -> Regex CharClass ℂ o u
forall a b. (a -> b) -> a -> b
$ ℕ -> ℕ64
𝕟64 102
  ]

lIntPre  (Zero u,Ord o,Ord u,Additive u)  Regex CharClass  o u
lIntPre :: forall u o.
(Zero u, Ord o, Ord u, Additive u) =>
Regex CharClass ℂ o u
lIntPre = [Regex CharClass ℂ o u] -> Regex CharClass ℂ o u
forall a t. (Seqoid a, ToIter a t) => t -> a
sequence
  [ Regex CharClass ℂ o u -> Regex CharClass ℂ o u
forall a. (Append a, Eps a) => a -> a
opt (Regex CharClass ℂ o u -> Regex CharClass ℂ o u)
-> Regex CharClass ℂ o u -> Regex CharClass ℂ o u
forall a b. (a -> b) -> a -> b
$ ℂ -> Regex CharClass ℂ o u
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
t -> Regex c t o u
tokRegex '-'
  , Regex CharClass ℂ o u
forall u o.
(Zero u, Ord u, Ord o, Additive u) =>
Regex CharClass ℂ o u
lNatPre
  ]

lInt  (Zero u,Ord o,Ord u,Additive u)  Regex CharClass  o u
lInt :: forall u o.
(Zero u, Ord o, Ord u, Additive u) =>
Regex CharClass ℂ o u
lInt = [Regex CharClass ℂ o u] -> Regex CharClass ℂ o u
forall a t. (Seqoid a, ToIter a t) => t -> a
sequence
  [ Regex CharClass ℂ o u
forall u o.
(Zero u, Ord o, Ord u, Additive u) =>
Regex CharClass ℂ o u
lIntPre
  , ℕ64 -> Regex CharClass ℂ o u
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
ℕ64 -> Regex c t o u
lepsRegex (ℕ64 -> Regex CharClass ℂ o u) -> ℕ64 -> Regex CharClass ℂ o u
forall a b. (a -> b) -> a -> b
$ ℕ -> ℕ64
𝕟64 101
  ]

lDbl  (Zero u,Ord o,Ord u,Additive u)  Regex CharClass  o u
lDbl :: forall u o.
(Zero u, Ord o, Ord u, Additive u) =>
Regex CharClass ℂ o u
lDbl = [Regex CharClass ℂ o u] -> Regex CharClass ℂ o u
forall a t. (Seqoid a, ToIter a t) => t -> a
sequence
  [ Regex CharClass ℂ o u
forall u o.
(Zero u, Ord o, Ord u, Additive u) =>
Regex CharClass ℂ o u
lIntPre
  , Regex CharClass ℂ o u -> Regex CharClass ℂ o u
forall a. (Append a, Eps a) => a -> a
opt (Regex CharClass ℂ o u -> Regex CharClass ℂ o u)
-> Regex CharClass ℂ o u -> Regex CharClass ℂ o u
forall a b. (a -> b) -> a -> b
$ [Regex CharClass ℂ o u] -> Regex CharClass ℂ o u
forall a t. (Seqoid a, ToIter a t) => t -> a
sequence
    [ ℂ -> Regex CharClass ℂ o u
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
t -> Regex c t o u
tokRegex '.'
    , Regex CharClass ℂ o u
forall u o.
(Zero u, Ord u, Ord o, Additive u) =>
Regex CharClass ℂ o u
lNatPre
    ]
  , Regex CharClass ℂ o u -> Regex CharClass ℂ o u
forall a. (Append a, Eps a) => a -> a
opt (Regex CharClass ℂ o u -> Regex CharClass ℂ o u)
-> Regex CharClass ℂ o u -> Regex CharClass ℂ o u
forall a b. (a -> b) -> a -> b
$ [Regex CharClass ℂ o u] -> Regex CharClass ℂ o u
forall a t. (Seqoid a, ToIter a t) => t -> a
sequence
    [ ℂ -> Regex CharClass ℂ o u
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
t -> Regex c t o u
tokRegex 'e'
    , Regex CharClass ℂ o u
forall u o.
(Zero u, Ord o, Ord u, Additive u) =>
Regex CharClass ℂ o u
lIntPre
    ]
  , ℕ64 -> Regex CharClass ℂ o u
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
ℕ64 -> Regex c t o u
lepsRegex (ℕ64 -> Regex CharClass ℂ o u) -> ℕ64 -> Regex CharClass ℂ o u
forall a b. (a -> b) -> a -> b
$ ℕ -> ℕ64
𝕟64 100
  ]

lString  (Zero u,Ord o,Ord u,Additive u)  Regex CharClass  o u
lString :: forall u o.
(Zero u, Ord o, Ord u, Additive u) =>
Regex CharClass ℂ o u
lString = [Regex CharClass ℂ o u] -> Regex CharClass ℂ o u
forall a t. (Seqoid a, ToIter a t) => t -> a
sequence
  [ ℂ -> Regex CharClass ℂ o u
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
t -> Regex c t o u
tokRegex '"'
  , Regex CharClass ℂ o u -> Regex CharClass ℂ o u
forall a. Star a => a -> a
star (Regex CharClass ℂ o u -> Regex CharClass ℂ o u)
-> Regex CharClass ℂ o u -> Regex CharClass ℂ o u
forall a b. (a -> b) -> a -> b
$ [Regex CharClass ℂ o u] -> Regex CharClass ℂ o u
forall a t. (Monoid a, ToIter a t) => t -> a
concat
      [ 𝑃 ℂ -> Regex CharClass ℂ o u
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
𝑃 t -> Regex c t o u
ntokRegex (𝑃 ℂ -> Regex CharClass ℂ o u) -> 𝑃 ℂ -> Regex CharClass ℂ o u
forall a b. (a -> b) -> a -> b
$ [ℂ] -> 𝑃 ℂ
forall s t e. (ToIter e t, Set e s) => t -> s
pow ['\\','"']
      , 𝕊 -> Regex CharClass ℂ o u
forall u o.
(Zero u, Ord o, Ord u, Additive u) =>
𝕊 -> Regex CharClass ℂ o u
lWord 𝕊
"\\\\"
      , 𝕊 -> Regex CharClass ℂ o u
forall u o.
(Zero u, Ord o, Ord u, Additive u) =>
𝕊 -> Regex CharClass ℂ o u
lWord 𝕊
"\\\""
      , 𝕊 -> Regex CharClass ℂ o u
forall u o.
(Zero u, Ord o, Ord u, Additive u) =>
𝕊 -> Regex CharClass ℂ o u
lWord 𝕊
"\\n"
      ]
  , ℂ -> Regex CharClass ℂ o u
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
t -> Regex c t o u
tokRegex '"'
  , Formats -> Regex CharClass ℂ o u
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
Formats -> Regex c t o u
fepsRegex (Formats -> Regex CharClass ℂ o u)
-> Formats -> Regex CharClass ℂ o u
forall a b. (a -> b) -> a -> b
$ [Format] -> Formats
forall t. ToIter Format t => t -> Formats
formats [Color -> Format
FG Color
red]
  ]

lComment  (Ord o)  Regex CharClass  o ℕ64
lComment :: forall o. Ord o => Regex CharClass ℂ o ℕ64
lComment = [Regex CharClass ℂ o ℕ64] -> Regex CharClass ℂ o ℕ64
forall a t. (Seqoid a, ToIter a t) => t -> a
sequence
  [ 𝕊 -> Regex CharClass ℂ o ℕ64
forall u o.
(Zero u, Ord o, Ord u, Additive u) =>
𝕊 -> Regex CharClass ℂ o u
lWord 𝕊
"--"
  , Regex CharClass ℂ o ℕ64 -> Regex CharClass ℂ o ℕ64
forall a. Star a => a -> a
star (Regex CharClass ℂ o ℕ64 -> Regex CharClass ℂ o ℕ64)
-> Regex CharClass ℂ o ℕ64 -> Regex CharClass ℂ o ℕ64
forall a b. (a -> b) -> a -> b
$ 𝑃 ℂ -> Regex CharClass ℂ o ℕ64
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
𝑃 t -> Regex c t o u
ntokRegex (𝑃 ℂ -> Regex CharClass ℂ o ℕ64) -> 𝑃 ℂ -> Regex CharClass ℂ o ℕ64
forall a b. (a -> b) -> a -> b
$ ℂ -> 𝑃 ℂ
forall a t. Single a t => a -> t
single '\n'
  -- , opt $ tokRegex '\n'
  , Formats -> Regex CharClass ℂ o ℕ64
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
Formats -> Regex c t o u
fepsRegex (Formats -> Regex CharClass ℂ o ℕ64)
-> Formats -> Regex CharClass ℂ o ℕ64
forall a b. (a -> b) -> a -> b
$ [Format] -> Formats
forall t. ToIter Format t => t -> Formats
formats [Format
IT,Color -> Format
FG Color
grayLight]
  , ℕ64 -> Regex CharClass ℂ o ℕ64
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
ℕ64 -> Regex c t o u
lepsRegex (ℕ64 -> Regex CharClass ℂ o ℕ64) -> ℕ64 -> Regex CharClass ℂ o ℕ64
forall a b. (a -> b) -> a -> b
$ ℕ -> ℕ64
𝕟64 100
  ]

lCommentMLOpen  (Ord o)  Regex CharClass  o ℕ64
lCommentMLOpen :: forall o. Ord o => Regex CharClass ℂ o ℕ64
lCommentMLOpen = [Regex CharClass ℂ o ℕ64] -> Regex CharClass ℂ o ℕ64
forall a t. (Seqoid a, ToIter a t) => t -> a
sequence
  [ 𝕊 -> Regex CharClass ℂ o ℕ64
forall u o.
(Zero u, Ord o, Ord u, Additive u) =>
𝕊 -> Regex CharClass ℂ o u
lWord 𝕊
"{-" 
  , ℕ64 -> Regex CharClass ℂ o ℕ64
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
u -> Regex c t o u
uepsRegex ℕ64
forall a. One a => a
one
  , Formats -> Regex CharClass ℂ o ℕ64
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
Formats -> Regex c t o u
fepsRegex (Formats -> Regex CharClass ℂ o ℕ64)
-> Formats -> Regex CharClass ℂ o ℕ64
forall a b. (a -> b) -> a -> b
$ [Format] -> Formats
forall t. ToIter Format t => t -> Formats
formats [Format
IT,Color -> Format
FG Color
grayLight]
  , ℕ64 -> Regex CharClass ℂ o ℕ64
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
ℕ64 -> Regex c t o u
lepsRegex (ℕ64 -> Regex CharClass ℂ o ℕ64) -> ℕ64 -> Regex CharClass ℂ o ℕ64
forall a b. (a -> b) -> a -> b
$ ℕ -> ℕ64
𝕟64 100
  ]

lCommentMLBodyOpen  (Ord o)  Regex CharClass  o ℕ64
lCommentMLBodyOpen :: forall o. Ord o => Regex CharClass ℂ o ℕ64
lCommentMLBodyOpen = [Regex CharClass ℂ o ℕ64] -> Regex CharClass ℂ o ℕ64
forall a t. (Seqoid a, ToIter a t) => t -> a
sequence
  [ Regex CharClass ℂ o ℕ64 -> Regex CharClass ℂ o ℕ64
forall a. Kleene a => a -> a
oom (ℂ -> Regex CharClass ℂ o ℕ64
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
t -> Regex c t o u
tokRegex '{') Regex CharClass ℂ o ℕ64
-> Regex CharClass ℂ o ℕ64 -> Regex CharClass ℂ o ℕ64
forall a. Seq a => a -> a -> a
 ℂ -> Regex CharClass ℂ o ℕ64
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
t -> Regex c t o u
tokRegex '-'
  , ℕ64 -> Regex CharClass ℂ o ℕ64
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
u -> Regex c t o u
uepsRegex ℕ64
forall a. One a => a
one
  ]

lCommentMLBodyClose  (Ord o)  Regex CharClass  o ℕ64
lCommentMLBodyClose :: forall o. Ord o => Regex CharClass ℂ o ℕ64
lCommentMLBodyClose = [Regex CharClass ℂ o ℕ64] -> Regex CharClass ℂ o ℕ64
forall a t. (Seqoid a, ToIter a t) => t -> a
sequence
  [ Regex CharClass ℂ o ℕ64 -> Regex CharClass ℂ o ℕ64
forall a. Kleene a => a -> a
oom (ℂ -> Regex CharClass ℂ o ℕ64
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
t -> Regex c t o u
tokRegex '-') Regex CharClass ℂ o ℕ64
-> Regex CharClass ℂ o ℕ64 -> Regex CharClass ℂ o ℕ64
forall a. Seq a => a -> a -> a
 ℂ -> Regex CharClass ℂ o ℕ64
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
t -> Regex c t o u
tokRegex '}'
  , ℕ64 -> Regex CharClass ℂ o ℕ64
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
u -> Regex c t o u
uepsRegex (ℕ64 -> Regex CharClass ℂ o ℕ64) -> ℕ64 -> Regex CharClass ℂ o ℕ64
forall a b. (a -> b) -> a -> b
$ ℕ64 -> ℕ64
forall a. (Zero a, Minus a) => a -> a
neg ℕ64
forall a. One a => a
one
  ]

lCommentMLBody  (Ord o)  Regex CharClass  o ℕ64
lCommentMLBody :: forall o. Ord o => Regex CharClass ℂ o ℕ64
lCommentMLBody = [Regex CharClass ℂ o ℕ64] -> Regex CharClass ℂ o ℕ64
forall a t. (Seqoid a, ToIter a t) => t -> a
sequence
  [ Regex CharClass ℂ o ℕ64 -> Regex CharClass ℂ o ℕ64
forall a. Star a => a -> a
star (Regex CharClass ℂ o ℕ64 -> Regex CharClass ℂ o ℕ64)
-> Regex CharClass ℂ o ℕ64 -> Regex CharClass ℂ o ℕ64
forall a b. (a -> b) -> a -> b
$ [Regex CharClass ℂ o ℕ64] -> Regex CharClass ℂ o ℕ64
forall a t. (Monoid a, ToIter a t) => t -> a
concat
      [ 𝑃 ℂ -> Regex CharClass ℂ o ℕ64
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
𝑃 t -> Regex c t o u
ntokRegex (𝑃 ℂ -> Regex CharClass ℂ o ℕ64) -> 𝑃 ℂ -> Regex CharClass ℂ o ℕ64
forall a b. (a -> b) -> a -> b
$ [ℂ] -> 𝑃 ℂ
forall s t e. (ToIter e t, Set e s) => t -> s
pow ['-','{']
      , Regex CharClass ℂ o ℕ64 -> Regex CharClass ℂ o ℕ64
forall a. Kleene a => a -> a
oom (ℂ -> Regex CharClass ℂ o ℕ64
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
t -> Regex c t o u
tokRegex '-') Regex CharClass ℂ o ℕ64
-> Regex CharClass ℂ o ℕ64 -> Regex CharClass ℂ o ℕ64
forall a. Seq a => a -> a -> a
 𝑃 ℂ -> Regex CharClass ℂ o ℕ64
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
𝑃 t -> Regex c t o u
ntokRegex ([ℂ] -> 𝑃 ℂ
forall s t e. (ToIter e t, Set e s) => t -> s
pow ['-','}'])
      , Regex CharClass ℂ o ℕ64 -> Regex CharClass ℂ o ℕ64
forall a. Kleene a => a -> a
oom (ℂ -> Regex CharClass ℂ o ℕ64
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
t -> Regex c t o u
tokRegex '{') Regex CharClass ℂ o ℕ64
-> Regex CharClass ℂ o ℕ64 -> Regex CharClass ℂ o ℕ64
forall a. Seq a => a -> a -> a
 𝑃 ℂ -> Regex CharClass ℂ o ℕ64
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
𝑃 t -> Regex c t o u
ntokRegex ([ℂ] -> 𝑃 ℂ
forall s t e. (ToIter e t, Set e s) => t -> s
pow ['{','-'])
      ]
  , Regex CharClass ℂ o ℕ64
forall o. Ord o => Regex CharClass ℂ o ℕ64
lCommentMLBodyOpen Regex CharClass ℂ o ℕ64
-> Regex CharClass ℂ o ℕ64 -> Regex CharClass ℂ o ℕ64
forall a. Append a => a -> a -> a
 Regex CharClass ℂ o ℕ64
forall o. Ord o => Regex CharClass ℂ o ℕ64
lCommentMLBodyClose
  , Formats -> Regex CharClass ℂ o ℕ64
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
Formats -> Regex c t o u
fepsRegex (Formats -> Regex CharClass ℂ o ℕ64)
-> Formats -> Regex CharClass ℂ o ℕ64
forall a b. (a -> b) -> a -> b
$ [Format] -> Formats
forall t. ToIter Format t => t -> Formats
formats [Format
IT,Color -> Format
FG Color
grayLight]
  ]

--------------------------
-- Basic Language Lexer --
--------------------------

data TokenClassBasic =
    SpaceCBasic
  | CommentCBasic
  | SyntaxCBasic
  | StringCBasic
  | NameCBasic
  | NaturalCBasic
  | IntegerCBasic
  | DoubleCBasic
  | CharCBasic
  deriving (TokenClassBasic -> TokenClassBasic -> Bool
(TokenClassBasic -> TokenClassBasic -> Bool)
-> (TokenClassBasic -> TokenClassBasic -> Bool)
-> Eq TokenClassBasic
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TokenClassBasic -> TokenClassBasic -> Bool
== :: TokenClassBasic -> TokenClassBasic -> Bool
$c/= :: TokenClassBasic -> TokenClassBasic -> Bool
/= :: TokenClassBasic -> TokenClassBasic -> Bool
Eq,Eq TokenClassBasic
Eq TokenClassBasic =>
(TokenClassBasic -> TokenClassBasic -> Ordering)
-> (TokenClassBasic -> TokenClassBasic -> Bool)
-> (TokenClassBasic -> TokenClassBasic -> Bool)
-> (TokenClassBasic -> TokenClassBasic -> Bool)
-> (TokenClassBasic -> TokenClassBasic -> Bool)
-> (TokenClassBasic -> TokenClassBasic -> TokenClassBasic)
-> (TokenClassBasic -> TokenClassBasic -> TokenClassBasic)
-> Ord TokenClassBasic
TokenClassBasic -> TokenClassBasic -> Bool
TokenClassBasic -> TokenClassBasic -> Ordering
TokenClassBasic -> TokenClassBasic -> TokenClassBasic
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: TokenClassBasic -> TokenClassBasic -> Ordering
compare :: TokenClassBasic -> TokenClassBasic -> Ordering
$c< :: TokenClassBasic -> TokenClassBasic -> Bool
< :: TokenClassBasic -> TokenClassBasic -> Bool
$c<= :: TokenClassBasic -> TokenClassBasic -> Bool
<= :: TokenClassBasic -> TokenClassBasic -> Bool
$c> :: TokenClassBasic -> TokenClassBasic -> Bool
> :: TokenClassBasic -> TokenClassBasic -> Bool
$c>= :: TokenClassBasic -> TokenClassBasic -> Bool
>= :: TokenClassBasic -> TokenClassBasic -> Bool
$cmax :: TokenClassBasic -> TokenClassBasic -> TokenClassBasic
max :: TokenClassBasic -> TokenClassBasic -> TokenClassBasic
$cmin :: TokenClassBasic -> TokenClassBasic -> TokenClassBasic
min :: TokenClassBasic -> TokenClassBasic -> TokenClassBasic
Ord,Int -> TokenClassBasic -> ShowS
[TokenClassBasic] -> ShowS
TokenClassBasic -> [ℂ]
(Int -> TokenClassBasic -> ShowS)
-> (TokenClassBasic -> [ℂ])
-> ([TokenClassBasic] -> ShowS)
-> Show TokenClassBasic
forall a.
(Int -> a -> ShowS) -> (a -> [ℂ]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TokenClassBasic -> ShowS
showsPrec :: Int -> TokenClassBasic -> ShowS
$cshow :: TokenClassBasic -> [ℂ]
show :: TokenClassBasic -> [ℂ]
$cshowList :: [TokenClassBasic] -> ShowS
showList :: [TokenClassBasic] -> ShowS
Show)
makePrisms ''TokenClassBasic
makePrettySum ''TokenClassBasic

data TokenBasic =
    SpaceTBasic 𝕊
  | CommentTBasic 𝕊
  | SyntaxTBasic 𝕊
  | StringTBasic 𝕊
  | NameTBasic 𝕊
  | NaturalTBasic 
  | IntegerTBasic 
  | DoubleTBasic 𝔻
  | CharTBasic 
  deriving (TokenBasic -> TokenBasic -> Bool
(TokenBasic -> TokenBasic -> Bool)
-> (TokenBasic -> TokenBasic -> Bool) -> Eq TokenBasic
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TokenBasic -> TokenBasic -> Bool
== :: TokenBasic -> TokenBasic -> Bool
$c/= :: TokenBasic -> TokenBasic -> Bool
/= :: TokenBasic -> TokenBasic -> Bool
Eq,Eq TokenBasic
Eq TokenBasic =>
(TokenBasic -> TokenBasic -> Ordering)
-> (TokenBasic -> TokenBasic -> Bool)
-> (TokenBasic -> TokenBasic -> Bool)
-> (TokenBasic -> TokenBasic -> Bool)
-> (TokenBasic -> TokenBasic -> Bool)
-> (TokenBasic -> TokenBasic -> TokenBasic)
-> (TokenBasic -> TokenBasic -> TokenBasic)
-> Ord TokenBasic
TokenBasic -> TokenBasic -> Bool
TokenBasic -> TokenBasic -> Ordering
TokenBasic -> TokenBasic -> TokenBasic
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: TokenBasic -> TokenBasic -> Ordering
compare :: TokenBasic -> TokenBasic -> Ordering
$c< :: TokenBasic -> TokenBasic -> Bool
< :: TokenBasic -> TokenBasic -> Bool
$c<= :: TokenBasic -> TokenBasic -> Bool
<= :: TokenBasic -> TokenBasic -> Bool
$c> :: TokenBasic -> TokenBasic -> Bool
> :: TokenBasic -> TokenBasic -> Bool
$c>= :: TokenBasic -> TokenBasic -> Bool
>= :: TokenBasic -> TokenBasic -> Bool
$cmax :: TokenBasic -> TokenBasic -> TokenBasic
max :: TokenBasic -> TokenBasic -> TokenBasic
$cmin :: TokenBasic -> TokenBasic -> TokenBasic
min :: TokenBasic -> TokenBasic -> TokenBasic
Ord,Int -> TokenBasic -> ShowS
[TokenBasic] -> ShowS
TokenBasic -> [ℂ]
(Int -> TokenBasic -> ShowS)
-> (TokenBasic -> [ℂ])
-> ([TokenBasic] -> ShowS)
-> Show TokenBasic
forall a.
(Int -> a -> ShowS) -> (a -> [ℂ]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TokenBasic -> ShowS
showsPrec :: Int -> TokenBasic -> ShowS
$cshow :: TokenBasic -> [ℂ]
show :: TokenBasic -> [ℂ]
$cshowList :: [TokenBasic] -> ShowS
showList :: [TokenBasic] -> ShowS
Show)
makePrisms ''TokenBasic
makePrettySum ''TokenBasic

mkTokenBasic  𝐼C   𝑂 TokenClassBasic  𝔹  TokenBasic
mkTokenBasic :: 𝐼C ℂ -> 𝑂 TokenClassBasic -> Bool ∧ TokenBasic
mkTokenBasic 𝐼C ℂ
cs = \case
  𝑂 TokenClassBasic
None  𝕊 -> Bool ∧ TokenBasic
forall a. STACK => 𝕊 -> a
error 𝕊
"no token class"
  Some TokenClassBasic
SpaceCBasic  Bool -> TokenBasic -> Bool ∧ TokenBasic
forall a b. a -> b -> a ∧ b
(:*) Bool
True (TokenBasic -> Bool ∧ TokenBasic)
-> TokenBasic -> Bool ∧ TokenBasic
forall a b. (a -> b) -> a -> b
$ 𝕊 -> TokenBasic
SpaceTBasic (𝕊 -> TokenBasic) -> 𝕊 -> TokenBasic
forall a b. (a -> b) -> a -> b
$ 𝐼C ℂ -> 𝕊
forall t. (ToIter ℂ t, CSized t) => t -> 𝕊
stringCS 𝐼C ℂ
cs
  Some TokenClassBasic
CommentCBasic  Bool -> TokenBasic -> Bool ∧ TokenBasic
forall a b. a -> b -> a ∧ b
(:*) Bool
True (TokenBasic -> Bool ∧ TokenBasic)
-> TokenBasic -> Bool ∧ TokenBasic
forall a b. (a -> b) -> a -> b
$ 𝕊 -> TokenBasic
CommentTBasic (𝕊 -> TokenBasic) -> 𝕊 -> TokenBasic
forall a b. (a -> b) -> a -> b
$ 𝐼C ℂ -> 𝕊
forall t. (ToIter ℂ t, CSized t) => t -> 𝕊
stringCS 𝐼C ℂ
cs
  Some TokenClassBasic
SyntaxCBasic  Bool -> TokenBasic -> Bool ∧ TokenBasic
forall a b. a -> b -> a ∧ b
(:*) Bool
False (TokenBasic -> Bool ∧ TokenBasic)
-> TokenBasic -> Bool ∧ TokenBasic
forall a b. (a -> b) -> a -> b
$ 𝕊 -> TokenBasic
SyntaxTBasic (𝕊 -> TokenBasic) -> 𝕊 -> TokenBasic
forall a b. (a -> b) -> a -> b
$ 𝐼C ℂ -> 𝕊
forall t. (ToIter ℂ t, CSized t) => t -> 𝕊
stringCS 𝐼C ℂ
cs
  Some TokenClassBasic
StringCBasic  Bool -> TokenBasic -> Bool ∧ TokenBasic
forall a b. a -> b -> a ∧ b
(:*) Bool
False (TokenBasic -> Bool ∧ TokenBasic)
-> TokenBasic -> Bool ∧ TokenBasic
forall a b. (a -> b) -> a -> b
$ 𝕊 -> TokenBasic
StringTBasic (𝕊 -> TokenBasic) -> 𝕊 -> TokenBasic
forall a b. (a -> b) -> a -> b
$ 𝕊 -> 𝕊
forall a. Read a => 𝕊 -> a
read𝕊 (𝕊 -> 𝕊) -> 𝕊 -> 𝕊
forall a b. (a -> b) -> a -> b
$ 𝐼C ℂ -> 𝕊
forall t. (ToIter ℂ t, CSized t) => t -> 𝕊
stringCS 𝐼C ℂ
cs
  Some TokenClassBasic
NameCBasic  Bool -> TokenBasic -> Bool ∧ TokenBasic
forall a b. a -> b -> a ∧ b
(:*) Bool
False (TokenBasic -> Bool ∧ TokenBasic)
-> TokenBasic -> Bool ∧ TokenBasic
forall a b. (a -> b) -> a -> b
$ 𝕊 -> TokenBasic
NameTBasic (𝕊 -> TokenBasic) -> 𝕊 -> TokenBasic
forall a b. (a -> b) -> a -> b
$ 𝐼C ℂ -> 𝕊
forall t. (ToIter ℂ t, CSized t) => t -> 𝕊
stringCS 𝐼C ℂ
cs
  Some TokenClassBasic
NaturalCBasic  Bool -> TokenBasic -> Bool ∧ TokenBasic
forall a b. a -> b -> a ∧ b
(:*) Bool
False (TokenBasic -> Bool ∧ TokenBasic)
-> TokenBasic -> Bool ∧ TokenBasic
forall a b. (a -> b) -> a -> b
$ ℕ -> TokenBasic
NaturalTBasic (ℕ -> TokenBasic) -> ℕ -> TokenBasic
forall a b. (a -> b) -> a -> b
$ 𝕊 -> ℕ
forall a. Read a => 𝕊 -> a
read𝕊 (𝕊 -> ℕ) -> 𝕊 -> ℕ
forall a b. (a -> b) -> a -> b
$ 𝐼 ℂ -> 𝕊
forall t. ToIter ℂ t => t -> 𝕊
string (𝐼 ℂ -> 𝕊) -> 𝐼 ℂ -> 𝕊
forall a b. (a -> b) -> a -> b
$ (ℂ -> Bool) -> 𝐼C ℂ -> 𝐼 ℂ
forall a t. ToIter a t => (a -> Bool) -> t -> 𝐼 a
filter (\ c  c ℂ -> 𝑃 ℂ -> Bool
forall e s. Set e s => e -> s -> Bool
 [ℂ] -> 𝑃 ℂ
forall a t. (Ord a, ToIter a t) => t -> 𝑃 a
pow𝑃 ['_','n']) 𝐼C ℂ
cs
  Some TokenClassBasic
IntegerCBasic  Bool -> TokenBasic -> Bool ∧ TokenBasic
forall a b. a -> b -> a ∧ b
(:*) Bool
False (TokenBasic -> Bool ∧ TokenBasic)
-> TokenBasic -> Bool ∧ TokenBasic
forall a b. (a -> b) -> a -> b
$ ℤ -> TokenBasic
IntegerTBasic (ℤ -> TokenBasic) -> ℤ -> TokenBasic
forall a b. (a -> b) -> a -> b
$ 𝕊 -> ℤ
forall a. Read a => 𝕊 -> a
read𝕊 (𝕊 -> ℤ) -> 𝕊 -> ℤ
forall a b. (a -> b) -> a -> b
$ 𝐼 ℂ -> 𝕊
forall t. ToIter ℂ t => t -> 𝕊
string (𝐼 ℂ -> 𝕊) -> 𝐼 ℂ -> 𝕊
forall a b. (a -> b) -> a -> b
$ (ℂ -> Bool) -> 𝐼C ℂ -> 𝐼 ℂ
forall a t. ToIter a t => (a -> Bool) -> t -> 𝐼 a
filter (ℂ -> ℂ -> Bool
forall a. Eq a => a -> a -> Bool
(≢) '_') 𝐼C ℂ
cs
  Some TokenClassBasic
DoubleCBasic  Bool -> TokenBasic -> Bool ∧ TokenBasic
forall a b. a -> b -> a ∧ b
(:*) Bool
False (TokenBasic -> Bool ∧ TokenBasic)
-> TokenBasic -> Bool ∧ TokenBasic
forall a b. (a -> b) -> a -> b
$ 𝔻 -> TokenBasic
DoubleTBasic (𝔻 -> TokenBasic) -> 𝔻 -> TokenBasic
forall a b. (a -> b) -> a -> b
$ 𝕊 -> 𝔻
forall a. Read a => 𝕊 -> a
read𝕊 (𝕊 -> 𝔻) -> 𝕊 -> 𝔻
forall a b. (a -> b) -> a -> b
$ 𝐼 ℂ -> 𝕊
forall t. ToIter ℂ t => t -> 𝕊
string (𝐼 ℂ -> 𝕊) -> 𝐼 ℂ -> 𝕊
forall a b. (a -> b) -> a -> b
$ (ℂ -> Bool) -> 𝐼C ℂ -> 𝐼 ℂ
forall a t. ToIter a t => (a -> Bool) -> t -> 𝐼 a
filter (ℂ -> ℂ -> Bool
forall a. Eq a => a -> a -> Bool
(≢) '_') 𝐼C ℂ
cs
  Some TokenClassBasic
CharCBasic  Bool -> TokenBasic -> Bool ∧ TokenBasic
forall a b. a -> b -> a ∧ b
(:*) Bool
False (TokenBasic -> Bool ∧ TokenBasic)
-> TokenBasic -> Bool ∧ TokenBasic
forall a b. (a -> b) -> a -> b
$ ℂ -> TokenBasic
CharTBasic (ℂ -> TokenBasic) -> ℂ -> TokenBasic
forall a b. (a -> b) -> a -> b
$ 𝕊 -> ℂ
forall a. Read a => 𝕊 -> a
read𝕊 (𝕊 -> ℂ) -> 𝕊 -> ℂ
forall a b. (a -> b) -> a -> b
$ 𝐼C ℂ -> 𝕊
forall t. (ToIter ℂ t, CSized t) => t -> 𝕊
stringCS 𝐼C ℂ
cs

lSyntaxBasic  (Ord u,Additive u)  𝐿 𝕊  𝐿 𝕊  𝐿 𝕊  𝐿 𝕊  Regex CharClass  TokenClassBasic u
lSyntaxBasic :: forall u.
(Ord u, Additive u) =>
𝐿 𝕊 -> 𝐿 𝕊 -> 𝐿 𝕊 -> 𝐿 𝕊 -> Regex CharClass ℂ TokenClassBasic u
lSyntaxBasic 𝐿 𝕊
puns 𝐿 𝕊
kws 𝐿 𝕊
prims 𝐿 𝕊
ops = [Regex CharClass ℂ TokenClassBasic u]
-> Regex CharClass ℂ TokenClassBasic u
forall a t. (Monoid a, ToIter a t) => t -> a
concat
  -- punctuation
  [ [Regex CharClass ℂ TokenClassBasic u]
-> Regex CharClass ℂ TokenClassBasic u
forall a t. (Seqoid a, ToIter a t) => t -> a
sequence
    [ 𝐿 (Regex CharClass ℂ TokenClassBasic u)
-> Regex CharClass ℂ TokenClassBasic u
forall a t. (Monoid a, ToIter a t) => t -> a
concat (𝐿 (Regex CharClass ℂ TokenClassBasic u)
 -> Regex CharClass ℂ TokenClassBasic u)
-> 𝐿 (Regex CharClass ℂ TokenClassBasic u)
-> Regex CharClass ℂ TokenClassBasic u
forall a b. (a -> b) -> a -> b
$ (𝕊 -> Regex CharClass ℂ TokenClassBasic u)
-> 𝐿 𝕊 -> 𝐿 (Regex CharClass ℂ TokenClassBasic u)
forall a b. (a -> b) -> 𝐿 a -> 𝐿 b
forall (t :: * -> *) a b. Functor t => (a -> b) -> t a -> t b
map 𝕊 -> Regex CharClass ℂ TokenClassBasic u
forall u o.
(Zero u, Ord o, Ord u, Additive u) =>
𝕊 -> Regex CharClass ℂ o u
lWord 𝐿 𝕊
puns
    , Formats -> Regex CharClass ℂ TokenClassBasic u
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
Formats -> Regex c t o u
fepsRegex (Formats -> Regex CharClass ℂ TokenClassBasic u)
-> Formats -> Regex CharClass ℂ TokenClassBasic u
forall a b. (a -> b) -> a -> b
$ [Format] -> Formats
forall t. ToIter Format t => t -> Formats
formats [Color -> Format
FG Color
grayDark]
    ]
  -- keywords
  , [Regex CharClass ℂ TokenClassBasic u]
-> Regex CharClass ℂ TokenClassBasic u
forall a t. (Seqoid a, ToIter a t) => t -> a
sequence
    [ 𝐿 (Regex CharClass ℂ TokenClassBasic u)
-> Regex CharClass ℂ TokenClassBasic u
forall a t. (Monoid a, ToIter a t) => t -> a
concat (𝐿 (Regex CharClass ℂ TokenClassBasic u)
 -> Regex CharClass ℂ TokenClassBasic u)
-> 𝐿 (Regex CharClass ℂ TokenClassBasic u)
-> Regex CharClass ℂ TokenClassBasic u
forall a b. (a -> b) -> a -> b
$ (𝕊 -> Regex CharClass ℂ TokenClassBasic u)
-> 𝐿 𝕊 -> 𝐿 (Regex CharClass ℂ TokenClassBasic u)
forall a b. (a -> b) -> 𝐿 a -> 𝐿 b
forall (t :: * -> *) a b. Functor t => (a -> b) -> t a -> t b
map 𝕊 -> Regex CharClass ℂ TokenClassBasic u
forall u o.
(Zero u, Ord o, Ord u, Additive u) =>
𝕊 -> Regex CharClass ℂ o u
lWord 𝐿 𝕊
kws
    , Formats -> Regex CharClass ℂ TokenClassBasic u
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
Formats -> Regex c t o u
fepsRegex (Formats -> Regex CharClass ℂ TokenClassBasic u)
-> Formats -> Regex CharClass ℂ TokenClassBasic u
forall a b. (a -> b) -> a -> b
$ [Format] -> Formats
forall t. ToIter Format t => t -> Formats
formats [Color -> Format
FG Color
yellow,Format
BD]
    ]
  -- primitives
  , [Regex CharClass ℂ TokenClassBasic u]
-> Regex CharClass ℂ TokenClassBasic u
forall a t. (Seqoid a, ToIter a t) => t -> a
sequence
    [ 𝐿 (Regex CharClass ℂ TokenClassBasic u)
-> Regex CharClass ℂ TokenClassBasic u
forall a t. (Monoid a, ToIter a t) => t -> a
concat (𝐿 (Regex CharClass ℂ TokenClassBasic u)
 -> Regex CharClass ℂ TokenClassBasic u)
-> 𝐿 (Regex CharClass ℂ TokenClassBasic u)
-> Regex CharClass ℂ TokenClassBasic u
forall a b. (a -> b) -> a -> b
$ (𝕊 -> Regex CharClass ℂ TokenClassBasic u)
-> 𝐿 𝕊 -> 𝐿 (Regex CharClass ℂ TokenClassBasic u)
forall a b. (a -> b) -> 𝐿 a -> 𝐿 b
forall (t :: * -> *) a b. Functor t => (a -> b) -> t a -> t b
map 𝕊 -> Regex CharClass ℂ TokenClassBasic u
forall u o.
(Zero u, Ord o, Ord u, Additive u) =>
𝕊 -> Regex CharClass ℂ o u
lWord 𝐿 𝕊
prims
    , Formats -> Regex CharClass ℂ TokenClassBasic u
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
Formats -> Regex c t o u
fepsRegex (Formats -> Regex CharClass ℂ TokenClassBasic u)
-> Formats -> Regex CharClass ℂ TokenClassBasic u
forall a b. (a -> b) -> a -> b
$ [Format] -> Formats
forall t. ToIter Format t => t -> Formats
formats [Color -> Format
FG Color
blue]
    ]
  -- operators
  , [Regex CharClass ℂ TokenClassBasic u]
-> Regex CharClass ℂ TokenClassBasic u
forall a t. (Seqoid a, ToIter a t) => t -> a
sequence
    [ 𝐿 (Regex CharClass ℂ TokenClassBasic u)
-> Regex CharClass ℂ TokenClassBasic u
forall a t. (Monoid a, ToIter a t) => t -> a
concat (𝐿 (Regex CharClass ℂ TokenClassBasic u)
 -> Regex CharClass ℂ TokenClassBasic u)
-> 𝐿 (Regex CharClass ℂ TokenClassBasic u)
-> Regex CharClass ℂ TokenClassBasic u
forall a b. (a -> b) -> a -> b
$ (𝕊 -> Regex CharClass ℂ TokenClassBasic u)
-> 𝐿 𝕊 -> 𝐿 (Regex CharClass ℂ TokenClassBasic u)
forall a b. (a -> b) -> 𝐿 a -> 𝐿 b
forall (t :: * -> *) a b. Functor t => (a -> b) -> t a -> t b
map 𝕊 -> Regex CharClass ℂ TokenClassBasic u
forall u o.
(Zero u, Ord o, Ord u, Additive u) =>
𝕊 -> Regex CharClass ℂ o u
lWord 𝐿 𝕊
ops
    , Formats -> Regex CharClass ℂ TokenClassBasic u
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
Formats -> Regex c t o u
fepsRegex (Formats -> Regex CharClass ℂ TokenClassBasic u)
-> Formats -> Regex CharClass ℂ TokenClassBasic u
forall a b. (a -> b) -> a -> b
$ [Format] -> Formats
forall t. ToIter Format t => t -> Formats
formats [Color -> Format
FG Color
teal]
    ]
  ]

lTokenBasic  𝐿 𝕊  𝐿 𝕊  𝐿 𝕊  𝐿 𝕊  Regex CharClass  TokenClassBasic ℕ64
lTokenBasic :: 𝐿 𝕊 -> 𝐿 𝕊 -> 𝐿 𝕊 -> 𝐿 𝕊 -> Regex CharClass ℂ TokenClassBasic ℕ64
lTokenBasic 𝐿 𝕊
puns 𝐿 𝕊
kws 𝐿 𝕊
prims 𝐿 𝕊
ops = [Regex CharClass ℂ TokenClassBasic ℕ64]
-> Regex CharClass ℂ TokenClassBasic ℕ64
forall a t. (Monoid a, ToIter a t) => t -> a
concat
  [ Regex CharClass ℂ TokenClassBasic ℕ64
forall u o.
(Zero u, Ord u, Ord o, Additive u) =>
Regex CharClass ℂ o u
lNatCoded                       Regex CharClass ℂ TokenClassBasic ℕ64
-> Regex CharClass ℂ TokenClassBasic ℕ64
-> Regex CharClass ℂ TokenClassBasic ℕ64
forall a. Seq a => a -> a -> a
 TokenClassBasic -> Regex CharClass ℂ TokenClassBasic ℕ64
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
o -> Regex c t o u
oepsRegex TokenClassBasic
NaturalCBasic
  , Regex CharClass ℂ TokenClassBasic ℕ64
forall u o.
(Zero u, Ord o, Ord u, Additive u) =>
Regex CharClass ℂ o u
lInt                            Regex CharClass ℂ TokenClassBasic ℕ64
-> Regex CharClass ℂ TokenClassBasic ℕ64
-> Regex CharClass ℂ TokenClassBasic ℕ64
forall a. Seq a => a -> a -> a
 TokenClassBasic -> Regex CharClass ℂ TokenClassBasic ℕ64
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
o -> Regex c t o u
oepsRegex TokenClassBasic
IntegerCBasic
  , Regex CharClass ℂ TokenClassBasic ℕ64
forall u o.
(Zero u, Ord o, Ord u, Additive u) =>
Regex CharClass ℂ o u
lDbl                            Regex CharClass ℂ TokenClassBasic ℕ64
-> Regex CharClass ℂ TokenClassBasic ℕ64
-> Regex CharClass ℂ TokenClassBasic ℕ64
forall a. Seq a => a -> a -> a
 TokenClassBasic -> Regex CharClass ℂ TokenClassBasic ℕ64
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
o -> Regex c t o u
oepsRegex TokenClassBasic
DoubleCBasic
  , 𝐿 𝕊 -> 𝐿 𝕊 -> 𝐿 𝕊 -> 𝐿 𝕊 -> Regex CharClass ℂ TokenClassBasic ℕ64
forall u.
(Ord u, Additive u) =>
𝐿 𝕊 -> 𝐿 𝕊 -> 𝐿 𝕊 -> 𝐿 𝕊 -> Regex CharClass ℂ TokenClassBasic u
lSyntaxBasic 𝐿 𝕊
puns 𝐿 𝕊
kws 𝐿 𝕊
prims 𝐿 𝕊
ops Regex CharClass ℂ TokenClassBasic ℕ64
-> Regex CharClass ℂ TokenClassBasic ℕ64
-> Regex CharClass ℂ TokenClassBasic ℕ64
forall a. Seq a => a -> a -> a
 TokenClassBasic -> Regex CharClass ℂ TokenClassBasic ℕ64
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
o -> Regex c t o u
oepsRegex TokenClassBasic
SyntaxCBasic
  , Regex CharClass ℂ TokenClassBasic ℕ64
forall u o.
(Zero u, Ord o, Ord u, Additive u) =>
Regex CharClass ℂ o u
lString                         Regex CharClass ℂ TokenClassBasic ℕ64
-> Regex CharClass ℂ TokenClassBasic ℕ64
-> Regex CharClass ℂ TokenClassBasic ℕ64
forall a. Seq a => a -> a -> a
 TokenClassBasic -> Regex CharClass ℂ TokenClassBasic ℕ64
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
o -> Regex c t o u
oepsRegex TokenClassBasic
StringCBasic
  , Regex CharClass ℂ TokenClassBasic ℕ64
forall u o.
(Zero u, Ord u, Ord o, Additive u) =>
Regex CharClass ℂ o u
lName                           Regex CharClass ℂ TokenClassBasic ℕ64
-> Regex CharClass ℂ TokenClassBasic ℕ64
-> Regex CharClass ℂ TokenClassBasic ℕ64
forall a. Seq a => a -> a -> a
 TokenClassBasic -> Regex CharClass ℂ TokenClassBasic ℕ64
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
o -> Regex c t o u
oepsRegex TokenClassBasic
NameCBasic
  , Regex CharClass ℂ TokenClassBasic ℕ64
forall u o.
(Zero u, Ord o, Ord u, Additive u) =>
Regex CharClass ℂ o u
lSpaceOrNl                      Regex CharClass ℂ TokenClassBasic ℕ64
-> Regex CharClass ℂ TokenClassBasic ℕ64
-> Regex CharClass ℂ TokenClassBasic ℕ64
forall a. Seq a => a -> a -> a
 TokenClassBasic -> Regex CharClass ℂ TokenClassBasic ℕ64
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
o -> Regex c t o u
oepsRegex TokenClassBasic
SpaceCBasic
  , Regex CharClass ℂ TokenClassBasic ℕ64
forall o. Ord o => Regex CharClass ℂ o ℕ64
lComment                        Regex CharClass ℂ TokenClassBasic ℕ64
-> Regex CharClass ℂ TokenClassBasic ℕ64
-> Regex CharClass ℂ TokenClassBasic ℕ64
forall a. Seq a => a -> a -> a
 TokenClassBasic -> Regex CharClass ℂ TokenClassBasic ℕ64
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
o -> Regex c t o u
oepsRegex TokenClassBasic
CommentCBasic
  , Regex CharClass ℂ TokenClassBasic ℕ64
forall o. Ord o => Regex CharClass ℂ o ℕ64
lCommentMLOpen                  Regex CharClass ℂ TokenClassBasic ℕ64
-> Regex CharClass ℂ TokenClassBasic ℕ64
-> Regex CharClass ℂ TokenClassBasic ℕ64
forall a. Seq a => a -> a -> a
 TokenClassBasic -> Regex CharClass ℂ TokenClassBasic ℕ64
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
o -> Regex c t o u
oepsRegex TokenClassBasic
CommentCBasic
  ]

lCommentMLBasic  Regex CharClass  TokenClassBasic ℕ64
lCommentMLBasic :: Regex CharClass ℂ TokenClassBasic ℕ64
lCommentMLBasic = Regex CharClass ℂ TokenClassBasic ℕ64
forall o. Ord o => Regex CharClass ℂ o ℕ64
lCommentMLBody Regex CharClass ℂ TokenClassBasic ℕ64
-> Regex CharClass ℂ TokenClassBasic ℕ64
-> Regex CharClass ℂ TokenClassBasic ℕ64
forall a. Seq a => a -> a -> a
 TokenClassBasic -> Regex CharClass ℂ TokenClassBasic ℕ64
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
o -> Regex c t o u
oepsRegex TokenClassBasic
CommentCBasic

dfaBasic  𝐿 𝕊  𝐿 𝕊  𝐿 𝕊  𝐿 𝕊  ℕ64  DFA CharClass  TokenClassBasic ℕ64
dfaBasic :: 𝐿 𝕊
-> 𝐿 𝕊 -> 𝐿 𝕊 -> 𝐿 𝕊 -> ℕ64 -> DFA CharClass ℂ TokenClassBasic ℕ64
dfaBasic 𝐿 𝕊
puns 𝐿 𝕊
kws 𝐿 𝕊
prims 𝐿 𝕊
ops =
  let dfaTokenBasic :: DFA CharClass ℂ TokenClassBasic ℕ64
dfaTokenBasic = Regex CharClass ℂ TokenClassBasic ℕ64
-> DFA CharClass ℂ TokenClassBasic ℕ64
forall c t o u.
(Pretty t, Pretty o, Pretty u, Ord c, Ord t, Classified c t, All c,
 Ord o, Ord u, Additive u) =>
Regex c t o u -> DFA c t o u
compileRegex (Regex CharClass ℂ TokenClassBasic ℕ64
 -> DFA CharClass ℂ TokenClassBasic ℕ64)
-> Regex CharClass ℂ TokenClassBasic ℕ64
-> DFA CharClass ℂ TokenClassBasic ℕ64
forall a b. (a -> b) -> a -> b
$ 𝐿 𝕊 -> 𝐿 𝕊 -> 𝐿 𝕊 -> 𝐿 𝕊 -> Regex CharClass ℂ TokenClassBasic ℕ64
lTokenBasic 𝐿 𝕊
puns 𝐿 𝕊
kws 𝐿 𝕊
prims 𝐿 𝕊
ops
      dfaCommentMLBasic :: DFA CharClass ℂ TokenClassBasic ℕ64
dfaCommentMLBasic = Regex CharClass ℂ TokenClassBasic ℕ64
-> DFA CharClass ℂ TokenClassBasic ℕ64
forall c t o u.
(Pretty t, Pretty o, Pretty u, Ord c, Ord t, Classified c t, All c,
 Ord o, Ord u, Additive u) =>
Regex c t o u -> DFA c t o u
compileRegex Regex CharClass ℂ TokenClassBasic ℕ64
lCommentMLBasic
      dfa :: ℕ64 -> DFA CharClass ℂ TokenClassBasic ℕ64
dfa ℕ64
n | ℕ64
n ℕ64 -> ℕ64 -> Bool
forall a. Eq a => a -> a -> Bool
 ℕ -> ℕ64
𝕟64 0 = DFA CharClass ℂ TokenClassBasic ℕ64
dfaTokenBasic
            | Bool
otherwise = DFA CharClass ℂ TokenClassBasic ℕ64
dfaCommentMLBasic
  in ℕ64 -> DFA CharClass ℂ TokenClassBasic ℕ64
dfa

lexerBasic  𝐿 𝕊  𝐿 𝕊  𝐿 𝕊  𝐿 𝕊  Lexer CharClass  TokenClassBasic ℕ64 TokenBasic
lexerBasic :: 𝐿 𝕊
-> 𝐿 𝕊
-> 𝐿 𝕊
-> 𝐿 𝕊
-> Lexer CharClass ℂ TokenClassBasic ℕ64 TokenBasic
lexerBasic 𝐿 𝕊
puns 𝐿 𝕊
kws 𝐿 𝕊
prims 𝐿 𝕊
ops = (ℕ64 -> DFA CharClass ℂ TokenClassBasic ℕ64)
-> (𝐼C ℂ -> 𝑂 TokenClassBasic -> Bool ∧ TokenBasic)
-> ℕ64
-> Lexer CharClass ℂ TokenClassBasic ℕ64 TokenBasic
forall c t o u w.
(u -> DFA c t o u)
-> (𝐼C t -> 𝑂 o -> Bool ∧ w) -> u -> Lexer c t o u w
Lexer (𝐿 𝕊
-> 𝐿 𝕊 -> 𝐿 𝕊 -> 𝐿 𝕊 -> ℕ64 -> DFA CharClass ℂ TokenClassBasic ℕ64
dfaBasic 𝐿 𝕊
puns 𝐿 𝕊
kws 𝐿 𝕊
prims 𝐿 𝕊
ops) 𝐼C ℂ -> 𝑂 TokenClassBasic -> Bool ∧ TokenBasic
mkTokenBasic ℕ64
forall a. Zero a => a
zero

-----------------------------------------------
-- Basic Whitespace-sensitive Language Lexer --
-----------------------------------------------

-- Blockifying Tokens --

data IndentCommand = OpenIC | CloseIC | NewlineIC

-- ... anchor ->| blah blah blah
--                  blah
--                  ^^^^
blockifyTokens   t. 𝐿 (AddBT Loc)  (t  𝔹)  (t  𝔹)  (IndentCommand  t)  𝕍 (PreParserToken t)  𝕍 (PreParserToken t)
blockifyTokens :: forall t.
𝐿 (AddBT Loc)
-> (t -> Bool)
-> (t -> Bool)
-> (IndentCommand -> t)
-> 𝕍 (PreParserToken t)
-> 𝕍 (PreParserToken t)
blockifyTokens 𝐿 (AddBT Loc)
anchors₀ t -> Bool
isNewline t -> Bool
isBlock IndentCommand -> t
mkIndentToken 𝕍 (PreParserToken t)
ts₀ = 𝐼C (PreParserToken t) -> 𝕍 (PreParserToken t)
forall a t. ToIterC a t => t -> 𝕍 a
vecC (𝐼C (PreParserToken t) -> 𝕍 (PreParserToken t))
-> 𝐼C (PreParserToken t) -> 𝕍 (PreParserToken t)
forall a b. (a -> b) -> a -> b
$ 𝐼C (PreParserToken t)
-> LocRange
-> Bool
-> Bool
-> 𝐿 (AddBT Loc)
-> 𝑆 (PreParserToken t)
-> 𝐼C (PreParserToken t)
loop 𝐼C (PreParserToken t)
forall a. Null a => a
null LocRange
forall a. Bot a => a
bot Bool
False Bool
False 𝐿 (AddBT Loc)
anchors₀ (𝑆 (PreParserToken t) -> 𝐼C (PreParserToken t))
-> 𝑆 (PreParserToken t) -> 𝐼C (PreParserToken t)
forall a b. (a -> b) -> a -> b
$ 𝕍 (PreParserToken t) -> 𝑆 (PreParserToken t)
forall a t. ToIter a t => t -> 𝑆 a
stream 𝕍 (PreParserToken t)
ts₀
  where
    syntheticToken  AddBT Loc  IndentCommand  PreParserToken t
    syntheticToken :: AddBT Loc -> IndentCommand -> PreParserToken t
syntheticToken AddBT Loc
loc IndentCommand
x =
      let pcS :: Doc
pcS = case IndentCommand
x of
            IndentCommand
OpenIC  Color -> Doc -> Doc
ppBG Color
white (Doc -> Doc) -> Doc -> Doc
forall a b. (a -> b) -> a -> b
$ Color -> Doc -> Doc
ppFG Color
grayLight (Doc -> Doc) -> Doc -> Doc
forall a b. (a -> b) -> a -> b
$ 𝕊 -> Doc
ppString 𝕊
"⦗"
            IndentCommand
CloseIC  Color -> Doc -> Doc
ppBG Color
white (Doc -> Doc) -> Doc -> Doc
forall a b. (a -> b) -> a -> b
$ Color -> Doc -> Doc
ppFG Color
grayLight (Doc -> Doc) -> Doc -> Doc
forall a b. (a -> b) -> a -> b
$ 𝕊 -> Doc
ppString 𝕊
"⦘"
            IndentCommand
NewlineIC  Color -> Doc -> Doc
ppBG Color
white (Doc -> Doc) -> Doc -> Doc
forall a b. (a -> b) -> a -> b
$ Color -> Doc -> Doc
ppFG Color
grayLight (Doc -> Doc) -> Doc -> Doc
forall a b. (a -> b) -> a -> b
$ 𝕊 -> Doc
ppString 𝕊
"‣"
          pc :: ParserContext
pc = LocRange
-> WindowL Doc Doc
-> WindowR Doc Doc
-> WindowR Doc Doc
-> ParserContext
ParserContext (AddBT Loc -> AddBT Loc -> LocRange
LocRange AddBT Loc
loc AddBT Loc
loc) (Doc -> WindowL Doc Doc
forall a i. a -> WindowL i a
eWindowL Doc
pcS) (Doc -> WindowR Doc Doc
forall a i. a -> WindowR i a
eWindowR Doc
pcS) (WindowR Doc Doc -> ParserContext)
-> WindowR Doc Doc -> ParserContext
forall a b. (a -> b) -> a -> b
$ Doc -> WindowR Doc Doc
forall a i. a -> WindowR i a
eWindowR Doc
pcS
      in
      t -> Bool -> ParserContext -> PreParserToken t
forall t. t -> Bool -> ParserContext -> PreParserToken t
PreParserToken (IndentCommand -> t
mkIndentToken IndentCommand
x) Bool
False ParserContext
pc
    loop  𝐼C (PreParserToken t)  LocRange  𝔹  𝔹  𝐿 (AddBT Loc)  𝑆 (PreParserToken t)  𝐼C (PreParserToken t)
    loop :: 𝐼C (PreParserToken t)
-> LocRange
-> Bool
-> Bool
-> 𝐿 (AddBT Loc)
-> 𝑆 (PreParserToken t)
-> 𝐼C (PreParserToken t)
loop 𝐼C (PreParserToken t)
prefix LocRange
prefixLocRangeBumped Bool
isFreshBlock Bool
isAfterNewline = \case
      𝐿 (AddBT Loc)
Nil  𝐼C (PreParserToken t)
-> LocRange
-> Bool
-> 𝑆 (PreParserToken t)
-> 𝐼C (PreParserToken t)
loopUnanchored 𝐼C (PreParserToken t)
prefix LocRange
prefixLocRangeBumped Bool
isFreshBlock
      AddBT Loc
anchor :& 𝐿 (AddBT Loc)
anchors  𝐼C (PreParserToken t)
-> LocRange
-> Bool
-> Bool
-> AddBT Loc
-> 𝐿 (AddBT Loc)
-> 𝑆 (PreParserToken t)
-> 𝐼C (PreParserToken t)
loopAnchored 𝐼C (PreParserToken t)
prefix LocRange
prefixLocRangeBumped Bool
isFreshBlock Bool
isAfterNewline AddBT Loc
anchor 𝐿 (AddBT Loc)
anchors
    loopUnanchored  𝐼C (PreParserToken t)  LocRange  𝔹  𝑆 (PreParserToken t)  𝐼C (PreParserToken t)
    loopUnanchored :: 𝐼C (PreParserToken t)
-> LocRange
-> Bool
-> 𝑆 (PreParserToken t)
-> 𝐼C (PreParserToken t)
loopUnanchored 𝐼C (PreParserToken t)
prefix LocRange
prefixLocRangeBumped Bool
isFreshBlock 𝑆 (PreParserToken t)
ts = case 𝑆 (PreParserToken t)
-> () -> 𝑂 (PreParserToken t ∧ 𝑆 (PreParserToken t))
forall a. 𝑆 a -> () -> 𝑂 (a ∧ 𝑆 a)
un𝑆 𝑆 (PreParserToken t)
ts () of
      𝑂 (PreParserToken t ∧ 𝑆 (PreParserToken t))
None  𝐼C (PreParserToken t)
prefix
      Some (PreParserToken t
t :* 𝑆 (PreParserToken t)
ts') 
        let locₜ :: AddBT Loc
locₜ = LocRange -> AddBT Loc
locRangeBegin (LocRange -> AddBT Loc) -> LocRange -> AddBT Loc
forall a b. (a -> b) -> a -> b
$ ParserContext -> LocRange
parserContextLocRange (ParserContext -> LocRange) -> ParserContext -> LocRange
forall a b. (a -> b) -> a -> b
$ PreParserToken t -> ParserContext
forall t. PreParserToken t -> ParserContext
preParserTokenContext PreParserToken t
t
            prefixLocRangeBumpedEnd :: AddBT Loc
prefixLocRangeBumpedEnd = LocRange -> AddBT Loc
locRangeEnd LocRange
prefixLocRangeBumped
        in
        if
        | PreParserToken t -> Bool
forall t. PreParserToken t -> Bool
preParserTokenSkip PreParserToken t
t  
          𝐼C (PreParserToken t)
-> LocRange
-> Bool
-> 𝑆 (PreParserToken t)
-> 𝐼C (PreParserToken t)
loopUnanchored (𝐼C (PreParserToken t)
prefix 𝐼C (PreParserToken t)
-> 𝐼C (PreParserToken t) -> 𝐼C (PreParserToken t)
forall a. Append a => a -> a -> a
 PreParserToken t -> 𝐼C (PreParserToken t)
forall a t. Single a t => a -> t
single PreParserToken t
t) 
                         (LocRange
prefixLocRangeBumped LocRange -> LocRange -> LocRange
forall a. Join a => a -> a -> a
 LocRange -> LocRange
bumpColEnd₂ (ParserContext -> LocRange
parserContextLocRange (ParserContext -> LocRange) -> ParserContext -> LocRange
forall a b. (a -> b) -> a -> b
$ PreParserToken t -> ParserContext
forall t. PreParserToken t -> ParserContext
preParserTokenContext PreParserToken t
t)) 
                         Bool
isFreshBlock 
                         𝑆 (PreParserToken t)
ts'
        | {- not (parserTokenSkip t) ⩓ -} 
          Bool
isFreshBlock  [𝐼C (PreParserToken t)] -> 𝐼C (PreParserToken t)
forall a t. (Monoid a, ToIter a t) => t -> a
concat
            -- 
            --     ... <block> <token>
            --                 ^^^^^^^
            [ 𝐼C (PreParserToken t)
prefix
            , PreParserToken t -> 𝐼C (PreParserToken t)
forall a t. Single a t => a -> t
single (PreParserToken t -> 𝐼C (PreParserToken t))
-> PreParserToken t -> 𝐼C (PreParserToken t)
forall a b. (a -> b) -> a -> b
$ AddBT Loc -> IndentCommand -> PreParserToken t
syntheticToken AddBT Loc
prefixLocRangeBumpedEnd IndentCommand
OpenIC
            , PreParserToken t -> 𝐼C (PreParserToken t)
forall a t. Single a t => a -> t
single PreParserToken t
t
            , 𝐼C (PreParserToken t)
-> LocRange
-> Bool
-> Bool
-> AddBT Loc
-> 𝐿 (AddBT Loc)
-> 𝑆 (PreParserToken t)
-> 𝐼C (PreParserToken t)
loopAnchored 𝐼C (PreParserToken t)
forall a. Null a => a
null 
                           (AddBT Loc -> AddBT Loc -> LocRange
LocRange AddBT Loc
prefixLocRangeBumpedEnd AddBT Loc
prefixLocRangeBumpedEnd) 
                           (t -> Bool
isBlock (t -> Bool) -> t -> Bool
forall a b. (a -> b) -> a -> b
$ PreParserToken t -> t
forall t. PreParserToken t -> t
preParserTokenValue PreParserToken t
t) 
                           Bool
False 
                           AddBT Loc
locₜ 
                           𝐿 (AddBT Loc)
forall a. Null a => a
null 
                           𝑆 (PreParserToken t)
ts'
            ]
        | {- not (parserTokenSkip t) ⩓ not (isFreshBlock t) ⩓ -} 
          Bool
otherwise  [𝐼C (PreParserToken t)] -> 𝐼C (PreParserToken t)
forall a t. (Monoid a, ToIter a t) => t -> a
concat
          --
          --     ... <token>
          --         ^^^^^^^
          [ 𝐼C (PreParserToken t)
prefix
          , PreParserToken t -> 𝐼C (PreParserToken t)
forall a t. Single a t => a -> t
single PreParserToken t
t
          , 𝐼C (PreParserToken t)
-> LocRange
-> Bool
-> 𝑆 (PreParserToken t)
-> 𝐼C (PreParserToken t)
loopUnanchored 𝐼C (PreParserToken t)
forall a. Null a => a
null 
                           (AddBT Loc -> AddBT Loc -> LocRange
LocRange AddBT Loc
prefixLocRangeBumpedEnd AddBT Loc
prefixLocRangeBumpedEnd) 
                           (t -> Bool
isBlock (t -> Bool) -> t -> Bool
forall a b. (a -> b) -> a -> b
$ PreParserToken t -> t
forall t. PreParserToken t -> t
preParserTokenValue PreParserToken t
t) 
                           𝑆 (PreParserToken t)
ts'
          ]
    loopAnchored  𝐼C (PreParserToken t)  LocRange  𝔹  𝔹  AddBT Loc  𝐿 (AddBT Loc)  𝑆 (PreParserToken t)  𝐼C (PreParserToken t)
    loopAnchored :: 𝐼C (PreParserToken t)
-> LocRange
-> Bool
-> Bool
-> AddBT Loc
-> 𝐿 (AddBT Loc)
-> 𝑆 (PreParserToken t)
-> 𝐼C (PreParserToken t)
loopAnchored 𝐼C (PreParserToken t)
prefix LocRange
prefixLocRangeBumped Bool
isFreshBlock Bool
isAfterNewline AddBT Loc
anchor 𝐿 (AddBT Loc)
anchors 𝑆 (PreParserToken t)
ts = case 𝑆 (PreParserToken t)
-> () -> 𝑂 (PreParserToken t ∧ 𝑆 (PreParserToken t))
forall a. 𝑆 a -> () -> 𝑂 (a ∧ 𝑆 a)
un𝑆 𝑆 (PreParserToken t)
ts () of
      𝑂 (PreParserToken t ∧ 𝑆 (PreParserToken t))
None  
        let loop'  𝐿 (AddBT Loc)  𝐼C (PreParserToken t)
            loop' :: 𝐿 (AddBT Loc) -> 𝐼C (PreParserToken t)
loop' 𝐿 (AddBT Loc)
anchors' =
              if 𝐿 (AddBT Loc)
anchors' 𝐿 (AddBT Loc) -> 𝐿 (AddBT Loc) -> Bool
forall a. Eq a => a -> a -> Bool
 𝐿 (AddBT Loc)
anchors₀
              then 𝐼C (PreParserToken t)
forall a. Null a => a
null
              else case 𝐿 (AddBT Loc)
anchors' of
                𝐿 (AddBT Loc)
Nil  𝐼C (PreParserToken t)
forall a. Null a => a
null
                (AddBT Loc
_ :& 𝐿 (AddBT Loc)
anchors'')  [𝐼C (PreParserToken t)] -> 𝐼C (PreParserToken t)
forall a t. (Monoid a, ToIter a t) => t -> a
concat
                  [ PreParserToken t -> 𝐼C (PreParserToken t)
forall a t. Single a t => a -> t
single (PreParserToken t -> 𝐼C (PreParserToken t))
-> PreParserToken t -> 𝐼C (PreParserToken t)
forall a b. (a -> b) -> a -> b
$ AddBT Loc -> IndentCommand -> PreParserToken t
syntheticToken (LocRange -> AddBT Loc
locRangeBegin LocRange
prefixLocRangeBumped) IndentCommand
CloseIC
                  , 𝐿 (AddBT Loc) -> 𝐼C (PreParserToken t)
loop' 𝐿 (AddBT Loc)
anchors''
                  ]
            -- () = pptrace $ ppHorizontal [ppBD $ ppString "COUNT",pretty $ count prefix]
        in [𝐼C (PreParserToken t)] -> 𝐼C (PreParserToken t)
forall a t. (Monoid a, ToIter a t) => t -> a
concat
          [ if Bool
isFreshBlock 
              then [𝐼C (PreParserToken t)] -> 𝐼C (PreParserToken t)
forall a t. (Monoid a, ToIter a t) => t -> a
concat
                [ PreParserToken t -> 𝐼C (PreParserToken t)
forall a t. Single a t => a -> t
single (PreParserToken t -> 𝐼C (PreParserToken t))
-> PreParserToken t -> 𝐼C (PreParserToken t)
forall a b. (a -> b) -> a -> b
$ AddBT Loc -> IndentCommand -> PreParserToken t
syntheticToken (LocRange -> AddBT Loc
locRangeBegin LocRange
prefixLocRangeBumped) IndentCommand
OpenIC 
                , PreParserToken t -> 𝐼C (PreParserToken t)
forall a t. Single a t => a -> t
single (PreParserToken t -> 𝐼C (PreParserToken t))
-> PreParserToken t -> 𝐼C (PreParserToken t)
forall a b. (a -> b) -> a -> b
$ AddBT Loc -> IndentCommand -> PreParserToken t
syntheticToken (LocRange -> AddBT Loc
locRangeBegin LocRange
prefixLocRangeBumped) IndentCommand
CloseIC 
                ]
              else
              𝐼C (PreParserToken t)
forall a. Null a => a
null
          , 𝐿 (AddBT Loc) -> 𝐼C (PreParserToken t)
loop' (AddBT Loc
anchor AddBT Loc -> 𝐿 (AddBT Loc) -> 𝐿 (AddBT Loc)
forall a. a -> 𝐿 a -> 𝐿 a
:& 𝐿 (AddBT Loc)
anchors) 
          , 𝐼C (PreParserToken t)
prefix
          ]
      Some (PreParserToken t
t :* 𝑆 (PreParserToken t)
ts')  
        let locₜ :: AddBT Loc
locₜ = LocRange -> AddBT Loc
locRangeBegin (LocRange -> AddBT Loc) -> LocRange -> AddBT Loc
forall a b. (a -> b) -> a -> b
$ ParserContext -> LocRange
parserContextLocRange (ParserContext -> LocRange) -> ParserContext -> LocRange
forall a b. (a -> b) -> a -> b
$ PreParserToken t -> ParserContext
forall t. PreParserToken t -> ParserContext
preParserTokenContext PreParserToken t
t
            prefixLocRangeBumpedEnd :: AddBT Loc
prefixLocRangeBumpedEnd = LocRange -> AddBT Loc
locRangeEnd LocRange
prefixLocRangeBumped
            prefixLocRangeBumpedBegin :: AddBT Loc
prefixLocRangeBumpedBegin = LocRange -> AddBT Loc
locRangeBegin LocRange
prefixLocRangeBumped
            recordTokenKeepGoing  𝐼C (PreParserToken t)  LocRange  𝔹  𝐼C (PreParserToken t)
            recordTokenKeepGoing :: 𝐼C (PreParserToken t) -> LocRange -> Bool -> 𝐼C (PreParserToken t)
recordTokenKeepGoing 𝐼C (PreParserToken t)
prefix' LocRange
prefixLocRangeBumped' Bool
weHaveANewAnchor = 
              let prefixLocRangeBumpedEnd' :: AddBT Loc
prefixLocRangeBumpedEnd' = LocRange -> AddBT Loc
locRangeEnd LocRange
prefixLocRangeBumped'
                  AddBT Loc
anchor' :* 𝐿 (AddBT Loc)
anchors' = 
                    if Bool
weHaveANewAnchor 
                    --
                    --     anchor ->| <block> <token>
                    --                        ^^^^^^^
                    --                        (new anchor)
                    --
                    then AddBT Loc
locₜ AddBT Loc -> 𝐿 (AddBT Loc) -> AddBT Loc ∧ 𝐿 (AddBT Loc)
forall a b. a -> b -> a ∧ b
:* (AddBT Loc
anchor AddBT Loc -> 𝐿 (AddBT Loc) -> 𝐿 (AddBT Loc)
forall a. a -> 𝐿 a -> 𝐿 a
:& 𝐿 (AddBT Loc)
anchors)
                    --
                    --     anchor ->|... <token>
                    --                   ^^^^^^^
                    else AddBT Loc
anchor AddBT Loc -> 𝐿 (AddBT Loc) -> AddBT Loc ∧ 𝐿 (AddBT Loc)
forall a b. a -> b -> a ∧ b
:* 𝐿 (AddBT Loc)
anchors
              in [𝐼C (PreParserToken t)] -> 𝐼C (PreParserToken t)
forall a t. (Monoid a, ToIter a t) => t -> a
concat
                -- record the prefix
                [ 𝐼C (PreParserToken t)
prefix'
                -- record an “open” if we have a new anchor
                , if Bool
weHaveANewAnchor then PreParserToken t -> 𝐼C (PreParserToken t)
forall a t. Single a t => a -> t
single (PreParserToken t -> 𝐼C (PreParserToken t))
-> PreParserToken t -> 𝐼C (PreParserToken t)
forall a b. (a -> b) -> a -> b
$ AddBT Loc -> IndentCommand -> PreParserToken t
syntheticToken AddBT Loc
prefixLocRangeBumpedEnd' IndentCommand
OpenIC else 𝐼C (PreParserToken t)
forall a. Null a => a
null
                -- record the token
                , PreParserToken t -> 𝐼C (PreParserToken t)
forall a t. Single a t => a -> t
single PreParserToken t
t
                -- keep going with new anchor
                , 𝐼C (PreParserToken t)
-> LocRange
-> Bool
-> Bool
-> AddBT Loc
-> 𝐿 (AddBT Loc)
-> 𝑆 (PreParserToken t)
-> 𝐼C (PreParserToken t)
loopAnchored 𝐼C (PreParserToken t)
forall a. Null a => a
null 
                               (AddBT Loc -> AddBT Loc -> LocRange
LocRange AddBT Loc
prefixLocRangeBumpedEnd' AddBT Loc
prefixLocRangeBumpedEnd') 
                               (t -> Bool
isBlock (t -> Bool) -> t -> Bool
forall a b. (a -> b) -> a -> b
$ PreParserToken t -> t
forall t. PreParserToken t -> t
preParserTokenValue PreParserToken t
t) 
                               Bool
False 
                               AddBT Loc
anchor' 
                               𝐿 (AddBT Loc)
anchors' 
                               𝑆 (PreParserToken t)
ts'
                ]
        in
        if 
        | PreParserToken t -> Bool
forall t. PreParserToken t -> Bool
preParserTokenSkip PreParserToken t
t 
         -- this is a skip token; add it to the list
         𝐼C (PreParserToken t)
-> LocRange
-> Bool
-> Bool
-> AddBT Loc
-> 𝐿 (AddBT Loc)
-> 𝑆 (PreParserToken t)
-> 𝐼C (PreParserToken t)
loopAnchored (𝐼C (PreParserToken t)
prefix 𝐼C (PreParserToken t)
-> 𝐼C (PreParserToken t) -> 𝐼C (PreParserToken t)
forall a. Append a => a -> a -> a
 PreParserToken t -> 𝐼C (PreParserToken t)
forall a t. Single a t => a -> t
single PreParserToken t
t) 
                      (LocRange
prefixLocRangeBumped LocRange -> LocRange -> LocRange
forall a. Join a => a -> a -> a
 LocRange -> LocRange
bumpColEnd₂ (ParserContext -> LocRange
parserContextLocRange (ParserContext -> LocRange) -> ParserContext -> LocRange
forall a b. (a -> b) -> a -> b
$ PreParserToken t -> ParserContext
forall t. PreParserToken t -> ParserContext
preParserTokenContext PreParserToken t
t)) 
                      Bool
isFreshBlock 
                      (Bool
isAfterNewline Bool -> Bool -> Bool
 t -> Bool
isNewline (PreParserToken t -> t
forall t. PreParserToken t -> t
preParserTokenValue PreParserToken t
t)) 
                      AddBT Loc
anchor 
                      𝐿 (AddBT Loc)
anchors 
                      𝑆 (PreParserToken t)
ts'
        | {- not (parserTokenSkip t) ⩓ -} 
          Bool -> Bool
not Bool
isAfterNewline  
            --
            --     anchor ->|... <token>
            --                   ^^^^^^^
            --     OR
            --
            --     anchor ->|...
            --         ... ... <token>
            --                 ^^^^^^^
            -- continue as normal
            𝐼C (PreParserToken t) -> LocRange -> Bool -> 𝐼C (PreParserToken t)
recordTokenKeepGoing 𝐼C (PreParserToken t)
prefix LocRange
prefixLocRangeBumped Bool
isFreshBlock
        | {- not (parserTokenSkip t) ⩓ isAfterNewline ⩓ -} 
          (Loc -> ℕ64) -> AddBT Loc -> AddBT ℕ64
forall a b. (a -> b) -> AddBT a -> AddBT b
forall (t :: * -> *) a b. Functor t => (a -> b) -> t a -> t b
map Loc -> ℕ64
locCol AddBT Loc
locₜ AddBT ℕ64 -> AddBT ℕ64 -> Bool
forall a. Ord a => a -> a -> Bool
> (Loc -> ℕ64) -> AddBT Loc -> AddBT ℕ64
forall a b. (a -> b) -> AddBT a -> AddBT b
forall (t :: * -> *) a b. Functor t => (a -> b) -> t a -> t b
map Loc -> ℕ64
locCol AddBT Loc
anchor 
            --
            --     anchor ->|...
            --                  <token>
            --                  ^^^^^^^
            -- continue as normal
            𝐼C (PreParserToken t) -> LocRange -> Bool -> 𝐼C (PreParserToken t)
recordTokenKeepGoing 𝐼C (PreParserToken t)
prefix LocRange
prefixLocRangeBumped Bool
isFreshBlock
        | {- not (parserTokenSkip t) ⩓ isAfterNewline ⩓ -} 
          (Loc -> ℕ64) -> AddBT Loc -> AddBT ℕ64
forall a b. (a -> b) -> AddBT a -> AddBT b
forall (t :: * -> *) a b. Functor t => (a -> b) -> t a -> t b
map Loc -> ℕ64
locCol AddBT Loc
locₜ AddBT ℕ64 -> AddBT ℕ64 -> Bool
forall a. Eq a => a -> a -> Bool
 (Loc -> ℕ64) -> AddBT Loc -> AddBT ℕ64
forall a b. (a -> b) -> AddBT a -> AddBT b
forall (t :: * -> *) a b. Functor t => (a -> b) -> t a -> t b
map Loc -> ℕ64
locCol AddBT Loc
anchor  [𝐼C (PreParserToken t)] -> 𝐼C (PreParserToken t)
forall a t. (Monoid a, ToIter a t) => t -> a
concat
          --
          --     anchor ->|...
          --               <token>
          --               ^^^^^^^
          -- this is logically a “newline”
          -- if we just opened a new block, open and close it
          [ if Bool
isFreshBlock 
            then [𝐼C (PreParserToken t)] -> 𝐼C (PreParserToken t)
forall a t. (Monoid a, ToIter a t) => t -> a
concat
              [ PreParserToken t -> 𝐼C (PreParserToken t)
forall a t. Single a t => a -> t
single (PreParserToken t -> 𝐼C (PreParserToken t))
-> PreParserToken t -> 𝐼C (PreParserToken t)
forall a b. (a -> b) -> a -> b
$ AddBT Loc -> IndentCommand -> PreParserToken t
syntheticToken AddBT Loc
prefixLocRangeBumpedBegin IndentCommand
OpenIC 
              , PreParserToken t -> 𝐼C (PreParserToken t)
forall a t. Single a t => a -> t
single (PreParserToken t -> 𝐼C (PreParserToken t))
-> PreParserToken t -> 𝐼C (PreParserToken t)
forall a b. (a -> b) -> a -> b
$ AddBT Loc -> IndentCommand -> PreParserToken t
syntheticToken AddBT Loc
prefixLocRangeBumpedBegin IndentCommand
CloseIC 
              ]
            else 𝐼C (PreParserToken t)
forall a. Null a => a
null
          -- record the prefix
          , 𝐼C (PreParserToken t)
prefix
          -- record a “newline”
          , PreParserToken t -> 𝐼C (PreParserToken t)
forall a t. Single a t => a -> t
single (PreParserToken t -> 𝐼C (PreParserToken t))
-> PreParserToken t -> 𝐼C (PreParserToken t)
forall a b. (a -> b) -> a -> b
$ AddBT Loc -> IndentCommand -> PreParserToken t
syntheticToken AddBT Loc
prefixLocRangeBumpedEnd IndentCommand
NewlineIC
          -- keep going
          , 𝐼C (PreParserToken t) -> LocRange -> Bool -> 𝐼C (PreParserToken t)
recordTokenKeepGoing 𝐼C (PreParserToken t)
forall a. Null a => a
null (AddBT Loc -> AddBT Loc -> LocRange
LocRange AddBT Loc
prefixLocRangeBumpedEnd AddBT Loc
prefixLocRangeBumpedEnd) Bool
False
          ]
        | {- not (parserTokenSkip t) ⩓ isAfterNewline ⩓ -} 
          (Loc -> ℕ64) -> AddBT Loc -> AddBT ℕ64
forall a b. (a -> b) -> AddBT a -> AddBT b
forall (t :: * -> *) a b. Functor t => (a -> b) -> t a -> t b
map Loc -> ℕ64
locCol AddBT Loc
locₜ AddBT ℕ64 -> AddBT ℕ64 -> Bool
forall a. Ord a => a -> a -> Bool
< (Loc -> ℕ64) -> AddBT Loc -> AddBT ℕ64
forall a b. (a -> b) -> AddBT a -> AddBT b
forall (t :: * -> *) a b. Functor t => (a -> b) -> t a -> t b
map Loc -> ℕ64
locCol AddBT Loc
anchor  [𝐼C (PreParserToken t)] -> 𝐼C (PreParserToken t)
forall a t. (Monoid a, ToIter a t) => t -> a
concat
          --
          --     anchor ->|...
          --         <token>
          --         ^^^^^^^
          -- this is logically a “close”
          -- if we just opened a new block, close it
          [ if Bool
isFreshBlock 
            then [𝐼C (PreParserToken t)] -> 𝐼C (PreParserToken t)
forall a t. (Monoid a, ToIter a t) => t -> a
concat
              [ PreParserToken t -> 𝐼C (PreParserToken t)
forall a t. Single a t => a -> t
single (PreParserToken t -> 𝐼C (PreParserToken t))
-> PreParserToken t -> 𝐼C (PreParserToken t)
forall a b. (a -> b) -> a -> b
$ AddBT Loc -> IndentCommand -> PreParserToken t
syntheticToken AddBT Loc
prefixLocRangeBumpedBegin IndentCommand
OpenIC 
              , PreParserToken t -> 𝐼C (PreParserToken t)
forall a t. Single a t => a -> t
single (PreParserToken t -> 𝐼C (PreParserToken t))
-> PreParserToken t -> 𝐼C (PreParserToken t)
forall a b. (a -> b) -> a -> b
$ AddBT Loc -> IndentCommand -> PreParserToken t
syntheticToken AddBT Loc
prefixLocRangeBumpedBegin IndentCommand
CloseIC 
              ]
            else 𝐼C (PreParserToken t)
forall a. Null a => a
null
          -- record a “close”
          , PreParserToken t -> 𝐼C (PreParserToken t)
forall a t. Single a t => a -> t
single (PreParserToken t -> 𝐼C (PreParserToken t))
-> PreParserToken t -> 𝐼C (PreParserToken t)
forall a b. (a -> b) -> a -> b
$ AddBT Loc -> IndentCommand -> PreParserToken t
syntheticToken AddBT Loc
prefixLocRangeBumpedBegin IndentCommand
CloseIC
          -- restart this token with new anchor 
          , 𝐼C (PreParserToken t)
-> LocRange
-> Bool
-> Bool
-> 𝐿 (AddBT Loc)
-> 𝑆 (PreParserToken t)
-> 𝐼C (PreParserToken t)
loop 𝐼C (PreParserToken t)
prefix LocRange
prefixLocRangeBumped Bool
False Bool
isAfterNewline 𝐿 (AddBT Loc)
anchors 𝑆 (PreParserToken t)
ts
          ]
        | Bool
otherwise  𝕊 -> 𝐼C (PreParserToken t)
forall a. STACK => 𝕊 -> a
error 𝕊
"impossible"

blockifyTokensTL  (t  𝔹)  (t  𝔹)  (IndentCommand  t)  𝕍 (PreParserToken t)  𝕍 (PreParserToken t)
blockifyTokensTL :: forall t.
(t -> Bool)
-> (t -> Bool)
-> (IndentCommand -> t)
-> 𝕍 (PreParserToken t)
-> 𝕍 (PreParserToken t)
blockifyTokensTL = 𝐿 (AddBT Loc)
-> (t -> Bool)
-> (t -> Bool)
-> (IndentCommand -> t)
-> 𝕍 (PreParserToken t)
-> 𝕍 (PreParserToken t)
forall t.
𝐿 (AddBT Loc)
-> (t -> Bool)
-> (t -> Bool)
-> (IndentCommand -> t)
-> 𝕍 (PreParserToken t)
-> 𝕍 (PreParserToken t)
blockifyTokens (𝐿 (AddBT Loc)
 -> (t -> Bool)
 -> (t -> Bool)
 -> (IndentCommand -> t)
 -> 𝕍 (PreParserToken t)
 -> 𝕍 (PreParserToken t))
-> 𝐿 (AddBT Loc)
-> (t -> Bool)
-> (t -> Bool)
-> (IndentCommand -> t)
-> 𝕍 (PreParserToken t)
-> 𝕍 (PreParserToken t)
forall a b. (a -> b) -> a -> b
$ AddBT Loc -> 𝐿 (AddBT Loc)
forall a t. Single a t => a -> t
single (AddBT Loc -> 𝐿 (AddBT Loc)) -> AddBT Loc -> 𝐿 (AddBT Loc)
forall a b. (a -> b) -> a -> b
$ Loc -> AddBT Loc
forall a. a -> AddBT a
AddBT Loc
forall a. Bot a => a
bot

-- The Language --

data TokenClassWSBasic =
    SpaceCWSBasic
  | NewlineCWSBasic
  | CommentCWSBasic
  | SyntaxCWSBasic
  | BlockCWSBasic
  | StringCWSBasic
  | NameCWSBasic
  | NaturalCWSBasic
  | IntegerCWSBasic
  | DoubleCWSBasic
  deriving (TokenClassWSBasic -> TokenClassWSBasic -> Bool
(TokenClassWSBasic -> TokenClassWSBasic -> Bool)
-> (TokenClassWSBasic -> TokenClassWSBasic -> Bool)
-> Eq TokenClassWSBasic
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TokenClassWSBasic -> TokenClassWSBasic -> Bool
== :: TokenClassWSBasic -> TokenClassWSBasic -> Bool
$c/= :: TokenClassWSBasic -> TokenClassWSBasic -> Bool
/= :: TokenClassWSBasic -> TokenClassWSBasic -> Bool
Eq,Eq TokenClassWSBasic
Eq TokenClassWSBasic =>
(TokenClassWSBasic -> TokenClassWSBasic -> Ordering)
-> (TokenClassWSBasic -> TokenClassWSBasic -> Bool)
-> (TokenClassWSBasic -> TokenClassWSBasic -> Bool)
-> (TokenClassWSBasic -> TokenClassWSBasic -> Bool)
-> (TokenClassWSBasic -> TokenClassWSBasic -> Bool)
-> (TokenClassWSBasic -> TokenClassWSBasic -> TokenClassWSBasic)
-> (TokenClassWSBasic -> TokenClassWSBasic -> TokenClassWSBasic)
-> Ord TokenClassWSBasic
TokenClassWSBasic -> TokenClassWSBasic -> Bool
TokenClassWSBasic -> TokenClassWSBasic -> Ordering
TokenClassWSBasic -> TokenClassWSBasic -> TokenClassWSBasic
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: TokenClassWSBasic -> TokenClassWSBasic -> Ordering
compare :: TokenClassWSBasic -> TokenClassWSBasic -> Ordering
$c< :: TokenClassWSBasic -> TokenClassWSBasic -> Bool
< :: TokenClassWSBasic -> TokenClassWSBasic -> Bool
$c<= :: TokenClassWSBasic -> TokenClassWSBasic -> Bool
<= :: TokenClassWSBasic -> TokenClassWSBasic -> Bool
$c> :: TokenClassWSBasic -> TokenClassWSBasic -> Bool
> :: TokenClassWSBasic -> TokenClassWSBasic -> Bool
$c>= :: TokenClassWSBasic -> TokenClassWSBasic -> Bool
>= :: TokenClassWSBasic -> TokenClassWSBasic -> Bool
$cmax :: TokenClassWSBasic -> TokenClassWSBasic -> TokenClassWSBasic
max :: TokenClassWSBasic -> TokenClassWSBasic -> TokenClassWSBasic
$cmin :: TokenClassWSBasic -> TokenClassWSBasic -> TokenClassWSBasic
min :: TokenClassWSBasic -> TokenClassWSBasic -> TokenClassWSBasic
Ord,Int -> TokenClassWSBasic -> ShowS
[TokenClassWSBasic] -> ShowS
TokenClassWSBasic -> [ℂ]
(Int -> TokenClassWSBasic -> ShowS)
-> (TokenClassWSBasic -> [ℂ])
-> ([TokenClassWSBasic] -> ShowS)
-> Show TokenClassWSBasic
forall a.
(Int -> a -> ShowS) -> (a -> [ℂ]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TokenClassWSBasic -> ShowS
showsPrec :: Int -> TokenClassWSBasic -> ShowS
$cshow :: TokenClassWSBasic -> [ℂ]
show :: TokenClassWSBasic -> [ℂ]
$cshowList :: [TokenClassWSBasic] -> ShowS
showList :: [TokenClassWSBasic] -> ShowS
Show)
makePrisms ''TokenClassWSBasic
makePrettySum ''TokenClassWSBasic

data TokenWSBasic =
    SpaceTWSBasic 𝕊
  | NewlineTWSBasic 𝕊
  | CommentTWSBasic 𝕊
  | SyntaxTWSBasic 𝕊
  | BlockTWSBasic 𝕊
  | StringTWSBasic 𝕊
  | NameTWSBasic 𝕊
  | NaturalTWSBasic 
  | IntegerTWSBasic 
  | DoubleTWSBasic 𝔻
  | OpenTWSBasic
  | CloseTWSBasic
  | DelimiterTWSBasic
  deriving (TokenWSBasic -> TokenWSBasic -> Bool
(TokenWSBasic -> TokenWSBasic -> Bool)
-> (TokenWSBasic -> TokenWSBasic -> Bool) -> Eq TokenWSBasic
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TokenWSBasic -> TokenWSBasic -> Bool
== :: TokenWSBasic -> TokenWSBasic -> Bool
$c/= :: TokenWSBasic -> TokenWSBasic -> Bool
/= :: TokenWSBasic -> TokenWSBasic -> Bool
Eq,Eq TokenWSBasic
Eq TokenWSBasic =>
(TokenWSBasic -> TokenWSBasic -> Ordering)
-> (TokenWSBasic -> TokenWSBasic -> Bool)
-> (TokenWSBasic -> TokenWSBasic -> Bool)
-> (TokenWSBasic -> TokenWSBasic -> Bool)
-> (TokenWSBasic -> TokenWSBasic -> Bool)
-> (TokenWSBasic -> TokenWSBasic -> TokenWSBasic)
-> (TokenWSBasic -> TokenWSBasic -> TokenWSBasic)
-> Ord TokenWSBasic
TokenWSBasic -> TokenWSBasic -> Bool
TokenWSBasic -> TokenWSBasic -> Ordering
TokenWSBasic -> TokenWSBasic -> TokenWSBasic
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: TokenWSBasic -> TokenWSBasic -> Ordering
compare :: TokenWSBasic -> TokenWSBasic -> Ordering
$c< :: TokenWSBasic -> TokenWSBasic -> Bool
< :: TokenWSBasic -> TokenWSBasic -> Bool
$c<= :: TokenWSBasic -> TokenWSBasic -> Bool
<= :: TokenWSBasic -> TokenWSBasic -> Bool
$c> :: TokenWSBasic -> TokenWSBasic -> Bool
> :: TokenWSBasic -> TokenWSBasic -> Bool
$c>= :: TokenWSBasic -> TokenWSBasic -> Bool
>= :: TokenWSBasic -> TokenWSBasic -> Bool
$cmax :: TokenWSBasic -> TokenWSBasic -> TokenWSBasic
max :: TokenWSBasic -> TokenWSBasic -> TokenWSBasic
$cmin :: TokenWSBasic -> TokenWSBasic -> TokenWSBasic
min :: TokenWSBasic -> TokenWSBasic -> TokenWSBasic
Ord,Int -> TokenWSBasic -> ShowS
[TokenWSBasic] -> ShowS
TokenWSBasic -> [ℂ]
(Int -> TokenWSBasic -> ShowS)
-> (TokenWSBasic -> [ℂ])
-> ([TokenWSBasic] -> ShowS)
-> Show TokenWSBasic
forall a.
(Int -> a -> ShowS) -> (a -> [ℂ]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TokenWSBasic -> ShowS
showsPrec :: Int -> TokenWSBasic -> ShowS
$cshow :: TokenWSBasic -> [ℂ]
show :: TokenWSBasic -> [ℂ]
$cshowList :: [TokenWSBasic] -> ShowS
showList :: [TokenWSBasic] -> ShowS
Show)
makePrisms ''TokenWSBasic
makePrettySum ''TokenWSBasic

mkTokenWSBasic  𝐼C   𝑂 TokenClassWSBasic  𝔹  TokenWSBasic
mkTokenWSBasic :: 𝐼C ℂ -> 𝑂 TokenClassWSBasic -> Bool ∧ TokenWSBasic
mkTokenWSBasic 𝐼C ℂ
cs = \case
  𝑂 TokenClassWSBasic
None  𝕊 -> Bool ∧ TokenWSBasic
forall a. STACK => 𝕊 -> a
error 𝕊
"no token class"
  Some TokenClassWSBasic
SpaceCWSBasic  Bool -> TokenWSBasic -> Bool ∧ TokenWSBasic
forall a b. a -> b -> a ∧ b
(:*) Bool
True (TokenWSBasic -> Bool ∧ TokenWSBasic)
-> TokenWSBasic -> Bool ∧ TokenWSBasic
forall a b. (a -> b) -> a -> b
$ 𝕊 -> TokenWSBasic
SpaceTWSBasic (𝕊 -> TokenWSBasic) -> 𝕊 -> TokenWSBasic
forall a b. (a -> b) -> a -> b
$ 𝐼C ℂ -> 𝕊
forall t. (ToIter ℂ t, CSized t) => t -> 𝕊
stringCS 𝐼C ℂ
cs
  Some TokenClassWSBasic
NewlineCWSBasic  Bool -> TokenWSBasic -> Bool ∧ TokenWSBasic
forall a b. a -> b -> a ∧ b
(:*) Bool
True (TokenWSBasic -> Bool ∧ TokenWSBasic)
-> TokenWSBasic -> Bool ∧ TokenWSBasic
forall a b. (a -> b) -> a -> b
$ 𝕊 -> TokenWSBasic
NewlineTWSBasic (𝕊 -> TokenWSBasic) -> 𝕊 -> TokenWSBasic
forall a b. (a -> b) -> a -> b
$ 𝐼C ℂ -> 𝕊
forall t. (ToIter ℂ t, CSized t) => t -> 𝕊
stringCS 𝐼C ℂ
cs
  Some TokenClassWSBasic
CommentCWSBasic  Bool -> TokenWSBasic -> Bool ∧ TokenWSBasic
forall a b. a -> b -> a ∧ b
(:*) Bool
True (TokenWSBasic -> Bool ∧ TokenWSBasic)
-> TokenWSBasic -> Bool ∧ TokenWSBasic
forall a b. (a -> b) -> a -> b
$ 𝕊 -> TokenWSBasic
CommentTWSBasic (𝕊 -> TokenWSBasic) -> 𝕊 -> TokenWSBasic
forall a b. (a -> b) -> a -> b
$ 𝐼C ℂ -> 𝕊
forall t. (ToIter ℂ t, CSized t) => t -> 𝕊
stringCS 𝐼C ℂ
cs
  Some TokenClassWSBasic
SyntaxCWSBasic  Bool -> TokenWSBasic -> Bool ∧ TokenWSBasic
forall a b. a -> b -> a ∧ b
(:*) Bool
False (TokenWSBasic -> Bool ∧ TokenWSBasic)
-> TokenWSBasic -> Bool ∧ TokenWSBasic
forall a b. (a -> b) -> a -> b
$ 𝕊 -> TokenWSBasic
SyntaxTWSBasic (𝕊 -> TokenWSBasic) -> 𝕊 -> TokenWSBasic
forall a b. (a -> b) -> a -> b
$ 𝐼C ℂ -> 𝕊
forall t. (ToIter ℂ t, CSized t) => t -> 𝕊
stringCS 𝐼C ℂ
cs
  Some TokenClassWSBasic
BlockCWSBasic  Bool -> TokenWSBasic -> Bool ∧ TokenWSBasic
forall a b. a -> b -> a ∧ b
(:*) Bool
False (TokenWSBasic -> Bool ∧ TokenWSBasic)
-> TokenWSBasic -> Bool ∧ TokenWSBasic
forall a b. (a -> b) -> a -> b
$ 𝕊 -> TokenWSBasic
BlockTWSBasic (𝕊 -> TokenWSBasic) -> 𝕊 -> TokenWSBasic
forall a b. (a -> b) -> a -> b
$ 𝐼C ℂ -> 𝕊
forall t. (ToIter ℂ t, CSized t) => t -> 𝕊
stringCS 𝐼C ℂ
cs
  Some TokenClassWSBasic
StringCWSBasic  Bool -> TokenWSBasic -> Bool ∧ TokenWSBasic
forall a b. a -> b -> a ∧ b
(:*) Bool
False (TokenWSBasic -> Bool ∧ TokenWSBasic)
-> TokenWSBasic -> Bool ∧ TokenWSBasic
forall a b. (a -> b) -> a -> b
$ 𝕊 -> TokenWSBasic
StringTWSBasic (𝕊 -> TokenWSBasic) -> 𝕊 -> TokenWSBasic
forall a b. (a -> b) -> a -> b
$ 𝕊 -> 𝕊
forall a. Read a => 𝕊 -> a
read𝕊 (𝕊 -> 𝕊) -> 𝕊 -> 𝕊
forall a b. (a -> b) -> a -> b
$ 𝐼C ℂ -> 𝕊
forall t. (ToIter ℂ t, CSized t) => t -> 𝕊
stringCS 𝐼C ℂ
cs
  Some TokenClassWSBasic
NameCWSBasic  Bool -> TokenWSBasic -> Bool ∧ TokenWSBasic
forall a b. a -> b -> a ∧ b
(:*) Bool
False (TokenWSBasic -> Bool ∧ TokenWSBasic)
-> TokenWSBasic -> Bool ∧ TokenWSBasic
forall a b. (a -> b) -> a -> b
$ 𝕊 -> TokenWSBasic
NameTWSBasic (𝕊 -> TokenWSBasic) -> 𝕊 -> TokenWSBasic
forall a b. (a -> b) -> a -> b
$ 𝐼C ℂ -> 𝕊
forall t. (ToIter ℂ t, CSized t) => t -> 𝕊
stringCS 𝐼C ℂ
cs
  Some TokenClassWSBasic
NaturalCWSBasic  Bool -> TokenWSBasic -> Bool ∧ TokenWSBasic
forall a b. a -> b -> a ∧ b
(:*) Bool
False (TokenWSBasic -> Bool ∧ TokenWSBasic)
-> TokenWSBasic -> Bool ∧ TokenWSBasic
forall a b. (a -> b) -> a -> b
$ ℕ -> TokenWSBasic
NaturalTWSBasic (ℕ -> TokenWSBasic) -> ℕ -> TokenWSBasic
forall a b. (a -> b) -> a -> b
$ 𝕊 -> ℕ
forall a. Read a => 𝕊 -> a
read𝕊 (𝕊 -> ℕ) -> 𝕊 -> ℕ
forall a b. (a -> b) -> a -> b
$ 𝐼 ℂ -> 𝕊
forall t. ToIter ℂ t => t -> 𝕊
string (𝐼 ℂ -> 𝕊) -> 𝐼 ℂ -> 𝕊
forall a b. (a -> b) -> a -> b
$ (ℂ -> Bool) -> 𝐼C ℂ -> 𝐼 ℂ
forall a t. ToIter a t => (a -> Bool) -> t -> 𝐼 a
filter (\ c  c ℂ -> 𝑃 ℂ -> Bool
forall e s. Set e s => e -> s -> Bool
 [ℂ] -> 𝑃 ℂ
forall a t. (Ord a, ToIter a t) => t -> 𝑃 a
pow𝑃 ['_','n']) 𝐼C ℂ
cs
  Some TokenClassWSBasic
IntegerCWSBasic  Bool -> TokenWSBasic -> Bool ∧ TokenWSBasic
forall a b. a -> b -> a ∧ b
(:*) Bool
False (TokenWSBasic -> Bool ∧ TokenWSBasic)
-> TokenWSBasic -> Bool ∧ TokenWSBasic
forall a b. (a -> b) -> a -> b
$ ℤ -> TokenWSBasic
IntegerTWSBasic (ℤ -> TokenWSBasic) -> ℤ -> TokenWSBasic
forall a b. (a -> b) -> a -> b
$ 𝕊 -> ℤ
forall a. Read a => 𝕊 -> a
read𝕊 (𝕊 -> ℤ) -> 𝕊 -> ℤ
forall a b. (a -> b) -> a -> b
$ 𝐼 ℂ -> 𝕊
forall t. ToIter ℂ t => t -> 𝕊
string (𝐼 ℂ -> 𝕊) -> 𝐼 ℂ -> 𝕊
forall a b. (a -> b) -> a -> b
$ (ℂ -> Bool) -> 𝐼C ℂ -> 𝐼 ℂ
forall a t. ToIter a t => (a -> Bool) -> t -> 𝐼 a
filter (ℂ -> ℂ -> Bool
forall a. Eq a => a -> a -> Bool
(≢) '_') 𝐼C ℂ
cs
  Some TokenClassWSBasic
DoubleCWSBasic  Bool -> TokenWSBasic -> Bool ∧ TokenWSBasic
forall a b. a -> b -> a ∧ b
(:*) Bool
False (TokenWSBasic -> Bool ∧ TokenWSBasic)
-> TokenWSBasic -> Bool ∧ TokenWSBasic
forall a b. (a -> b) -> a -> b
$ 𝔻 -> TokenWSBasic
DoubleTWSBasic (𝔻 -> TokenWSBasic) -> 𝔻 -> TokenWSBasic
forall a b. (a -> b) -> a -> b
$ 𝕊 -> 𝔻
forall a. Read a => 𝕊 -> a
read𝕊 (𝕊 -> 𝔻) -> 𝕊 -> 𝔻
forall a b. (a -> b) -> a -> b
$ 𝐼 ℂ -> 𝕊
forall t. ToIter ℂ t => t -> 𝕊
string (𝐼 ℂ -> 𝕊) -> 𝐼 ℂ -> 𝕊
forall a b. (a -> b) -> a -> b
$ (ℂ -> Bool) -> 𝐼C ℂ -> 𝐼 ℂ
forall a t. ToIter a t => (a -> Bool) -> t -> 𝐼 a
filter (ℂ -> ℂ -> Bool
forall a. Eq a => a -> a -> Bool
(≢) '_') 𝐼C ℂ
cs

lSyntaxWSBasic  (Ord u,Additive u)  𝐿 𝕊  𝐿 𝕊  𝐿 𝕊  𝐿 𝕊  Regex CharClass  TokenClassWSBasic u
lSyntaxWSBasic :: forall u.
(Ord u, Additive u) =>
𝐿 𝕊 -> 𝐿 𝕊 -> 𝐿 𝕊 -> 𝐿 𝕊 -> Regex CharClass ℂ TokenClassWSBasic u
lSyntaxWSBasic 𝐿 𝕊
puns 𝐿 𝕊
kws 𝐿 𝕊
prims 𝐿 𝕊
ops = [Regex CharClass ℂ TokenClassWSBasic u]
-> Regex CharClass ℂ TokenClassWSBasic u
forall a t. (Monoid a, ToIter a t) => t -> a
concat
  -- punctuation
  [ [Regex CharClass ℂ TokenClassWSBasic u]
-> Regex CharClass ℂ TokenClassWSBasic u
forall a t. (Seqoid a, ToIter a t) => t -> a
sequence
    [ 𝐿 (Regex CharClass ℂ TokenClassWSBasic u)
-> Regex CharClass ℂ TokenClassWSBasic u
forall a t. (Monoid a, ToIter a t) => t -> a
concat (𝐿 (Regex CharClass ℂ TokenClassWSBasic u)
 -> Regex CharClass ℂ TokenClassWSBasic u)
-> 𝐿 (Regex CharClass ℂ TokenClassWSBasic u)
-> Regex CharClass ℂ TokenClassWSBasic u
forall a b. (a -> b) -> a -> b
$ (𝕊 -> Regex CharClass ℂ TokenClassWSBasic u)
-> 𝐿 𝕊 -> 𝐿 (Regex CharClass ℂ TokenClassWSBasic u)
forall a b. (a -> b) -> 𝐿 a -> 𝐿 b
forall (t :: * -> *) a b. Functor t => (a -> b) -> t a -> t b
map 𝕊 -> Regex CharClass ℂ TokenClassWSBasic u
forall u o.
(Zero u, Ord o, Ord u, Additive u) =>
𝕊 -> Regex CharClass ℂ o u
lWord 𝐿 𝕊
puns
    , Formats -> Regex CharClass ℂ TokenClassWSBasic u
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
Formats -> Regex c t o u
fepsRegex (Formats -> Regex CharClass ℂ TokenClassWSBasic u)
-> Formats -> Regex CharClass ℂ TokenClassWSBasic u
forall a b. (a -> b) -> a -> b
$ [Format] -> Formats
forall t. ToIter Format t => t -> Formats
formats [Color -> Format
FG Color
grayDark]
    ]
  -- keywords
  , [Regex CharClass ℂ TokenClassWSBasic u]
-> Regex CharClass ℂ TokenClassWSBasic u
forall a t. (Seqoid a, ToIter a t) => t -> a
sequence
    [ 𝐿 (Regex CharClass ℂ TokenClassWSBasic u)
-> Regex CharClass ℂ TokenClassWSBasic u
forall a t. (Monoid a, ToIter a t) => t -> a
concat (𝐿 (Regex CharClass ℂ TokenClassWSBasic u)
 -> Regex CharClass ℂ TokenClassWSBasic u)
-> 𝐿 (Regex CharClass ℂ TokenClassWSBasic u)
-> Regex CharClass ℂ TokenClassWSBasic u
forall a b. (a -> b) -> a -> b
$ (𝕊 -> Regex CharClass ℂ TokenClassWSBasic u)
-> 𝐿 𝕊 -> 𝐿 (Regex CharClass ℂ TokenClassWSBasic u)
forall a b. (a -> b) -> 𝐿 a -> 𝐿 b
forall (t :: * -> *) a b. Functor t => (a -> b) -> t a -> t b
map 𝕊 -> Regex CharClass ℂ TokenClassWSBasic u
forall u o.
(Zero u, Ord o, Ord u, Additive u) =>
𝕊 -> Regex CharClass ℂ o u
lWord 𝐿 𝕊
kws
    , Formats -> Regex CharClass ℂ TokenClassWSBasic u
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
Formats -> Regex c t o u
fepsRegex (Formats -> Regex CharClass ℂ TokenClassWSBasic u)
-> Formats -> Regex CharClass ℂ TokenClassWSBasic u
forall a b. (a -> b) -> a -> b
$ [Format] -> Formats
forall t. ToIter Format t => t -> Formats
formats [Color -> Format
FG Color
yellow,Format
BD]
    ]
  -- primitives
  , [Regex CharClass ℂ TokenClassWSBasic u]
-> Regex CharClass ℂ TokenClassWSBasic u
forall a t. (Seqoid a, ToIter a t) => t -> a
sequence
    [ 𝐿 (Regex CharClass ℂ TokenClassWSBasic u)
-> Regex CharClass ℂ TokenClassWSBasic u
forall a t. (Monoid a, ToIter a t) => t -> a
concat (𝐿 (Regex CharClass ℂ TokenClassWSBasic u)
 -> Regex CharClass ℂ TokenClassWSBasic u)
-> 𝐿 (Regex CharClass ℂ TokenClassWSBasic u)
-> Regex CharClass ℂ TokenClassWSBasic u
forall a b. (a -> b) -> a -> b
$ (𝕊 -> Regex CharClass ℂ TokenClassWSBasic u)
-> 𝐿 𝕊 -> 𝐿 (Regex CharClass ℂ TokenClassWSBasic u)
forall a b. (a -> b) -> 𝐿 a -> 𝐿 b
forall (t :: * -> *) a b. Functor t => (a -> b) -> t a -> t b
map 𝕊 -> Regex CharClass ℂ TokenClassWSBasic u
forall u o.
(Zero u, Ord o, Ord u, Additive u) =>
𝕊 -> Regex CharClass ℂ o u
lWord 𝐿 𝕊
prims
    , Formats -> Regex CharClass ℂ TokenClassWSBasic u
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
Formats -> Regex c t o u
fepsRegex (Formats -> Regex CharClass ℂ TokenClassWSBasic u)
-> Formats -> Regex CharClass ℂ TokenClassWSBasic u
forall a b. (a -> b) -> a -> b
$ [Format] -> Formats
forall t. ToIter Format t => t -> Formats
formats [Color -> Format
FG Color
blue]
    ]
  -- operators
  , [Regex CharClass ℂ TokenClassWSBasic u]
-> Regex CharClass ℂ TokenClassWSBasic u
forall a t. (Seqoid a, ToIter a t) => t -> a
sequence
    [ 𝐿 (Regex CharClass ℂ TokenClassWSBasic u)
-> Regex CharClass ℂ TokenClassWSBasic u
forall a t. (Monoid a, ToIter a t) => t -> a
concat (𝐿 (Regex CharClass ℂ TokenClassWSBasic u)
 -> Regex CharClass ℂ TokenClassWSBasic u)
-> 𝐿 (Regex CharClass ℂ TokenClassWSBasic u)
-> Regex CharClass ℂ TokenClassWSBasic u
forall a b. (a -> b) -> a -> b
$ (𝕊 -> Regex CharClass ℂ TokenClassWSBasic u)
-> 𝐿 𝕊 -> 𝐿 (Regex CharClass ℂ TokenClassWSBasic u)
forall a b. (a -> b) -> 𝐿 a -> 𝐿 b
forall (t :: * -> *) a b. Functor t => (a -> b) -> t a -> t b
map 𝕊 -> Regex CharClass ℂ TokenClassWSBasic u
forall u o.
(Zero u, Ord o, Ord u, Additive u) =>
𝕊 -> Regex CharClass ℂ o u
lWord 𝐿 𝕊
ops
    , Formats -> Regex CharClass ℂ TokenClassWSBasic u
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
Formats -> Regex c t o u
fepsRegex (Formats -> Regex CharClass ℂ TokenClassWSBasic u)
-> Formats -> Regex CharClass ℂ TokenClassWSBasic u
forall a b. (a -> b) -> a -> b
$ [Format] -> Formats
forall t. ToIter Format t => t -> Formats
formats [Color -> Format
FG Color
teal]
    ]
  ]

lBlocksWSBasic  (Ord u,Additive u)  𝐿 𝕊  Regex CharClass  TokenClassWSBasic u
lBlocksWSBasic :: forall u.
(Ord u, Additive u) =>
𝐿 𝕊 -> Regex CharClass ℂ TokenClassWSBasic u
lBlocksWSBasic 𝐿 𝕊
blocks = [Regex CharClass ℂ TokenClassWSBasic u]
-> Regex CharClass ℂ TokenClassWSBasic u
forall a t. (Seqoid a, ToIter a t) => t -> a
sequence
  [ 𝐿 (Regex CharClass ℂ TokenClassWSBasic u)
-> Regex CharClass ℂ TokenClassWSBasic u
forall a t. (Monoid a, ToIter a t) => t -> a
concat (𝐿 (Regex CharClass ℂ TokenClassWSBasic u)
 -> Regex CharClass ℂ TokenClassWSBasic u)
-> 𝐿 (Regex CharClass ℂ TokenClassWSBasic u)
-> Regex CharClass ℂ TokenClassWSBasic u
forall a b. (a -> b) -> a -> b
$ (𝕊 -> Regex CharClass ℂ TokenClassWSBasic u)
-> 𝐿 𝕊 -> 𝐿 (Regex CharClass ℂ TokenClassWSBasic u)
forall a b. (a -> b) -> 𝐿 a -> 𝐿 b
forall (t :: * -> *) a b. Functor t => (a -> b) -> t a -> t b
map 𝕊 -> Regex CharClass ℂ TokenClassWSBasic u
forall u o.
(Zero u, Ord o, Ord u, Additive u) =>
𝕊 -> Regex CharClass ℂ o u
lWord 𝐿 𝕊
blocks
  , Formats -> Regex CharClass ℂ TokenClassWSBasic u
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
Formats -> Regex c t o u
fepsRegex (Formats -> Regex CharClass ℂ TokenClassWSBasic u)
-> Formats -> Regex CharClass ℂ TokenClassWSBasic u
forall a b. (a -> b) -> a -> b
$ [Format] -> Formats
forall t. ToIter Format t => t -> Formats
formats [Color -> Format
BG Color
white,Color -> Format
FG Color
yellow,Format
BD]
  ]

lTokenWSBasic  𝐿 𝕊  𝐿 𝕊  𝐿 𝕊  𝐿 𝕊  𝐿 𝕊  Regex CharClass  TokenClassWSBasic ℕ64
lTokenWSBasic :: 𝐿 𝕊
-> 𝐿 𝕊
-> 𝐿 𝕊
-> 𝐿 𝕊
-> 𝐿 𝕊
-> Regex CharClass ℂ TokenClassWSBasic ℕ64
lTokenWSBasic 𝐿 𝕊
puns 𝐿 𝕊
kws 𝐿 𝕊
prims 𝐿 𝕊
ops 𝐿 𝕊
blocks = [Regex CharClass ℂ TokenClassWSBasic ℕ64]
-> Regex CharClass ℂ TokenClassWSBasic ℕ64
forall a t. (Monoid a, ToIter a t) => t -> a
concat
  [ Regex CharClass ℂ TokenClassWSBasic ℕ64
forall u o.
(Zero u, Ord u, Ord o, Additive u) =>
Regex CharClass ℂ o u
lNatCoded                         Regex CharClass ℂ TokenClassWSBasic ℕ64
-> Regex CharClass ℂ TokenClassWSBasic ℕ64
-> Regex CharClass ℂ TokenClassWSBasic ℕ64
forall a. Seq a => a -> a -> a
 TokenClassWSBasic -> Regex CharClass ℂ TokenClassWSBasic ℕ64
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
o -> Regex c t o u
oepsRegex TokenClassWSBasic
NaturalCWSBasic
  , Regex CharClass ℂ TokenClassWSBasic ℕ64
forall u o.
(Zero u, Ord o, Ord u, Additive u) =>
Regex CharClass ℂ o u
lInt                              Regex CharClass ℂ TokenClassWSBasic ℕ64
-> Regex CharClass ℂ TokenClassWSBasic ℕ64
-> Regex CharClass ℂ TokenClassWSBasic ℕ64
forall a. Seq a => a -> a -> a
 TokenClassWSBasic -> Regex CharClass ℂ TokenClassWSBasic ℕ64
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
o -> Regex c t o u
oepsRegex TokenClassWSBasic
IntegerCWSBasic
  , Regex CharClass ℂ TokenClassWSBasic ℕ64
forall u o.
(Zero u, Ord o, Ord u, Additive u) =>
Regex CharClass ℂ o u
lDbl                              Regex CharClass ℂ TokenClassWSBasic ℕ64
-> Regex CharClass ℂ TokenClassWSBasic ℕ64
-> Regex CharClass ℂ TokenClassWSBasic ℕ64
forall a. Seq a => a -> a -> a
 TokenClassWSBasic -> Regex CharClass ℂ TokenClassWSBasic ℕ64
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
o -> Regex c t o u
oepsRegex TokenClassWSBasic
DoubleCWSBasic
  , 𝐿 𝕊 -> 𝐿 𝕊 -> 𝐿 𝕊 -> 𝐿 𝕊 -> Regex CharClass ℂ TokenClassWSBasic ℕ64
forall u.
(Ord u, Additive u) =>
𝐿 𝕊 -> 𝐿 𝕊 -> 𝐿 𝕊 -> 𝐿 𝕊 -> Regex CharClass ℂ TokenClassWSBasic u
lSyntaxWSBasic 𝐿 𝕊
puns 𝐿 𝕊
kws 𝐿 𝕊
prims 𝐿 𝕊
ops Regex CharClass ℂ TokenClassWSBasic ℕ64
-> Regex CharClass ℂ TokenClassWSBasic ℕ64
-> Regex CharClass ℂ TokenClassWSBasic ℕ64
forall a. Seq a => a -> a -> a
 TokenClassWSBasic -> Regex CharClass ℂ TokenClassWSBasic ℕ64
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
o -> Regex c t o u
oepsRegex TokenClassWSBasic
SyntaxCWSBasic
  , 𝐿 𝕊 -> Regex CharClass ℂ TokenClassWSBasic ℕ64
forall u.
(Ord u, Additive u) =>
𝐿 𝕊 -> Regex CharClass ℂ TokenClassWSBasic u
lBlocksWSBasic 𝐿 𝕊
blocks             Regex CharClass ℂ TokenClassWSBasic ℕ64
-> Regex CharClass ℂ TokenClassWSBasic ℕ64
-> Regex CharClass ℂ TokenClassWSBasic ℕ64
forall a. Seq a => a -> a -> a
 TokenClassWSBasic -> Regex CharClass ℂ TokenClassWSBasic ℕ64
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
o -> Regex c t o u
oepsRegex TokenClassWSBasic
BlockCWSBasic
  , Regex CharClass ℂ TokenClassWSBasic ℕ64
forall u o.
(Zero u, Ord o, Ord u, Additive u) =>
Regex CharClass ℂ o u
lString                           Regex CharClass ℂ TokenClassWSBasic ℕ64
-> Regex CharClass ℂ TokenClassWSBasic ℕ64
-> Regex CharClass ℂ TokenClassWSBasic ℕ64
forall a. Seq a => a -> a -> a
 TokenClassWSBasic -> Regex CharClass ℂ TokenClassWSBasic ℕ64
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
o -> Regex c t o u
oepsRegex TokenClassWSBasic
StringCWSBasic
  , Regex CharClass ℂ TokenClassWSBasic ℕ64
forall u o.
(Zero u, Ord u, Ord o, Additive u) =>
Regex CharClass ℂ o u
lName                             Regex CharClass ℂ TokenClassWSBasic ℕ64
-> Regex CharClass ℂ TokenClassWSBasic ℕ64
-> Regex CharClass ℂ TokenClassWSBasic ℕ64
forall a. Seq a => a -> a -> a
 TokenClassWSBasic -> Regex CharClass ℂ TokenClassWSBasic ℕ64
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
o -> Regex c t o u
oepsRegex TokenClassWSBasic
NameCWSBasic
  , Regex CharClass ℂ TokenClassWSBasic ℕ64
forall u o.
(Zero u, Ord o, Ord u, Additive u) =>
Regex CharClass ℂ o u
lSpace                            Regex CharClass ℂ TokenClassWSBasic ℕ64
-> Regex CharClass ℂ TokenClassWSBasic ℕ64
-> Regex CharClass ℂ TokenClassWSBasic ℕ64
forall a. Seq a => a -> a -> a
 TokenClassWSBasic -> Regex CharClass ℂ TokenClassWSBasic ℕ64
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
o -> Regex c t o u
oepsRegex TokenClassWSBasic
SpaceCWSBasic
  , Regex CharClass ℂ TokenClassWSBasic ℕ64
forall u o.
(Zero u, Ord o, Ord u, Additive u) =>
Regex CharClass ℂ o u
lNl                               Regex CharClass ℂ TokenClassWSBasic ℕ64
-> Regex CharClass ℂ TokenClassWSBasic ℕ64
-> Regex CharClass ℂ TokenClassWSBasic ℕ64
forall a. Seq a => a -> a -> a
 TokenClassWSBasic -> Regex CharClass ℂ TokenClassWSBasic ℕ64
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
o -> Regex c t o u
oepsRegex TokenClassWSBasic
NewlineCWSBasic
  , Regex CharClass ℂ TokenClassWSBasic ℕ64
forall o. Ord o => Regex CharClass ℂ o ℕ64
lComment                          Regex CharClass ℂ TokenClassWSBasic ℕ64
-> Regex CharClass ℂ TokenClassWSBasic ℕ64
-> Regex CharClass ℂ TokenClassWSBasic ℕ64
forall a. Seq a => a -> a -> a
 TokenClassWSBasic -> Regex CharClass ℂ TokenClassWSBasic ℕ64
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
o -> Regex c t o u
oepsRegex TokenClassWSBasic
CommentCWSBasic
  , Regex CharClass ℂ TokenClassWSBasic ℕ64
forall o. Ord o => Regex CharClass ℂ o ℕ64
lCommentMLOpen                    Regex CharClass ℂ TokenClassWSBasic ℕ64
-> Regex CharClass ℂ TokenClassWSBasic ℕ64
-> Regex CharClass ℂ TokenClassWSBasic ℕ64
forall a. Seq a => a -> a -> a
 TokenClassWSBasic -> Regex CharClass ℂ TokenClassWSBasic ℕ64
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
o -> Regex c t o u
oepsRegex TokenClassWSBasic
CommentCWSBasic
  ]

lCommentMLWSBasic  Regex CharClass  TokenClassWSBasic ℕ64
lCommentMLWSBasic :: Regex CharClass ℂ TokenClassWSBasic ℕ64
lCommentMLWSBasic = Regex CharClass ℂ TokenClassWSBasic ℕ64
forall o. Ord o => Regex CharClass ℂ o ℕ64
lCommentMLBody Regex CharClass ℂ TokenClassWSBasic ℕ64
-> Regex CharClass ℂ TokenClassWSBasic ℕ64
-> Regex CharClass ℂ TokenClassWSBasic ℕ64
forall a. Seq a => a -> a -> a
 TokenClassWSBasic -> Regex CharClass ℂ TokenClassWSBasic ℕ64
forall c t o u.
(Ord c, Ord t, Ord o, Ord u, Zero u) =>
o -> Regex c t o u
oepsRegex TokenClassWSBasic
CommentCWSBasic

dfaWSBasic  𝐿 𝕊  𝐿 𝕊  𝐿 𝕊  𝐿 𝕊  𝐿 𝕊  ℕ64  DFA CharClass  TokenClassWSBasic ℕ64
dfaWSBasic :: 𝐿 𝕊
-> 𝐿 𝕊
-> 𝐿 𝕊
-> 𝐿 𝕊
-> 𝐿 𝕊
-> ℕ64
-> DFA CharClass ℂ TokenClassWSBasic ℕ64
dfaWSBasic 𝐿 𝕊
puns 𝐿 𝕊
kws 𝐿 𝕊
prims 𝐿 𝕊
ops 𝐿 𝕊
blocks =
  let dfaTokenBasic :: DFA CharClass ℂ TokenClassWSBasic ℕ64
dfaTokenBasic = Regex CharClass ℂ TokenClassWSBasic ℕ64
-> DFA CharClass ℂ TokenClassWSBasic ℕ64
forall c t o u.
(Pretty t, Pretty o, Pretty u, Ord c, Ord t, Classified c t, All c,
 Ord o, Ord u, Additive u) =>
Regex c t o u -> DFA c t o u
compileRegex (Regex CharClass ℂ TokenClassWSBasic ℕ64
 -> DFA CharClass ℂ TokenClassWSBasic ℕ64)
-> Regex CharClass ℂ TokenClassWSBasic ℕ64
-> DFA CharClass ℂ TokenClassWSBasic ℕ64
forall a b. (a -> b) -> a -> b
$ 𝐿 𝕊
-> 𝐿 𝕊
-> 𝐿 𝕊
-> 𝐿 𝕊
-> 𝐿 𝕊
-> Regex CharClass ℂ TokenClassWSBasic ℕ64
lTokenWSBasic 𝐿 𝕊
puns 𝐿 𝕊
kws 𝐿 𝕊
prims 𝐿 𝕊
ops 𝐿 𝕊
blocks
      dfaCommentMLBasic :: DFA CharClass ℂ TokenClassWSBasic ℕ64
dfaCommentMLBasic = Regex CharClass ℂ TokenClassWSBasic ℕ64
-> DFA CharClass ℂ TokenClassWSBasic ℕ64
forall c t o u.
(Pretty t, Pretty o, Pretty u, Ord c, Ord t, Classified c t, All c,
 Ord o, Ord u, Additive u) =>
Regex c t o u -> DFA c t o u
compileRegex Regex CharClass ℂ TokenClassWSBasic ℕ64
lCommentMLWSBasic
      dfa :: ℕ64 -> DFA CharClass ℂ TokenClassWSBasic ℕ64
dfa ℕ64
n | ℕ64
n ℕ64 -> ℕ64 -> Bool
forall a. Eq a => a -> a -> Bool
 ℕ -> ℕ64
𝕟64 0 = DFA CharClass ℂ TokenClassWSBasic ℕ64
dfaTokenBasic
            | Bool
otherwise = DFA CharClass ℂ TokenClassWSBasic ℕ64
dfaCommentMLBasic
  in ℕ64 -> DFA CharClass ℂ TokenClassWSBasic ℕ64
dfa

lexerWSBasic  𝐿 𝕊  𝐿 𝕊  𝐿 𝕊  𝐿 𝕊  𝐿 𝕊  Lexer CharClass  TokenClassWSBasic ℕ64 TokenWSBasic
lexerWSBasic :: 𝐿 𝕊
-> 𝐿 𝕊
-> 𝐿 𝕊
-> 𝐿 𝕊
-> 𝐿 𝕊
-> Lexer CharClass ℂ TokenClassWSBasic ℕ64 TokenWSBasic
lexerWSBasic 𝐿 𝕊
puns 𝐿 𝕊
kws 𝐿 𝕊
prims 𝐿 𝕊
ops 𝐿 𝕊
blocks = (ℕ64 -> DFA CharClass ℂ TokenClassWSBasic ℕ64)
-> (𝐼C ℂ -> 𝑂 TokenClassWSBasic -> Bool ∧ TokenWSBasic)
-> ℕ64
-> Lexer CharClass ℂ TokenClassWSBasic ℕ64 TokenWSBasic
forall c t o u w.
(u -> DFA c t o u)
-> (𝐼C t -> 𝑂 o -> Bool ∧ w) -> u -> Lexer c t o u w
Lexer (𝐿 𝕊
-> 𝐿 𝕊
-> 𝐿 𝕊
-> 𝐿 𝕊
-> 𝐿 𝕊
-> ℕ64
-> DFA CharClass ℂ TokenClassWSBasic ℕ64
dfaWSBasic 𝐿 𝕊
puns 𝐿 𝕊
kws 𝐿 𝕊
prims 𝐿 𝕊
ops 𝐿 𝕊
blocks) 𝐼C ℂ -> 𝑂 TokenClassWSBasic -> Bool ∧ TokenWSBasic
mkTokenWSBasic ℕ64
forall a. Zero a => a
zero

mkIndentTokenWSBasic  IndentCommand  TokenWSBasic
mkIndentTokenWSBasic :: IndentCommand -> TokenWSBasic
mkIndentTokenWSBasic = \case
  IndentCommand
OpenIC  TokenWSBasic
OpenTWSBasic
  IndentCommand
CloseIC  TokenWSBasic
CloseTWSBasic
  IndentCommand
NewlineIC  TokenWSBasic
DelimiterTWSBasic

blockifyTokensWSBasic  𝕍 (PreParserToken TokenWSBasic)  𝕍 (PreParserToken TokenWSBasic)
blockifyTokensWSBasic :: 𝕍 (PreParserToken TokenWSBasic) -> 𝕍 (PreParserToken TokenWSBasic)
blockifyTokensWSBasic = (TokenWSBasic -> Bool)
-> (TokenWSBasic -> Bool)
-> (IndentCommand -> TokenWSBasic)
-> 𝕍 (PreParserToken TokenWSBasic)
-> 𝕍 (PreParserToken TokenWSBasic)
forall t.
(t -> Bool)
-> (t -> Bool)
-> (IndentCommand -> t)
-> 𝕍 (PreParserToken t)
-> 𝕍 (PreParserToken t)
blockifyTokensTL ((TokenWSBasic ⌲ 𝕊) -> TokenWSBasic -> Bool
forall a b. (a ⌲ b) -> a -> Bool
shape TokenWSBasic ⌲ 𝕊
newlineTWSBasicL) ((TokenWSBasic ⌲ 𝕊) -> TokenWSBasic -> Bool
forall a b. (a ⌲ b) -> a -> Bool
shape TokenWSBasic ⌲ 𝕊
blockTWSBasicL) IndentCommand -> TokenWSBasic
mkIndentTokenWSBasic