    {-# LANGUAGE  MagicHash,
                  UnboxedTuples,
                  ScopedTypeVariables #-}

    module UU.Parsing.Offside( parseOffside
                             , pBlock
                             , pBlock1
                             , pOffside
                             , pOpen
                             , pClose
                             , pSeparator
                             , scanOffside
                             , scanOffsideWithTriggers
                             , scanLiftTokensToOffside
                             , OffsideTrigger(..)
                             , OffsideSymbol(..)
                             , OffsideInput
                             , Stream
                             , OffsideParser(..)
                             ) where

    import GHC.Prim
    import Data.Maybe
    import Control.Applicative
    import UU.Parsing.Interface
    import UU.Parsing.Machine
    import UU.Parsing.Derived(opt, pFoldr1Sep,pList,pList1, pList1Sep)
    import UU.Scanner.Position

    data OffsideTrigger
      = Trigger_IndentGT
      | Trigger_IndentGE
      deriving OffsideTrigger -> OffsideTrigger -> Bool
    (OffsideTrigger -> OffsideTrigger -> Bool)
    -> (OffsideTrigger -> OffsideTrigger -> Bool) -> Eq OffsideTrigger
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    /= :: OffsideTrigger -> OffsideTrigger -> Bool
    $c/= :: OffsideTrigger -> OffsideTrigger -> Bool
    == :: OffsideTrigger -> OffsideTrigger -> Bool
    $c== :: OffsideTrigger -> OffsideTrigger -> Bool
    Eq

    data OffsideSymbol s
      = Symbol s
      | SemiColon
      | CloseBrace
      | OpenBrace
      deriving (Eq (OffsideSymbol s)
    Eq (OffsideSymbol s) =>
    (OffsideSymbol s -> OffsideSymbol s -> Ordering)
    -> (OffsideSymbol s -> OffsideSymbol s -> Bool)
    -> (OffsideSymbol s -> OffsideSymbol s -> Bool)
    -> (OffsideSymbol s -> OffsideSymbol s -> Bool)
    -> (OffsideSymbol s -> OffsideSymbol s -> Bool)
    -> (OffsideSymbol s -> OffsideSymbol s -> OffsideSymbol s)
    -> (OffsideSymbol s -> OffsideSymbol s -> OffsideSymbol s)
    -> Ord (OffsideSymbol s)
    OffsideSymbol s -> OffsideSymbol s -> Bool
    OffsideSymbol s -> OffsideSymbol s -> Ordering
    OffsideSymbol s -> OffsideSymbol s -> OffsideSymbol s
    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 s. Ord s => Eq (OffsideSymbol s)
    forall s. Ord s => OffsideSymbol s -> OffsideSymbol s -> Bool
    forall s. Ord s => OffsideSymbol s -> OffsideSymbol s -> Ordering
    forall s.
    Ord s =>
    OffsideSymbol s -> OffsideSymbol s -> OffsideSymbol s
    min :: OffsideSymbol s -> OffsideSymbol s -> OffsideSymbol s
    $cmin :: forall s.
    Ord s =>
    OffsideSymbol s -> OffsideSymbol s -> OffsideSymbol s
    max :: OffsideSymbol s -> OffsideSymbol s -> OffsideSymbol s
    $cmax :: forall s.
    Ord s =>
    OffsideSymbol s -> OffsideSymbol s -> OffsideSymbol s
    >= :: OffsideSymbol s -> OffsideSymbol s -> Bool
    $c>= :: forall s. Ord s => OffsideSymbol s -> OffsideSymbol s -> Bool
    > :: OffsideSymbol s -> OffsideSymbol s -> Bool
    $c> :: forall s. Ord s => OffsideSymbol s -> OffsideSymbol s -> Bool
    <= :: OffsideSymbol s -> OffsideSymbol s -> Bool
    $c<= :: forall s. Ord s => OffsideSymbol s -> OffsideSymbol s -> Bool
    < :: OffsideSymbol s -> OffsideSymbol s -> Bool
    $c< :: forall s. Ord s => OffsideSymbol s -> OffsideSymbol s -> Bool
    compare :: OffsideSymbol s -> OffsideSymbol s -> Ordering
    $ccompare :: forall s. Ord s => OffsideSymbol s -> OffsideSymbol s -> Ordering
    $cp1Ord :: forall s. Ord s => Eq (OffsideSymbol s)
    Ord,OffsideSymbol s -> OffsideSymbol s -> Bool
    (OffsideSymbol s -> OffsideSymbol s -> Bool)
    -> (OffsideSymbol s -> OffsideSymbol s -> Bool)
    -> Eq (OffsideSymbol s)
    forall s. Eq s => OffsideSymbol s -> OffsideSymbol s -> Bool
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    /= :: OffsideSymbol s -> OffsideSymbol s -> Bool
    $c/= :: forall s. Eq s => OffsideSymbol s -> OffsideSymbol s -> Bool
    == :: OffsideSymbol s -> OffsideSymbol s -> Bool
    $c== :: forall s. Eq s => OffsideSymbol s -> OffsideSymbol s -> Bool
    Eq,Int -> OffsideSymbol s -> ShowS
    [OffsideSymbol s] -> ShowS
    OffsideSymbol s -> String
    (Int -> OffsideSymbol s -> ShowS)
    -> (OffsideSymbol s -> String)
    -> ([OffsideSymbol s] -> ShowS)
    -> Show (OffsideSymbol s)
    forall s. Show s => Int -> OffsideSymbol s -> ShowS
    forall s. Show s => [OffsideSymbol s] -> ShowS
    forall s. Show s => OffsideSymbol s -> String
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    showList :: [OffsideSymbol s] -> ShowS
    $cshowList :: forall s. Show s => [OffsideSymbol s] -> ShowS
    show :: OffsideSymbol s -> String
    $cshow :: forall s. Show s => OffsideSymbol s -> String
    showsPrec :: Int -> OffsideSymbol s -> ShowS
    $cshowsPrec :: forall s. Show s => Int -> OffsideSymbol s -> ShowS
    Show)

    data Stream inp s p
      = Cons (OffsideSymbol s) (OffsideInput inp s p)
      | End inp

    data IndentContext
      = Cxt     Bool                -- properties: allows nesting on equal indentation (triggered by Trigger_IndentGE)
                Int                 -- indentation

    data OffsideInput inp s p
      = Off p                                   -- position
            (Stream inp s p)                    -- input stream
            (Maybe (OffsideInput inp s p))      -- next in stack of nested OffsideInput's

    -- | plainly lift tokens to offside tokens
    -- scanLiftTokensToOffside :: (InputState i s p) => [i] -> OffsideInput i s p -> OffsideInput i s p
    scanLiftTokensToOffside :: t -> OffsideInput inp s p -> OffsideInput inp s p
    scanLiftTokensToOffside ts :: t
    ts rest :: OffsideInput inp s p
    rest
      = t -> OffsideInput inp s p
    forall t. InputState t s p => t -> OffsideInput inp s p
    lift t
    ts
      where cons :: p -> s -> OffsideInput inp s p -> OffsideInput inp s p
    cons p :: p
    p s :: s
    s r :: OffsideInput inp s p
    r =  p
    -> Stream inp s p
    -> Maybe (OffsideInput inp s p)
    -> OffsideInput inp s p
    forall inp s p.
    p
    -> Stream inp s p
    -> Maybe (OffsideInput inp s p)
    -> OffsideInput inp s p
    Off p
    p (OffsideSymbol s -> OffsideInput inp s p -> Stream inp s p
    forall inp s p.
    OffsideSymbol s -> OffsideInput inp s p -> Stream inp s p
    Cons (s -> OffsideSymbol s
    forall s. s -> OffsideSymbol s
    Symbol s
    s) OffsideInput inp s p
    r) Maybe (OffsideInput inp s p)
    forall a. Maybe a
    Nothing
            lift :: t -> OffsideInput inp s p
    lift tss :: t
    tss = case t -> Either' t s
    forall state s pos.
    InputState state s pos =>
    state -> Either' state s
    splitStateE t
    tss of
                         Left' t :: s
    t ts :: t
    ts -> p -> s -> OffsideInput inp s p -> OffsideInput inp s p
    forall p s inp.
    p -> s -> OffsideInput inp s p -> OffsideInput inp s p
    cons (t -> p
    forall state s pos. InputState state s pos => state -> pos
    getPosition t
    tss) s
    t (t -> OffsideInput inp s p
    lift t
    ts)
                         _          -> OffsideInput inp s p
    rest

    -- | convert tokens to offside tokens, dealing with Haskell's layout rule
    scanOffside :: (InputState i s p, Position p, Eq s)
                =>  s ->  s -> s -> [s] -> i -> OffsideInput i s p
    scanOffside :: s -> s -> s -> [s] -> i -> OffsideInput i s p
    scanOffside mod :: s
    mod open :: s
    open close :: s
    close triggers :: [s]
    triggers ts :: i
    ts
      = s -> s -> s -> [(OffsideTrigger, s)] -> i -> OffsideInput i s p
    forall i s p.
    (InputState i s p, Position p, Eq s) =>
    s -> s -> s -> [(OffsideTrigger, s)] -> i -> OffsideInput i s p
    scanOffsideWithTriggers s
    mod s
    open s
    close ([OffsideTrigger] -> [s] -> [(OffsideTrigger, s)]
    forall a b. [a] -> [b] -> [(a, b)]
    zip (OffsideTrigger -> [OffsideTrigger]
    forall a. a -> [a]
    repeat OffsideTrigger
    Trigger_IndentGT) [s]
    triggers) i
    ts

    scanOffsideWithTriggers :: forall i s p. (InputState i s p, Position p, Eq s)
                =>  s ->  s -> s -> [(OffsideTrigger,s)] -> i -> OffsideInput i s p
    scanOffsideWithTriggers :: s -> s -> s -> [(OffsideTrigger, s)] -> i -> OffsideInput i s p
    scanOffsideWithTriggers mod :: s
    mod open :: s
    open close :: s
    close triggers :: [(OffsideTrigger, s)]
    triggers ts :: i
    ts = i -> [Int] -> OffsideInput i s p
    start i
    ts []
     where
     isModule :: s -> Bool
    isModule    t :: s
    t = s
    t s -> s -> Bool
    forall a. Eq a => a -> a -> Bool
    == s
    mod
     isOpen :: s -> Bool
    isOpen      t :: s
    t = s
    t s -> s -> Bool
    forall a. Eq a => a -> a -> Bool
    == s
    open
     isClose :: s -> Bool
    isClose     t :: s
    t = s
    t s -> s -> Bool
    forall a. Eq a => a -> a -> Bool
    == s
    close
     isTrigger :: OffsideTrigger -> s -> Bool
    isTrigger tr :: OffsideTrigger
    tr  = \t :: s
    t -> s
    t s -> [s] -> Bool
    forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
    `elem` [s]
    triggers'
                   where triggers' :: [s]
    triggers' = [ s
    s | (tr' :: OffsideTrigger
    tr',s :: s
    s) <- [(OffsideTrigger, s)]
    triggers, OffsideTrigger
    tr OffsideTrigger -> OffsideTrigger -> Bool
    forall a. Eq a => a -> a -> Bool
    == OffsideTrigger
    tr' ]
     isTriggerGT :: s -> Bool
    isTriggerGT   = OffsideTrigger -> s -> Bool
    isTrigger OffsideTrigger
    Trigger_IndentGT
     isTriggerGE :: s -> Bool
    isTriggerGE   = OffsideTrigger -> s -> Bool
    isTrigger OffsideTrigger
    Trigger_IndentGE
     end :: inp -> Maybe (OffsideInput inp s p) -> OffsideInput inp s p
    end ts :: inp
    ts    = p
    -> Stream inp s p
    -> Maybe (OffsideInput inp s p)
    -> OffsideInput inp s p
    forall inp s p.
    p
    -> Stream inp s p
    -> Maybe (OffsideInput inp s p)
    -> OffsideInput inp s p
    Off (inp -> p
    forall state s pos. InputState state s pos => state -> pos
    getPosition inp
    ts) (inp -> Stream inp s p
    forall inp s p. inp -> Stream inp s p
    End inp
    ts)
     cons :: p -> OffsideSymbol s -> OffsideInput i s p -> OffsideInput i s p
     cons :: p -> OffsideSymbol s -> OffsideInput i s p -> OffsideInput i s p
    cons p :: p
    p s :: OffsideSymbol s
    s r :: OffsideInput i s p
    r =  p
    -> Stream i s p -> Maybe (OffsideInput i s p) -> OffsideInput i s p
    forall inp s p.
    p
    -> Stream inp s p
    -> Maybe (OffsideInput inp s p)
    -> OffsideInput inp s p
    Off p
    p (OffsideSymbol s -> OffsideInput i s p -> Stream i s p
    forall inp s p.
    OffsideSymbol s -> OffsideInput inp s p -> Stream inp s p
    Cons OffsideSymbol s
    s OffsideInput i s p
    r) Maybe (OffsideInput i s p)
    forall a. Maybe a
    Nothing
     start :: i -> [Int] -> OffsideInput i s p
    start = case i -> Either' i s
    forall state s pos.
    InputState state s pos =>
    state -> Either' state s
    splitStateE i
    ts of
              Left' t :: s
    t _ | Bool -> Bool
    not (s -> Bool
    isModule s
    t Bool -> Bool -> Bool
    || s -> Bool
    isOpen s
    t) -> Int -> IndentContext -> i -> [Int] -> OffsideInput i s p
    forall p s.
    (InputState i s p, Position p) =>
    Int -> IndentContext -> i -> [Int] -> OffsideInput i s p
    implicitL 0 (Bool -> Int -> IndentContext
    Cxt Bool
    False (p -> Int
    forall p. Position p => p -> Int
    column (i -> p
    forall state s pos. InputState state s pos => state -> pos
    getPosition i
    ts)))
              _                                        -> Int -> i -> [Int] -> OffsideInput i s p
    forall p s.
    (InputState i s p, Position p) =>
    Int -> i -> [Int] -> OffsideInput i s p
    layoutL   0

     -- L (<n>:ts) (m:ms)   = ; : (L ts (m:ms))     if m = n
     --                     = } : (L (<n>:ts) ms)   if n < m
     -- L (<n>:ts) ms       = L ts ms
     startlnL :: Int -> Int -> i -> [Int] -> OffsideInput i s p
    startlnL  l :: Int
    l n :: Int
    n ts :: i
    ts (m :: Int
    m:ms :: [Int]
    ms) | Int
    m Int -> Int -> Bool
    forall a. Eq a => a -> a -> Bool
    == Int
    n    = p -> OffsideSymbol s -> OffsideInput i s p -> OffsideInput i s p
    cons (i -> p
    forall state s pos. InputState state s pos => state -> pos
    getPosition i
    ts) OffsideSymbol s
    forall s. OffsideSymbol s
    SemiColon  (Int -> i -> [Int] -> OffsideInput i s p
    layoutL (p -> Int
    forall p. Position p => p -> Int
    line (i -> p
    forall state s pos. InputState state s pos => state -> pos
    getPosition i
    ts)) i
    ts (Int
    mInt -> [Int] -> [Int]
    forall a. a -> [a] -> [a]
    :[Int]
    ms))
                             | Int
    n Int -> Int -> Bool
    forall a. Ord a => a -> a -> Bool
    <  Int
    m    = p -> OffsideSymbol s -> OffsideInput i s p -> OffsideInput i s p
    cons (i -> p
    forall state s pos. InputState state s pos => state -> pos
    getPosition i
    ts) OffsideSymbol s
    forall s. OffsideSymbol s
    CloseBrace (Int -> Int -> i -> [Int] -> OffsideInput i s p
    startlnL Int
    l Int
    n i
    ts [Int]
    ms)
     startlnL  l :: Int
    l n :: Int
    n ts :: i
    ts ms :: [Int]
    ms                 = Int -> i -> [Int] -> OffsideInput i s p
    layoutL (p -> Int
    forall p. Position p => p -> Int
    line (i -> p
    forall state s pos. InputState state s pos => state -> pos
    getPosition i
    ts))  i
    ts [Int]
    ms

     -- L  ({n}:ts)  (m:ms) = { : (L  ts (n:m:ms))     if n >  m    (Note  1)
     -- L  ({n}:ts)  (m:ms) = { : (L  ts (n:m:ms))     if n >= m    (as per Haskell2010, inside a do only)
     -- L  ({n}:ts)  []     = { : (L  ts [n])          if n >  0    (Note  1)
     -- L  ({n}:ts)  ms     = { : } : (L  (<n>:ts) ms) (Note  2)
     implicitL :: Int -> IndentContext -> i -> [Int] -> OffsideInput i s p
    implicitL l :: Int
    l (Cxt ge :: Bool
    ge n :: Int
    n) ts :: i
    ts (m :: Int
    m:ms :: [Int]
    ms) |     Int
    n Int -> Int -> Bool
    forall a. Ord a => a -> a -> Bool
    >  Int
    m
                                        Bool -> Bool -> Bool
    || (Int
    n Int -> Int -> Bool
    forall a. Ord a => a -> a -> Bool
    >= Int
    m Bool -> Bool -> Bool
    && Bool
    ge)
                                                  = p -> OffsideSymbol s -> OffsideInput i s p -> OffsideInput i s p
    cons (i -> p
    forall state s pos. InputState state s pos => state -> pos
    getPosition i
    ts) OffsideSymbol s
    forall s. OffsideSymbol s
    OpenBrace (Int -> i -> [Int] -> OffsideInput i s p
    layoutL (p -> Int
    forall p. Position p => p -> Int
    line (i -> p
    forall state s pos. InputState state s pos => state -> pos
    getPosition i
    ts)) i
    ts (Int
    nInt -> [Int] -> [Int]
    forall a. a -> [a] -> [a]
    :Int
    mInt -> [Int] -> [Int]
    forall a. a -> [a] -> [a]
    :[Int]
    ms))
     implicitL l :: Int
    l (Cxt _  n :: Int
    n) ts :: i
    ts []     | Int
    n Int -> Int -> Bool
    forall a. Ord a => a -> a -> Bool
    >  0    = p -> OffsideSymbol s -> OffsideInput i s p -> OffsideInput i s p
    cons (i -> p
    forall state s pos. InputState state s pos => state -> pos
    getPosition i
    ts) OffsideSymbol s
    forall s. OffsideSymbol s
    OpenBrace (Int -> i -> [Int] -> OffsideInput i s p
    layoutL (p -> Int
    forall p. Position p => p -> Int
    line (i -> p
    forall state s pos. InputState state s pos => state -> pos
    getPosition i
    ts)) i
    ts [Int
    n])
     implicitL l :: Int
    l (Cxt _  n :: Int
    n) ts :: i
    ts ms :: [Int]
    ms                 = p -> OffsideSymbol s -> OffsideInput i s p -> OffsideInput i s p
    cons (i -> p
    forall state s pos. InputState state s pos => state -> pos
    getPosition i
    ts) OffsideSymbol s
    forall s. OffsideSymbol s
    OpenBrace (p -> OffsideSymbol s -> OffsideInput i s p -> OffsideInput i s p
    cons (i -> p
    forall state s pos. InputState state s pos => state -> pos
    getPosition i
    ts) OffsideSymbol s
    forall s. OffsideSymbol s
    CloseBrace (Int -> Int -> i -> [Int] -> OffsideInput i s p
    startlnL Int
    l Int
    n i
    ts [Int]
    ms))

     layoutL :: Int -> i -> [Int] -> OffsideInput i s p
    layoutL   ln :: Int
    ln  ts :: i
    ts ms :: [Int]
    ms     | Int
    ln Int -> Int -> Bool
    forall a. Eq a => a -> a -> Bool
    /= Int
    sln = Int -> i -> [Int] -> OffsideInput i s p
    startln (p -> Int
    forall p. Position p => p -> Int
    column p
    pos) i
    ts [Int]
    ms
                             | Bool
    otherwise = i -> [Int] -> OffsideInput i s p
    (InputState i s p, Position p, Eq s) =>
    i -> [Int] -> OffsideInput i s p
    sameln i
    ts [Int]
    ms

      where sln :: Int
    sln       = p -> Int
    forall p. Position p => p -> Int
    line p
    pos
            pos :: p
    pos       = i -> p
    forall state s pos. InputState state s pos => state -> pos
    getPosition i
    ts
            layout :: i -> [Int] -> OffsideInput i s p
    layout    = Int -> i -> [Int] -> OffsideInput i s p
    layoutL Int
    ln
            implicit :: IndentContext -> i -> [Int] -> OffsideInput i s p
    implicit  = Int -> IndentContext -> i -> [Int] -> OffsideInput i s p
    implicitL Int
    ln
            startln :: Int -> i -> [Int] -> OffsideInput i s p
    startln   = Int -> Int -> i -> [Int] -> OffsideInput i s p
    startlnL Int
    ln
            -- If a let ,where ,do , or of keyword is not followed by the lexeme {,
            -- the token {n} is inserted after the keyword, where nis the indentation of
            -- the  next lexeme if there is one, or 0 if the end of file has been reached.
            aftertrigger :: Bool -> i -> [Int] -> OffsideInput i s p
    aftertrigger isTriggerGE :: Bool
    isTriggerGE ts :: i
    ts ms :: [Int]
    ms
              = case i -> Either' i s
    forall state s pos.
    InputState state s pos =>
    state -> Either' state s
    splitStateE i
    ts of
                  Left' t :: s
    t _  | s -> Bool
    isOpen s
    t  -> i -> [Int] -> OffsideInput i s p
    layout i
    ts [Int]
    ms
                             | Bool
    otherwise -> IndentContext -> i -> [Int] -> OffsideInput i s p
    implicit (Bool -> Int -> IndentContext
    Cxt Bool
    isTriggerGE (p -> Int
    forall p. Position p => p -> Int
    column(i -> p
    forall state s pos. InputState state s pos => state -> pos
    getPosition i
    ts))) i
    ts [Int]
    ms
                  Right' _               -> IndentContext -> i -> [Int] -> OffsideInput i s p
    implicit (Bool -> Int -> IndentContext
    Cxt Bool
    False       0                       ) i
    ts [Int]
    ms

            -- L  ( }:ts)  (0:ms) = } : (L  ts ms)          (Note  3)
            -- L  ( }:ts)  ms     = parse-error             (Note  3), matching of implicit/explicit braces is handled by parser
            -- L  ( {:ts)  ms     = {: (L  ts (0:ms))       (Note  4)
            -- L  (t:ts)  (m:ms)  = }: (L  (t:ts)  ms)      if  m /= 0  and  parse-error(t) (Note  5)
            -- L  (t:ts)  ms      = t : (L  ts ms)
            sameln :: (InputState i s p, Position p, Eq s) => i -> [Int] -> OffsideInput i s p
            sameln :: i -> [Int] -> OffsideInput i s p
    sameln tts :: i
    tts ms :: [Int]
    ms
              = case i -> Either' i s
    forall state s pos.
    InputState state s pos =>
    state -> Either' state s
    splitStateE i
    tts of
                  Left'  t :: s
    t ts :: i
    ts  ->
                            let tail :: OffsideInput i s p
    tail
                                  | s -> Bool
    isTriggerGE s
    t = Bool -> i -> [Int] -> OffsideInput i s p
    forall p.
    (Position p, InputState i s p) =>
    Bool -> i -> [Int] -> OffsideInput i s p
    aftertrigger Bool
    True  i
    ts [Int]
    ms
                                  | s -> Bool
    isTriggerGT s
    t = Bool -> i -> [Int] -> OffsideInput i s p
    forall p.
    (Position p, InputState i s p) =>
    Bool -> i -> [Int] -> OffsideInput i s p
    aftertrigger Bool
    False i
    ts [Int]
    ms
                                  | s -> Bool
    isClose     s
    t = case [Int]
    ms of
                                                      0:rs :: [Int]
    rs -> i -> [Int] -> OffsideInput i s p
    layout i
    ts [Int]
    rs
                                                      _    -> i -> [Int] -> OffsideInput i s p
    layout i
    ts [Int]
    ms

                                  | s -> Bool
    isOpen      s
    t = i -> [Int] -> OffsideInput i s p
    layout i
    ts (0Int -> [Int] -> [Int]
    forall a. a -> [a] -> [a]
    :[Int]
    ms)
                                  | Bool
    otherwise     = i -> [Int] -> OffsideInput i s p
    layout i
    ts [Int]
    ms
                                parseError :: Maybe (OffsideInput i s p)
    parseError = case [Int]
    ms of
                                               m :: Int
    m:ms :: [Int]
    ms  | Int
    m Int -> Int -> Bool
    forall a. Eq a => a -> a -> Bool
    /= 0 -> OffsideInput i s p -> Maybe (OffsideInput i s p)
    forall a. a -> Maybe a
    Just (i -> [Int] -> OffsideInput i s p
    layout i
    tts [Int]
    ms)
                                               _              -> Maybe (OffsideInput i s p)
    forall a. Maybe a
    Nothing
                            in  p
    -> Stream i s p -> Maybe (OffsideInput i s p) -> OffsideInput i s p
    forall inp s p.
    p
    -> Stream inp s p
    -> Maybe (OffsideInput inp s p)
    -> OffsideInput inp s p
    Off p
    pos (OffsideSymbol s -> OffsideInput i s p -> Stream i s p
    forall inp s p.
    OffsideSymbol s -> OffsideInput inp s p -> Stream inp s p
    Cons (s -> OffsideSymbol s
    forall s. s -> OffsideSymbol s
    Symbol s
    t) OffsideInput i s p
    tail) Maybe (OffsideInput i s p)
    parseError
                  Right' rest :: i
    rest -> p -> i -> [Int] -> OffsideInput i s p
    forall a. (Eq a, Num a) => p -> i -> [a] -> OffsideInput i s p
    endofinput p
    pos i
    rest [Int]
    ms
              where pos :: p
    pos = i -> p
    forall state s pos. InputState state s pos => state -> pos
    getPosition i
    tts

            -- L  []  []          = []
            -- L  []  (m:ms)      = } : L  []  ms           if m /=0   (Note  6)
            --                    = L [] ms, if m == 0 (this is an error, the parser should yield a parse error, if this situation occurs)
            endofinput :: p -> i -> [a] -> OffsideInput i s p
    endofinput pos :: p
    pos rest :: i
    rest []                 = p
    -> Stream i s p -> Maybe (OffsideInput i s p) -> OffsideInput i s p
    forall inp s p.
    p
    -> Stream inp s p
    -> Maybe (OffsideInput inp s p)
    -> OffsideInput inp s p
    Off p
    pos (i -> Stream i s p
    forall inp s p. inp -> Stream inp s p
    End i
    rest) Maybe (OffsideInput i s p)
    forall a. Maybe a
    Nothing
            endofinput pos :: p
    pos rest :: i
    rest (m :: a
    m:ms :: [a]
    ms) | a
    m a -> a -> Bool
    forall a. Eq a => a -> a -> Bool
    /= 0    = p -> OffsideSymbol s -> OffsideInput i s p -> OffsideInput i s p
    cons p
    pos OffsideSymbol s
    forall s. OffsideSymbol s
    CloseBrace (p -> i -> [a] -> OffsideInput i s p
    endofinput p
    pos i
    rest [a]
    ms)
                                       | Bool
    otherwise = p -> i -> [a] -> OffsideInput i s p
    endofinput p
    pos i
    rest [a]
    ms

    instance InputState inp s p => InputState (OffsideInput inp s p) (OffsideSymbol s) p where
      splitStateE :: OffsideInput inp s p
    -> Either' (OffsideInput inp s p) (OffsideSymbol s)
    splitStateE inp :: OffsideInput inp s p
    inp@(Off p :: p
    p stream :: Stream inp s p
    stream _)
        = case Stream inp s p
    stream of
            Cons s :: OffsideSymbol s
    s rest :: OffsideInput inp s p
    rest -> OffsideSymbol s
    -> OffsideInput inp s p
    -> Either' (OffsideInput inp s p) (OffsideSymbol s)
    forall state s. s -> state -> Either' state s
    Left' OffsideSymbol s
    s OffsideInput inp s p
    rest
                        where take :: t -> OffsideInput inp s p -> [OffsideSymbol s]
    take 0 _                    = []
                              take _ (Off _ (End _)    _) = []
                              take n :: t
    n (Off _ (Cons h :: OffsideSymbol s
    h t :: OffsideInput inp s p
    t) _) = OffsideSymbol s
    h OffsideSymbol s -> [OffsideSymbol s] -> [OffsideSymbol s]
    forall a. a -> [a] -> [a]
    : t -> OffsideInput inp s p -> [OffsideSymbol s]
    take (t
    nt -> t -> t
    forall a. Num a => a -> a -> a
    -1) OffsideInput inp s p
    t
            _           -> OffsideInput inp s p
    -> Either' (OffsideInput inp s p) (OffsideSymbol s)
    forall state s. state -> Either' state s
    Right' OffsideInput inp s p
    inp
      splitState :: OffsideInput inp s p -> (# OffsideSymbol s, OffsideInput inp s p #)
    splitState (Off _ stream :: Stream inp s p
    stream _)
        = case Stream inp s p
    stream of
            Cons s :: OffsideSymbol s
    s rest :: OffsideInput inp s p
    rest -> (# OffsideSymbol s
    s, OffsideInput inp s p
    rest #)

      getPosition :: OffsideInput inp s p -> p
    getPosition (Off pos :: p
    pos _ _ ) = p
    pos

    instance Symbol s => Symbol (OffsideSymbol s) where
      deleteCost :: OffsideSymbol s -> Int#
    deleteCost s :: OffsideSymbol s
    s = case OffsideSymbol s
    s of
                      Symbol s :: s
    s   -> s -> Int#
    forall s. Symbol s => s -> Int#
    deleteCost s
    s
                      SemiColon  -> 5#
                      OpenBrace  -> 5#
                      CloseBrace -> 5#
      symBefore :: OffsideSymbol s -> OffsideSymbol s
    symBefore s :: OffsideSymbol s
    s = case OffsideSymbol s
    s of
                     Symbol s :: s
    s   -> s -> OffsideSymbol s
    forall s. s -> OffsideSymbol s
    Symbol (s -> s
    forall s. Symbol s => s -> s
    symBefore s
    s)
                     SemiColon  -> String -> OffsideSymbol s
    forall a. HasCallStack => String -> a
    error "Symbol.symBefore SemiColon"
                     OpenBrace  -> String -> OffsideSymbol s
    forall a. HasCallStack => String -> a
    error "Symbol.symBefore OpenBrace"
                     CloseBrace -> String -> OffsideSymbol s
    forall a. HasCallStack => String -> a
    error "Symbol.symBefore CloseBrace"
      symAfter :: OffsideSymbol s -> OffsideSymbol s
    symAfter s :: OffsideSymbol s
    s = case OffsideSymbol s
    s of
                     Symbol s :: s
    s   -> s -> OffsideSymbol s
    forall s. s -> OffsideSymbol s
    Symbol (s -> s
    forall s. Symbol s => s -> s
    symAfter s
    s)
                     SemiColon  -> String -> OffsideSymbol s
    forall a. HasCallStack => String -> a
    error "Symbol.symAfter SemiColon"
                     OpenBrace  -> String -> OffsideSymbol s
    forall a. HasCallStack => String -> a
    error "Symbol.symAfter OpenBrace"
                     CloseBrace -> String -> OffsideSymbol s
    forall a. HasCallStack => String -> a
    error "Symbol.symAfter CloseBrace"

    newtype OffsideParser i o s p a  = OP (AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a)

    instance  (Symbol s, Ord s, InputState i s p, OutputState o) => IsParser (OffsideParser i o s p) s where
      {-
      (<*>:) = operator  (<*>:)
      (<*: ) = operator  (<*: )
      ( *>:) = operator  ( *>:)
      (<|>:) = operator  (<|>:)
      (<$>:) = operatorr (<$>:)
      (<$: ) = operatorr (<$ )
      pSucceed = OP . pSucceed
      pFail    = OP pFail
      -}
      pLow :: a -> OffsideParser i o s p a
    pLow     = AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a
    -> OffsideParser i o s p a
    forall i (o :: * -> * -> *) s p a.
    AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a
    -> OffsideParser i o s p a
    OP (AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a
     -> OffsideParser i o s p a)
    -> (a -> AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a)
    -> a
    -> OffsideParser i o s p a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . a -> AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a
    forall (p :: * -> *) s a. IsParser p s => a -> p a
    pLow
      pCostRange :: Int# -> s -> SymbolR s -> OffsideParser i o s p s
    pCostRange c :: Int#
    c s :: s
    s (Range l :: s
    l r :: s
    r) = AnaParser (OffsideInput i s p) o (OffsideSymbol s) p s
    -> OffsideParser i o s p s
    forall i (o :: * -> * -> *) s p a.
    AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a
    -> OffsideParser i o s p a
    OP (OffsideSymbol s -> s
    forall s. OffsideSymbol s -> s
    getSymbol (OffsideSymbol s -> s)
    -> AnaParser
         (OffsideInput i s p) o (OffsideSymbol s) p (OffsideSymbol s)
    -> AnaParser (OffsideInput i s p) o (OffsideSymbol s) p s
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Int#
    -> OffsideSymbol s
    -> SymbolR (OffsideSymbol s)
    -> AnaParser
         (OffsideInput i s p) o (OffsideSymbol s) p (OffsideSymbol s)
    forall (p :: * -> *) s.
    IsParser p s =>
    Int# -> s -> SymbolR s -> p s
    pCostRange Int#
    c (s -> OffsideSymbol s
    forall s. s -> OffsideSymbol s
    Symbol s
    s) (OffsideSymbol s -> OffsideSymbol s -> SymbolR (OffsideSymbol s)
    forall s. s -> s -> SymbolR s
    Range (s -> OffsideSymbol s
    forall s. s -> OffsideSymbol s
    Symbol s
    l)(s -> OffsideSymbol s
    forall s. s -> OffsideSymbol s
    Symbol s
    r)))
      pCostSym :: Int# -> s -> s -> OffsideParser i o s p s
    pCostSym   c :: Int#
    c s :: s
    s t :: s
    t           = AnaParser (OffsideInput i s p) o (OffsideSymbol s) p s
    -> OffsideParser i o s p s
    forall i (o :: * -> * -> *) s p a.
    AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a
    -> OffsideParser i o s p a
    OP (OffsideSymbol s -> s
    forall s. OffsideSymbol s -> s
    getSymbol (OffsideSymbol s -> s)
    -> AnaParser
         (OffsideInput i s p) o (OffsideSymbol s) p (OffsideSymbol s)
    -> AnaParser (OffsideInput i s p) o (OffsideSymbol s) p s
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Int#
    -> OffsideSymbol s
    -> OffsideSymbol s
    -> AnaParser
         (OffsideInput i s p) o (OffsideSymbol s) p (OffsideSymbol s)
    forall (p :: * -> *) s. IsParser p s => Int# -> s -> s -> p s
    pCostSym Int#
    c (s -> OffsideSymbol s
    forall s. s -> OffsideSymbol s
    Symbol s
    s) (s -> OffsideSymbol s
    forall s. s -> OffsideSymbol s
    Symbol s
    t))
      pSym :: s -> OffsideParser i o s p s
    pSym   s :: s
    s                   = AnaParser (OffsideInput i s p) o (OffsideSymbol s) p s
    -> OffsideParser i o s p s
    forall i (o :: * -> * -> *) s p a.
    AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a
    -> OffsideParser i o s p a
    OP (OffsideSymbol s -> s
    forall s. OffsideSymbol s -> s
    getSymbol (OffsideSymbol s -> s)
    -> AnaParser
         (OffsideInput i s p) o (OffsideSymbol s) p (OffsideSymbol s)
    -> AnaParser (OffsideInput i s p) o (OffsideSymbol s) p s
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> OffsideSymbol s
    -> AnaParser
         (OffsideInput i s p) o (OffsideSymbol s) p (OffsideSymbol s)
    forall (p :: * -> *) s. IsParser p s => s -> p s
    pSym (s -> OffsideSymbol s
    forall s. s -> OffsideSymbol s
    Symbol s
    s))
      pRange :: s -> SymbolR s -> OffsideParser i o s p s
    pRange s :: s
    s (Range l :: s
    l r :: s
    r)       = AnaParser (OffsideInput i s p) o (OffsideSymbol s) p s
    -> OffsideParser i o s p s
    forall i (o :: * -> * -> *) s p a.
    AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a
    -> OffsideParser i o s p a
    OP (OffsideSymbol s -> s
    forall s. OffsideSymbol s -> s
    getSymbol (OffsideSymbol s -> s)
    -> AnaParser
         (OffsideInput i s p) o (OffsideSymbol s) p (OffsideSymbol s)
    -> AnaParser (OffsideInput i s p) o (OffsideSymbol s) p s
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> OffsideSymbol s
    -> SymbolR (OffsideSymbol s)
    -> AnaParser
         (OffsideInput i s p) o (OffsideSymbol s) p (OffsideSymbol s)
    forall (p :: * -> *) s. IsParser p s => s -> SymbolR s -> p s
    pRange (s -> OffsideSymbol s
    forall s. s -> OffsideSymbol s
    Symbol s
    s) (OffsideSymbol s -> OffsideSymbol s -> SymbolR (OffsideSymbol s)
    forall s. s -> s -> SymbolR s
    Range (s -> OffsideSymbol s
    forall s. s -> OffsideSymbol s
    Symbol s
    l)(s -> OffsideSymbol s
    forall s. s -> OffsideSymbol s
    Symbol s
    r)))
      getfirsts :: OffsideParser i o s p v -> Expecting s
    getfirsts  (OP p :: AnaParser (OffsideInput i s p) o (OffsideSymbol s) p v
    p)          = Expecting (OffsideSymbol s) -> Expecting s
    forall s. Expecting (OffsideSymbol s) -> Expecting s
    removeSymbol (AnaParser (OffsideInput i s p) o (OffsideSymbol s) p v
    -> Expecting (OffsideSymbol s)
    forall (p :: * -> *) s v. IsParser p s => p v -> Expecting s
    getfirsts AnaParser (OffsideInput i s p) o (OffsideSymbol s) p v
    p)
      setfirsts :: Expecting s -> OffsideParser i o s p v -> OffsideParser i o s p v
    setfirsts  exp :: Expecting s
    exp (OP p :: AnaParser (OffsideInput i s p) o (OffsideSymbol s) p v
    p)      = AnaParser (OffsideInput i s p) o (OffsideSymbol s) p v
    -> OffsideParser i o s p v
    forall i (o :: * -> * -> *) s p a.
    AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a
    -> OffsideParser i o s p a
    OP (Expecting (OffsideSymbol s)
    -> AnaParser (OffsideInput i s p) o (OffsideSymbol s) p v
    -> AnaParser (OffsideInput i s p) o (OffsideSymbol s) p v
    forall (p :: * -> *) s v. IsParser p s => Expecting s -> p v -> p v
    setfirsts (Expecting s -> Expecting (OffsideSymbol s)
    forall s. Expecting s -> Expecting (OffsideSymbol s)
    addSymbol Expecting s
    exp) AnaParser (OffsideInput i s p) o (OffsideSymbol s) p v
    p)
      getzerop :: OffsideParser i o s p v -> Maybe (OffsideParser i o s p v)
    getzerop  (OP p :: AnaParser (OffsideInput i s p) o (OffsideSymbol s) p v
    p)           = (AnaParser (OffsideInput i s p) o (OffsideSymbol s) p v
     -> OffsideParser i o s p v)
    -> Maybe (AnaParser (OffsideInput i s p) o (OffsideSymbol s) p v)
    -> Maybe (OffsideParser i o s p v)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap AnaParser (OffsideInput i s p) o (OffsideSymbol s) p v
    -> OffsideParser i o s p v
    forall i (o :: * -> * -> *) s p a.
    AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a
    -> OffsideParser i o s p a
    OP (AnaParser (OffsideInput i s p) o (OffsideSymbol s) p v
    -> Maybe (AnaParser (OffsideInput i s p) o (OffsideSymbol s) p v)
    forall (p :: * -> *) s v. IsParser p s => p v -> Maybe (p v)
    getzerop AnaParser (OffsideInput i s p) o (OffsideSymbol s) p v
    p)
      getonep :: OffsideParser i o s p v -> Maybe (OffsideParser i o s p v)
    getonep   (OP p :: AnaParser (OffsideInput i s p) o (OffsideSymbol s) p v
    p)           = (AnaParser (OffsideInput i s p) o (OffsideSymbol s) p v
     -> OffsideParser i o s p v)
    -> Maybe (AnaParser (OffsideInput i s p) o (OffsideSymbol s) p v)
    -> Maybe (OffsideParser i o s p v)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap AnaParser (OffsideInput i s p) o (OffsideSymbol s) p v
    -> OffsideParser i o s p v
    forall i (o :: * -> * -> *) s p a.
    AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a
    -> OffsideParser i o s p a
    OP (AnaParser (OffsideInput i s p) o (OffsideSymbol s) p v
    -> Maybe (AnaParser (OffsideInput i s p) o (OffsideSymbol s) p v)
    forall (p :: * -> *) s v. IsParser p s => p v -> Maybe (p v)
    getonep AnaParser (OffsideInput i s p) o (OffsideSymbol s) p v
    p)

    instance (Symbol s, Ord s, InputState i s p, OutputState o) => Applicative (OffsideParser i o s p) where
      <*> :: OffsideParser i o s p (a -> b)
    -> OffsideParser i o s p a -> OffsideParser i o s p b
    (<*>) = (AnaParser (OffsideInput i s p) o (OffsideSymbol s) p (a -> b)
     -> AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a
     -> AnaParser (OffsideInput i s p) o (OffsideSymbol s) p b)
    -> OffsideParser i o s p (a -> b)
    -> OffsideParser i o s p a
    -> OffsideParser i o s p b
    forall i s p (o :: * -> * -> *) a i s p (o :: * -> * -> *) a i s p
           (o :: * -> * -> *) a.
    (AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a
     -> AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a
     -> AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a)
    -> OffsideParser i o s p a
    -> OffsideParser i o s p a
    -> OffsideParser i o s p a
    operator  AnaParser (OffsideInput i s p) o (OffsideSymbol s) p (a -> b)
    -> AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a
    -> AnaParser (OffsideInput i s p) o (OffsideSymbol s) p b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    (<*>)
      {-# INLINE (<*>) #-}
      (<* ) = (AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a
     -> AnaParser (OffsideInput i s p) o (OffsideSymbol s) p b
     -> AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a)
    -> OffsideParser i o s p a
    -> OffsideParser i o s p b
    -> OffsideParser i o s p a
    forall i s p (o :: * -> * -> *) a i s p (o :: * -> * -> *) a i s p
           (o :: * -> * -> *) a.
    (AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a
     -> AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a
     -> AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a)
    -> OffsideParser i o s p a
    -> OffsideParser i o s p a
    -> OffsideParser i o s p a
    operator  (<* )
      {-# INLINE (<*) #-}
      ( *>) = (AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a
     -> AnaParser (OffsideInput i s p) o (OffsideSymbol s) p b
     -> AnaParser (OffsideInput i s p) o (OffsideSymbol s) p b)
    -> OffsideParser i o s p a
    -> OffsideParser i o s p b
    -> OffsideParser i o s p b
    forall i s p (o :: * -> * -> *) a i s p (o :: * -> * -> *) a i s p
           (o :: * -> * -> *) a.
    (AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a
     -> AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a
     -> AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a)
    -> OffsideParser i o s p a
    -> OffsideParser i o s p a
    -> OffsideParser i o s p a
    operator  ( *>)
      {-# INLINE (*>) #-}
      pure :: a -> OffsideParser i o s p a
    pure      = AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a
    -> OffsideParser i o s p a
    forall i (o :: * -> * -> *) s p a.
    AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a
    -> OffsideParser i o s p a
    OP (AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a
     -> OffsideParser i o s p a)
    -> (a -> AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a)
    -> a
    -> OffsideParser i o s p a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . a -> AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure
      {-# INLINE pure #-}

    instance (Symbol s, Ord s, InputState i s p, OutputState o) => Alternative (OffsideParser i o s p) where
      <|> :: OffsideParser i o s p a
    -> OffsideParser i o s p a -> OffsideParser i o s p a
    (<|>) = (AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a
     -> AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a
     -> AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a)
    -> OffsideParser i o s p a
    -> OffsideParser i o s p a
    -> OffsideParser i o s p a
    forall i s p (o :: * -> * -> *) a i s p (o :: * -> * -> *) a i s p
           (o :: * -> * -> *) a.
    (AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a
     -> AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a
     -> AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a)
    -> OffsideParser i o s p a
    -> OffsideParser i o s p a
    -> OffsideParser i o s p a
    operator  AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a
    -> AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a
    -> AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    (<|>)
      {-# INLINE (<|>) #-}
      empty :: OffsideParser i o s p a
    empty = AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a
    -> OffsideParser i o s p a
    forall i (o :: * -> * -> *) s p a.
    AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a
    -> OffsideParser i o s p a
    OP AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a
    forall (p :: * -> *) s a. IsParser p s => p a
    pFail
      {-# INLINE empty #-}

    instance (Symbol s, Ord s, InputState i s p, OutputState o, Applicative (OffsideParser i o s p)) => Functor (OffsideParser i o s p) where
      fmap :: (a -> b) -> OffsideParser i o s p a -> OffsideParser i o s p b
    fmap = ((a -> b)
     -> AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a
     -> AnaParser (OffsideInput i s p) o (OffsideSymbol s) p b)
    -> (a -> b) -> OffsideParser i o s p a -> OffsideParser i o s p b
    forall t i s p (o :: * -> * -> *) a i s p (o :: * -> * -> *) a.
    (t
     -> AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a
     -> AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a)
    -> t -> OffsideParser i o s p a -> OffsideParser i o s p a
    operatorr (a -> b)
    -> AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a
    -> AnaParser (OffsideInput i s p) o (OffsideSymbol s) p b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap
      {-# INLINE fmap #-}
      <$ :: a -> OffsideParser i o s p b -> OffsideParser i o s p a
    (<$) = (a
     -> AnaParser (OffsideInput i s p) o (OffsideSymbol s) p b
     -> AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a)
    -> a -> OffsideParser i o s p b -> OffsideParser i o s p a
    forall t i s p (o :: * -> * -> *) a i s p (o :: * -> * -> *) a.
    (t
     -> AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a
     -> AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a)
    -> t -> OffsideParser i o s p a -> OffsideParser i o s p a
    operatorr a
    -> AnaParser (OffsideInput i s p) o (OffsideSymbol s) p b
    -> AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a
    forall (f :: * -> *) a b. Functor f => a -> f b -> f a
    (<$)
      {-# INLINE (<$) #-}

    removeSymbol :: Expecting (OffsideSymbol s) -> Expecting s
    removeSymbol exp :: Expecting (OffsideSymbol s)
    exp = case Expecting (OffsideSymbol s)
    exp of
            ESym (Range (Symbol l :: s
    l) (Symbol r :: s
    r)) -> SymbolR s -> Expecting s
    forall s. SymbolR s -> Expecting s
    ESym (s -> s -> SymbolR s
    forall s. s -> s -> SymbolR s
    Range s
    l s
    r)
            ESym _                             -> [Expecting s] -> Expecting s
    forall s. [Expecting s] -> Expecting s
    EOr []
            EStr txt :: String
    txt                           -> String -> Expecting s
    forall s. String -> Expecting s
    EStr String
    txt
            EOr  exps :: [Expecting (OffsideSymbol s)]
    exps                          -> [Expecting s] -> Expecting s
    forall s. [Expecting s] -> Expecting s
    EOr  ((Expecting (OffsideSymbol s) -> Expecting s)
    -> [Expecting (OffsideSymbol s)] -> [Expecting s]
    forall a b. (a -> b) -> [a] -> [b]
    map Expecting (OffsideSymbol s) -> Expecting s
    removeSymbol [Expecting (OffsideSymbol s)]
    exps)
            ESeq exps :: [Expecting (OffsideSymbol s)]
    exps                          -> [Expecting s] -> Expecting s
    forall s. [Expecting s] -> Expecting s
    ESeq ((Expecting (OffsideSymbol s) -> Expecting s)
    -> [Expecting (OffsideSymbol s)] -> [Expecting s]
    forall a b. (a -> b) -> [a] -> [b]
    map Expecting (OffsideSymbol s) -> Expecting s
    removeSymbol [Expecting (OffsideSymbol s)]
    exps)

    addSymbol :: Expecting s -> Expecting (OffsideSymbol s)
    addSymbol exp :: Expecting s
    exp = case Expecting s
    exp of
            ESym (Range l :: s
    l r :: s
    r) -> SymbolR (OffsideSymbol s) -> Expecting (OffsideSymbol s)
    forall s. SymbolR s -> Expecting s
    ESym (OffsideSymbol s -> OffsideSymbol s -> SymbolR (OffsideSymbol s)
    forall s. s -> s -> SymbolR s
    Range (s -> OffsideSymbol s
    forall s. s -> OffsideSymbol s
    Symbol s
    l) (s -> OffsideSymbol s
    forall s. s -> OffsideSymbol s
    Symbol s
    r))
            EStr txt :: String
    txt         -> String -> Expecting (OffsideSymbol s)
    forall s. String -> Expecting s
    EStr String
    txt
            EOr  exps :: [Expecting s]
    exps        -> [Expecting (OffsideSymbol s)] -> Expecting (OffsideSymbol s)
    forall s. [Expecting s] -> Expecting s
    EOr  ((Expecting s -> Expecting (OffsideSymbol s))
    -> [Expecting s] -> [Expecting (OffsideSymbol s)]
    forall a b. (a -> b) -> [a] -> [b]
    map Expecting s -> Expecting (OffsideSymbol s)
    addSymbol [Expecting s]
    exps)
            ESeq exps :: [Expecting s]
    exps        -> [Expecting (OffsideSymbol s)] -> Expecting (OffsideSymbol s)
    forall s. [Expecting s] -> Expecting s
    ESeq ((Expecting s -> Expecting (OffsideSymbol s))
    -> [Expecting s] -> [Expecting (OffsideSymbol s)]
    forall a b. (a -> b) -> [a] -> [b]
    map Expecting s -> Expecting (OffsideSymbol s)
    addSymbol [Expecting s]
    exps)

    getSymbol :: OffsideSymbol s -> s
    getSymbol (Symbol s :: s
    s) = s
    s

    operator :: (AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a
     -> AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a
     -> AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a)
    -> OffsideParser i o s p a
    -> OffsideParser i o s p a
    -> OffsideParser i o s p a
    operator  f :: AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a
    -> AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a
    -> AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a
    f (OP p :: AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a
    p) (OP q :: AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a
    q) = AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a
    -> OffsideParser i o s p a
    forall i (o :: * -> * -> *) s p a.
    AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a
    -> OffsideParser i o s p a
    OP (AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a
    -> AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a
    -> AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a
    f AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a
    p AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a
    q)
    operatorr :: (t
     -> AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a
     -> AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a)
    -> t -> OffsideParser i o s p a -> OffsideParser i o s p a
    operatorr f :: t
    -> AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a
    -> AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a
    f g :: t
    g (OP p :: AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a
    p) = AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a
    -> OffsideParser i o s p a
    forall i (o :: * -> * -> *) s p a.
    AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a
    -> OffsideParser i o s p a
    OP (t
    -> AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a
    -> AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a
    f t
    g AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a
    p)

    pSeparator :: (OutputState o, InputState i s p, Position p, Symbol s, Ord s)
               => OffsideParser i o s p ()
    pSeparator :: OffsideParser i o s p ()
    pSeparator = AnaParser (OffsideInput i s p) o (OffsideSymbol s) p ()
    -> OffsideParser i o s p ()
    forall i (o :: * -> * -> *) s p a.
    AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a
    -> OffsideParser i o s p a
    OP (() ()
    -> AnaParser
         (OffsideInput i s p) o (OffsideSymbol s) p (OffsideSymbol s)
    -> AnaParser (OffsideInput i s p) o (OffsideSymbol s) p ()
    forall (f :: * -> *) a b. Functor f => a -> f b -> f a
    <$ Int#
    -> OffsideSymbol s
    -> OffsideSymbol s
    -> AnaParser
         (OffsideInput i s p) o (OffsideSymbol s) p (OffsideSymbol s)
    forall (p :: * -> *) s. IsParser p s => Int# -> s -> s -> p s
    pCostSym 5# OffsideSymbol s
    forall s. OffsideSymbol s
    SemiColon OffsideSymbol s
    forall s. OffsideSymbol s
    SemiColon)

    pClose, pOpen :: (OutputState o, InputState i s p, Position p, Symbol s, Ord s)
               => OffsideParser i o s p ()

    pClose :: OffsideParser i o s p ()
    pClose = AnaParser (OffsideInput i s p) o (OffsideSymbol s) p ()
    -> OffsideParser i o s p ()
    forall i (o :: * -> * -> *) s p a.
    AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a
    -> OffsideParser i o s p a
    OP ((forall r r''.
     (() -> r -> r'')
     -> OffsideInput i s p
     -> Steps ((), r) (OffsideSymbol s) p
     -> (OffsideInput i s p -> Steps r (OffsideSymbol s) p)
     -> (OffsideInput i s p, Steps r'' (OffsideSymbol s) p,
         OffsideInput i s p -> Steps r (OffsideSymbol s) p))
    -> (forall r.
        OffsideInput i s p
        -> Steps r (OffsideSymbol s) p
        -> (OffsideInput i s p -> Steps r (OffsideSymbol s) p)
        -> (OffsideInput i s p, Steps r (OffsideSymbol s) p,
            OffsideInput i s p -> Steps r (OffsideSymbol s) p))
    -> AnaParser (OffsideInput i s p) o (OffsideSymbol s) p ()
    -> AnaParser (OffsideInput i s p) o (OffsideSymbol s) p ()
    forall (result :: * -> * -> *) b state a s p.
    OutputState result =>
    (forall r r''.
     (b -> r -> r'')
     -> state
     -> Steps (a, r) s p
     -> (state -> Steps r s p)
     -> (state, Steps r'' s p, state -> Steps r s p))
    -> (forall r.
        state
        -> Steps r s p
        -> (state -> Steps r s p)
        -> (state, Steps r s p, state -> Steps r s p))
    -> AnaParser state result s p a
    -> AnaParser state result s p b
    pWrap forall r r''.
    (() -> r -> r'')
    -> OffsideInput i s p
    -> Steps ((), r) (OffsideSymbol s) p
    -> (OffsideInput i s p -> Steps r (OffsideSymbol s) p)
    -> (OffsideInput i s p, Steps r'' (OffsideSymbol s) p,
        OffsideInput i s p -> Steps r (OffsideSymbol s) p)
    forall a b inp s p a s p.
    (() -> a -> b)
    -> OffsideInput inp s p
    -> Steps (a, a) s p
    -> (OffsideInput inp s p -> Steps a s p)
    -> (OffsideInput inp s p, Steps b s p,
        OffsideInput inp s p -> Steps a s p)
    f forall r.
    OffsideInput i s p
    -> Steps r (OffsideSymbol s) p
    -> (OffsideInput i s p -> Steps r (OffsideSymbol s) p)
    -> (OffsideInput i s p, Steps r (OffsideSymbol s) p,
        OffsideInput i s p -> Steps r (OffsideSymbol s) p)
    forall inp s p val s p.
    OffsideInput inp s p
    -> Steps val s p
    -> (OffsideInput inp s p -> Steps val s p)
    -> (OffsideInput inp s p, Steps val s p,
        OffsideInput inp s p -> Steps val s p)
    g ( () ()
    -> AnaParser
         (OffsideInput i s p) o (OffsideSymbol s) p (OffsideSymbol s)
    -> AnaParser (OffsideInput i s p) o (OffsideSymbol s) p ()
    forall (f :: * -> *) a b. Functor f => a -> f b -> f a
    <$ OffsideSymbol s
    -> AnaParser
         (OffsideInput i s p) o (OffsideSymbol s) p (OffsideSymbol s)
    forall (p :: * -> *) s. IsParser p s => s -> p s
    pSym OffsideSymbol s
    forall s. OffsideSymbol s
    CloseBrace) )
      where g :: OffsideInput inp s p
    -> Steps val s p
    -> (OffsideInput inp s p -> Steps val s p)
    -> (OffsideInput inp s p, Steps val s p,
        OffsideInput inp s p -> Steps val s p)
    g state :: OffsideInput inp s p
    state steps1 :: Steps val s p
    steps1 k :: OffsideInput inp s p -> Steps val s p
    k = (OffsideInput inp s p
    state,Steps val s p
    ar,OffsideInput inp s p -> Steps val s p
    k)
              where ar :: Steps val s p
    ar = case OffsideInput inp s p
    state of
                                   Off _ _ (Just state')
                                     -> let steps2 :: Steps val s p
    steps2 = OffsideInput inp s p -> Steps val s p
    k OffsideInput inp s p
    state'
                                        in if Bool -> Bool
    not (Steps val s p -> Bool
    forall a s p. Steps a s p -> Bool
    hasSuccess Steps val s p
    steps1) Bool -> Bool -> Bool
    && Steps val s p -> Bool
    forall a s p. Steps a s p -> Bool
    hasSuccess Steps val s p
    steps2
                                           then Int# -> Steps val s p -> Steps val s p
    forall val s p. Int# -> Steps val s p -> Steps val s p
    Cost 1# Steps val s p
    steps2
                                           else Steps val s p
    steps1
                                   _ -> Steps val s p
    steps1

            f :: (() -> a -> b)
    -> OffsideInput inp s p
    -> Steps (a, a) s p
    -> (OffsideInput inp s p -> Steps a s p)
    -> (OffsideInput inp s p, Steps b s p,
        OffsideInput inp s p -> Steps a s p)
    f acc :: () -> a -> b
    acc state :: OffsideInput inp s p
    state steps :: Steps (a, a) s p
    steps k :: OffsideInput inp s p -> Steps a s p
    k = let (stl :: OffsideInput inp s p
    stl,ar :: Steps a s p
    ar,str2rr :: OffsideInput inp s p -> Steps a s p
    str2rr) = OffsideInput inp s p
    -> Steps a s p
    -> (OffsideInput inp s p -> Steps a s p)
    -> (OffsideInput inp s p, Steps a s p,
        OffsideInput inp s p -> Steps a s p)
    forall inp s p val s p.
    OffsideInput inp s p
    -> Steps val s p
    -> (OffsideInput inp s p -> Steps val s p)
    -> (OffsideInput inp s p, Steps val s p,
        OffsideInput inp s p -> Steps val s p)
    g OffsideInput inp s p
    state (((a, a) -> a) -> Steps (a, a) s p -> Steps a s p
    forall a b s p. (a -> b) -> Steps a s p -> Steps b s p
    val (a, a) -> a
    forall a b. (a, b) -> b
    snd Steps (a, a) s p
    steps)  OffsideInput inp s p -> Steps a s p
    k
                                  in (OffsideInput inp s p
    stl ,(a -> b) -> Steps a s p -> Steps b s p
    forall a b s p. (a -> b) -> Steps a s p -> Steps b s p
    val (() -> a -> b
    acc ()) Steps a s p
    ar , OffsideInput inp s p -> Steps a s p
    str2rr )

    pOpen :: OffsideParser i o s p ()
    pOpen  = AnaParser (OffsideInput i s p) o (OffsideSymbol s) p ()
    -> OffsideParser i o s p ()
    forall i (o :: * -> * -> *) s p a.
    AnaParser (OffsideInput i s p) o (OffsideSymbol s) p a
    -> OffsideParser i o s p a
    OP (() ()
    -> AnaParser
         (OffsideInput i s p) o (OffsideSymbol s) p (OffsideSymbol s)
    -> AnaParser (OffsideInput i s p) o (OffsideSymbol s) p ()
    forall (f :: * -> *) a b. Functor f => a -> f b -> f a
    <$ OffsideSymbol s
    -> AnaParser
         (OffsideInput i s p) o (OffsideSymbol s) p (OffsideSymbol s)
    forall (p :: * -> *) s. IsParser p s => s -> p s
    pSym OffsideSymbol s
    forall s. OffsideSymbol s
    OpenBrace)

    pOffside :: (InputState i s p, OutputState o, Position p, Symbol s, Ord s)
             => OffsideParser i o s p x
             -> OffsideParser i o s p y
             -> OffsideParser i o s p a
             -> OffsideParser i o s p a
             -> OffsideParser i o s p a
    pOffside :: OffsideParser i o s p x
    -> OffsideParser i o s p y
    -> OffsideParser i o s p a
    -> OffsideParser i o s p a
    -> OffsideParser i o s p a
    pOffside open :: OffsideParser i o s p x
    open close :: OffsideParser i o s p y
    close bodyE :: OffsideParser i o s p a
    bodyE bodyI :: OffsideParser i o s p a
    bodyI =
           OffsideParser i o s p x
    open OffsideParser i o s p x
    -> OffsideParser i o s p a -> OffsideParser i o s p a
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> OffsideParser i o s p a
    bodyE OffsideParser i o s p a
    -> OffsideParser i o s p y -> OffsideParser i o s p a
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <* OffsideParser i o s p y
    close
       OffsideParser i o s p a
    -> OffsideParser i o s p a -> OffsideParser i o s p a
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> OffsideParser i o s p ()
    forall (o :: * -> * -> *) i s p.
    (OutputState o, InputState i s p, Position p, Symbol s, Ord s) =>
    OffsideParser i o s p ()
    pOpen OffsideParser i o s p ()
    -> OffsideParser i o s p a -> OffsideParser i o s p a
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> OffsideParser i o s p a
    bodyI OffsideParser i o s p a
    -> OffsideParser i o s p () -> OffsideParser i o s p a
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <* OffsideParser i o s p ()
    forall (o :: * -> * -> *) i s p.
    (OutputState o, InputState i s p, Position p, Symbol s, Ord s) =>
    OffsideParser i o s p ()
    pClose

    pBlock :: (InputState i s p, OutputState o, Position p, Symbol s, Ord s)
           => OffsideParser i o s p x
           -> OffsideParser i o s p y
           -> OffsideParser i o s p z
           -> OffsideParser i o s p a
           -> OffsideParser i o s p [a]
    pBlock :: OffsideParser i o s p x
    -> OffsideParser i o s p y
    -> OffsideParser i o s p z
    -> OffsideParser i o s p a
    -> OffsideParser i o s p [a]
    pBlock open :: OffsideParser i o s p x
    open sep :: OffsideParser i o s p y
    sep close :: OffsideParser i o s p z
    close p :: OffsideParser i o s p a
    p =  OffsideParser i o s p x
    -> OffsideParser i o s p z
    -> OffsideParser i o s p [a]
    -> OffsideParser i o s p [a]
    -> OffsideParser i o s p [a]
    forall i s p (o :: * -> * -> *) x y a.
    (InputState i s p, OutputState o, Position p, Symbol s, Ord s) =>
    OffsideParser i o s p x
    -> OffsideParser i o s p y
    -> OffsideParser i o s p a
    -> OffsideParser i o s p a
    -> OffsideParser i o s p a
    pOffside OffsideParser i o s p x
    open OffsideParser i o s p z
    close OffsideParser i o s p [a]
    explicit OffsideParser i o s p [a]
    implicit
     where elem :: OffsideParser i o s p (Maybe a)
    elem = (a -> Maybe a
    forall a. a -> Maybe a
    Just (a -> Maybe a)
    -> OffsideParser i o s p a -> OffsideParser i o s p (Maybe a)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> OffsideParser i o s p a
    p) OffsideParser i o s p (Maybe a)
    -> Maybe a -> OffsideParser i o s p (Maybe a)
    forall (p :: * -> *) s a. IsParser p s => p a -> a -> p a
    `opt` Maybe a
    forall a. Maybe a
    Nothing
           sep' :: OffsideParser i o s p ()
    sep' = () () -> OffsideParser i o s p y -> OffsideParser i o s p ()
    forall (f :: * -> *) a b. Functor f => a -> f b -> f a
    <$ OffsideParser i o s p y
    sep
           elems :: OffsideParser i o s p a -> OffsideParser i o s p [a]
    elems s :: OffsideParser i o s p a
    s = (\h :: Maybe a
    h t :: [Maybe a]
    t -> [Maybe a] -> [a]
    forall a. [Maybe a] -> [a]
    catMaybes (Maybe a
    hMaybe a -> [Maybe a] -> [Maybe a]
    forall a. a -> [a] -> [a]
    :[Maybe a]
    t)) (Maybe a -> [Maybe a] -> [a])
    -> OffsideParser i o s p (Maybe a)
    -> OffsideParser i o s p ([Maybe a] -> [a])
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> OffsideParser i o s p (Maybe a)
    elem OffsideParser i o s p ([Maybe a] -> [a])
    -> OffsideParser i o s p [Maybe a] -> OffsideParser i o s p [a]
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> OffsideParser i o s p (Maybe a) -> OffsideParser i o s p [Maybe a]
    forall (p :: * -> *) s a. IsParser p s => p a -> p [a]
    pList (OffsideParser i o s p a
    s OffsideParser i o s p a
    -> OffsideParser i o s p (Maybe a)
    -> OffsideParser i o s p (Maybe a)
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> OffsideParser i o s p (Maybe a)
    elem)
           explicit :: OffsideParser i o s p [a]
    explicit = OffsideParser i o s p () -> OffsideParser i o s p [a]
    forall a. OffsideParser i o s p a -> OffsideParser i o s p [a]
    elems OffsideParser i o s p ()
    sep'
           implicit :: OffsideParser i o s p [a]
    implicit = OffsideParser i o s p () -> OffsideParser i o s p [a]
    forall a. OffsideParser i o s p a -> OffsideParser i o s p [a]
    elems (OffsideParser i o s p ()
    sep' OffsideParser i o s p ()
    -> OffsideParser i o s p () -> OffsideParser i o s p ()
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> OffsideParser i o s p ()
    forall (o :: * -> * -> *) i s p.
    (OutputState o, InputState i s p, Position p, Symbol s, Ord s) =>
    OffsideParser i o s p ()
    pSeparator)
    {-
     where elem = (:) <$> p `opt` id
           sep' = () <$ sep
           elems s = ($[]) <$> pFoldr1Sep ((.),id) s elem
           explicit = elems sep'
           implicit = elems (sep' <|> pSeparator)
    -}

    pBlock1 :: (InputState i s p, OutputState o, Position p, Symbol s, Ord s)
           => OffsideParser i o s p x
           -> OffsideParser i o s p y
           -> OffsideParser i o s p z
           -> OffsideParser i o s p a
           -> OffsideParser i o s p [a]
    pBlock1 :: OffsideParser i o s p x
    -> OffsideParser i o s p y
    -> OffsideParser i o s p z
    -> OffsideParser i o s p a
    -> OffsideParser i o s p [a]
    pBlock1 open :: OffsideParser i o s p x
    open sep :: OffsideParser i o s p y
    sep close :: OffsideParser i o s p z
    close p :: OffsideParser i o s p a
    p =  OffsideParser i o s p x
    -> OffsideParser i o s p z
    -> OffsideParser i o s p [a]
    -> OffsideParser i o s p [a]
    -> OffsideParser i o s p [a]
    forall i s p (o :: * -> * -> *) x y a.
    (InputState i s p, OutputState o, Position p, Symbol s, Ord s) =>
    OffsideParser i o s p x
    -> OffsideParser i o s p y
    -> OffsideParser i o s p a
    -> OffsideParser i o s p a
    -> OffsideParser i o s p a
    pOffside OffsideParser i o s p x
    open OffsideParser i o s p z
    close OffsideParser i o s p [a]
    explicit OffsideParser i o s p [a]
    implicit
     where elem :: OffsideParser i o s p (Maybe a)
    elem = (a -> Maybe a
    forall a. a -> Maybe a
    Just (a -> Maybe a)
    -> OffsideParser i o s p a -> OffsideParser i o s p (Maybe a)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> OffsideParser i o s p a
    p) OffsideParser i o s p (Maybe a)
    -> Maybe a -> OffsideParser i o s p (Maybe a)
    forall (p :: * -> *) s a. IsParser p s => p a -> a -> p a
    `opt` Maybe a
    forall a. Maybe a
    Nothing
           sep' :: OffsideParser i o s p ()
    sep' = () () -> OffsideParser i o s p y -> OffsideParser i o s p ()
    forall (f :: * -> *) a b. Functor f => a -> f b -> f a
    <$ OffsideParser i o s p y
    sep
           elems :: OffsideParser i o s p a -> OffsideParser i o s p [a]
    elems s :: OffsideParser i o s p a
    s = (\h :: Maybe a
    h t :: [Maybe a]
    t -> [Maybe a] -> [a]
    forall a. [Maybe a] -> [a]
    catMaybes (Maybe a
    hMaybe a -> [Maybe a] -> [Maybe a]
    forall a. a -> [a] -> [a]
    :[Maybe a]
    t)) (Maybe a -> [Maybe a] -> [a])
    -> OffsideParser i o s p [a]
    -> OffsideParser i o s p (Maybe a -> [Maybe a] -> [a])
    forall (f :: * -> *) a b. Functor f => a -> f b -> f a
    <$ OffsideParser i o s p a -> OffsideParser i o s p [a]
    forall (p :: * -> *) s a. IsParser p s => p a -> p [a]
    pList OffsideParser i o s p a
    s OffsideParser i o s p (Maybe a -> [Maybe a] -> [a])
    -> OffsideParser i o s p (Maybe a)
    -> OffsideParser i o s p ([Maybe a] -> [a])
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> (a -> Maybe a
    forall a. a -> Maybe a
    Just (a -> Maybe a)
    -> OffsideParser i o s p a -> OffsideParser i o s p (Maybe a)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> OffsideParser i o s p a
    p) OffsideParser i o s p ([Maybe a] -> [a])
    -> OffsideParser i o s p [Maybe a] -> OffsideParser i o s p [a]
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> OffsideParser i o s p (Maybe a) -> OffsideParser i o s p [Maybe a]
    forall (p :: * -> *) s a. IsParser p s => p a -> p [a]
    pList (OffsideParser i o s p a
    s OffsideParser i o s p a
    -> OffsideParser i o s p (Maybe a)
    -> OffsideParser i o s p (Maybe a)
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> OffsideParser i o s p (Maybe a)
    elem)
           explicit :: OffsideParser i o s p [a]
    explicit = OffsideParser i o s p () -> OffsideParser i o s p [a]
    forall a. OffsideParser i o s p a -> OffsideParser i o s p [a]
    elems OffsideParser i o s p ()
    sep'
           implicit :: OffsideParser i o s p [a]
    implicit = OffsideParser i o s p () -> OffsideParser i o s p [a]
    forall a. OffsideParser i o s p a -> OffsideParser i o s p [a]
    elems (OffsideParser i o s p ()
    sep' OffsideParser i o s p ()
    -> OffsideParser i o s p () -> OffsideParser i o s p ()
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|> OffsideParser i o s p ()
    forall (o :: * -> * -> *) i s p.
    (OutputState o, InputState i s p, Position p, Symbol s, Ord s) =>
    OffsideParser i o s p ()
    pSeparator)
    {-
     where elem = (Just <$> p) `opt` Nothing
           sep' = () <$ sep
           elems s = (\h t -> catMaybes (h:t)) <$ pList s <*> (Just <$> p) <*> pList ( s *> elem)
           explicit = elems sep'
           implicit = elems (sep' <|> pSeparator)
    -}
    {-
    pBlock1 open sep close p =  pOffside open close explicit implicit
     where elem = (Just <$> p) <|> pSucceed Nothing
           sep' = () <$ sep
           elems s = (\h t -> catMaybes (h:t)) <$ pList s <*> (Just <$> p) <*> pList ( s *> elem)
           explicit = elems sep'
           implicit = elems (sep' <|> pSeparator)
    -}
    {-
    pBlock1 open sep close p =  pOffside open close explicit implicit
     where elem = (:) <$> p `opt` id
           sep' = () <$ sep
           elems s = (:) <$ pList s <*> p <*> (($[]) <$> pFoldr1Sep ((.),id) s elem)
           explicit = elems sep'
           implicit = elems (sep' <|> pSeparator)
    -}
    {-
    pBlock1 open sep close p =  pOffside open close explicit implicit
     where sep'    = () <$ sep
           elems s = pList s *> pList1Sep (pList1 s) p <* pList s
           explicit = elems sep'
           implicit = elems (sep' <|> pSeparator)
    -}

    parseOffside :: (Symbol s, InputState i s p, Position p)
                 => OffsideParser i Pair s p a
                 -> OffsideInput i s p
                 -> Steps (a, OffsideInput i s p) (OffsideSymbol s) p
    parseOffside :: OffsideParser i Pair s p a
    -> OffsideInput i s p
    -> Steps (a, OffsideInput i s p) (OffsideSymbol s) p
    parseOffside (OP p :: AnaParser (OffsideInput i s p) Pair (OffsideSymbol s) p a
    p) inp :: OffsideInput i s p
    inp = (Pair a (Pair (OffsideInput i s p) ()) -> (a, OffsideInput i s p))
    -> Steps
         (Pair a (Pair (OffsideInput i s p) ())) (OffsideSymbol s) p
    -> Steps (a, OffsideInput i s p) (OffsideSymbol s) p
    forall a b s p. (a -> b) -> Steps a s p -> Steps b s p
    val Pair a (Pair (OffsideInput i s p) ()) -> (a, OffsideInput i s p)
    forall a b r. Pair a (Pair b r) -> (a, b)
    fromPair (AnaParser (OffsideInput i s p) Pair (OffsideSymbol s) p a
    -> OffsideInput i s p
    -> Steps
         (Pair a (Pair (OffsideInput i s p) ())) (OffsideSymbol s) p
    forall s inp pos a.
    (Symbol s, InputState inp s pos) =>
    AnaParser inp Pair s pos a
    -> inp -> Steps (Pair a (Pair inp ())) s pos
    parse AnaParser (OffsideInput i s p) Pair (OffsideSymbol s) p a
    p OffsideInput i s p
    inp)
      where fromPair :: Pair a (Pair b r) -> (a, b)
    fromPair (Pair x :: a
    x (Pair y :: b
    y _)) = (a
    x,b
    y)