machine: fix mayRaise analysis of catch
[haskell/symantic-parser.git] / test / Golden / Splice / G10.expected.txt
index cdc019a85bd80dd5a504a6e1c481bd9fde1e9da6..e669c0e03d0916310407cc4bf4a3222ff2038483 100644 (file)
-\(input_0 :: inp_6989586621679059048) ->
+\(input :: inp) ->
   let !(#
-         init_1,
-         readMore_2,
-         readNext_3
+         init,
+         readMore,
+         readNext
          #) =
           let _ = "cursorOf"
-           in let next_4
-                    ( t_5@( Data.Text.Internal.Text
-                              arr_6
-                              off_7
-                              unconsumed_8
-                            )
+           in let next
+                    ( t@( Data.Text.Internal.Text
+                            arr
+                            off
+                            unconsumed
+                          )
                       ) =
                       let !( Data.Text.Unsafe.Iter
-                               c_9
-                               d_10
-                             ) = Data.Text.Unsafe.iter t_5 0
+                               c
+                               d
+                             ) = Data.Text.Unsafe.iter t 0
                        in (#
-                            c_9,
-                            Data.Text.Internal.Text arr_6 (off_7 GHC.Num.+ d_10) (unconsumed_8 GHC.Num.- d_10)
+                            c,
+                            Data.Text.Internal.Text arr (off GHC.Num.+ d) (unconsumed GHC.Num.- d)
                           #)
-                  more_11
+                  more
                     ( Data.Text.Internal.Text
                         _
                         _
-                        unconsumed_12
-                      ) = unconsumed_12 GHC.Classes.> 0
-               in (#
-                    input_0,
-                    more_11,
-                    next_4
-                  #)
-   in let finalRet_13 = \_farInp_14 _farExp_15 v_16 _inp_17 -> Data.Either.Right v_16
-       in let finalRaise_18 ::
-                forall b_19.
-                Symantic.Parser.Machine.Generate.Catcher
-                  inp_6989586621679059048
-                  b_19 = \_failInp_20 (!farInp_21) (!farExp_22) ->
-                  Data.Either.Left
-                    Symantic.Parser.Machine.Generate.ParsingErrorStandard
-                      { Symantic.Parser.Machine.Generate.parsingErrorOffset = Symantic.Parser.Machine.Input.offset farInp_21,
-                        Symantic.Parser.Machine.Generate.parsingErrorUnexpected =
-                          if readMore_2 farInp_21
-                            then
-                              GHC.Maybe.Just
-                                ( let (#
-                                        c_23,
-                                        _
-                                        #) = readNext_3 farInp_21
-                                   in c_23
-                                )
-                            else GHC.Maybe.Nothing,
-                        Symantic.Parser.Machine.Generate.parsingErrorExpecting = Data.Set.Internal.fromList farExp_22
-                      }
-           in let
-               in let _ = "catchException lbl=fail"
-                   in let catchHandler_24 (!failInp_25) (!farInp_26) (!farExp_27) =
-                            let _ = "catchException.ko lbl=fail"
+                        unconsumed
+                      ) = unconsumed GHC.Classes.> 0
+               in (# input, more, next #)
+      finalRet = \_farInp _farExp v _inp -> Data.Either.Right v
+      finalRaise ::
+        forall b.
+        Symantic.Parser.Machine.Generate.Catcher
+          inp
+          b = \(!exn) _failInp (!farInp) (!farExp) ->
+          Data.Either.Left
+            Symantic.Parser.Machine.Generate.ParsingErrorStandard
+              { Symantic.Parser.Machine.Generate.parsingErrorOffset = Symantic.Parser.Machine.Input.offset farInp,
+                Symantic.Parser.Machine.Generate.parsingErrorException = exn,
+                Symantic.Parser.Machine.Generate.parsingErrorUnexpected =
+                  if readMore farInp
+                    then
+                      GHC.Maybe.Just
+                        ( let (#
+                                c,
+                                _
+                                #) = readNext farInp
+                           in c
+                        )
+                    else GHC.Maybe.Nothing,
+                Symantic.Parser.Machine.Generate.parsingErrorExpecting = farExp
+              }
+   in let inputToken = Data.Proxy.Proxy :: Data.Proxy.Proxy (Symantic.Parser.Machine.Input.InputToken inp)
+       in let
+           in let join = \farInp farExp v (!inp) ->
+                    let _ = "resume"
+                     in finalRet
+                          farInp
+                          farExp
+                          ( let _ = "resume.genCode"
+                             in GHC.Show.show v
+                          )
+                          inp
+               in let _ = "catch ExceptionFailure"
+                   in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =
+                            let _ = "catch.ko ExceptionFailure"
                              in if ( \( Data.Text.Internal.Text
                                           _
-                                          i_28
+                                          i
                                           _
                                         )
                                       ( Data.Text.Internal.Text
                                           _
-                                          j_29
+                                          j
                                           _
-                                        ) -> i_28 GHC.Classes.== j_29
+                                        ) -> i GHC.Classes.== j
                                    )
-                                  init_1
-                                  failInp_25
+                                  init
+                                  failInp
                                   then
                                     let _ = "choicesBranch.then"
-                                     in let readFail_30 = finalRaise_18
-                                         in if readMore_2 failInp_25
+                                     in let readFail = finalRaise
+                                         in if readMore failInp
                                               then
                                                 let !(#
-                                                       c_31,
-                                                       cs_32
-                                                       #) = readNext_3 failInp_25
-                                                 in if ('b' GHC.Classes.==) c_31
+                                                       c,
+                                                       cs
+                                                       #) = readNext failInp
+                                                 in if ('b' GHC.Classes.==) c
                                                       then
                                                         let _ = "resume"
-                                                         in finalRet_13
-                                                              farInp_26
-                                                              farExp_27
+                                                         in join
+                                                              farInp
+                                                              farExp
                                                               ( let _ = "resume.genCode"
                                                                  in 'b'
                                                               )
-                                                              cs_32
+                                                              cs
                                                       else
                                                         let _ = "checkToken.else"
-                                                         in let (#
-                                                                  farInp_33,
-                                                                  farExp_34
-                                                                  #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp_26 failInp_25 of
+                                                         in let failExp =
+                                                                  Data.Set.Internal.Bin
+                                                                    1
+                                                                    ( Symantic.Parser.Grammar.Combinators.SomeFailure
+                                                                        ( case inputToken of
+                                                                            (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'b'
+                                                                        )
+                                                                    )
+                                                                    Data.Set.Internal.Tip
+                                                                    Data.Set.Internal.Tip
+                                                                (#
+                                                                  farInp,
+                                                                  farExp
+                                                                  #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp failInp of
                                                                     GHC.Types.LT ->
                                                                       (#
-                                                                        failInp_25,
-                                                                        [Symantic.Parser.Grammar.Combinators.ErrorItemToken 'b']
+                                                                        failInp,
+                                                                        failExp
                                                                       #)
                                                                     GHC.Types.EQ ->
                                                                       (#
-                                                                        farInp_26,
-                                                                        farExp_27 GHC.Base.<> [Symantic.Parser.Grammar.Combinators.ErrorItemToken 'b']
+                                                                        farInp,
+                                                                        failExp GHC.Base.<> farExp
                                                                       #)
                                                                     GHC.Types.GT ->
                                                                       (#
-                                                                        farInp_26,
-                                                                        farExp_27
+                                                                        farInp,
+                                                                        farExp
                                                                       #)
-                                                             in finalRaise_18 failInp_25 farInp_33 farExp_34
+                                                             in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp
                                               else
                                                 let _ = "checkHorizon.else"
-                                                 in let (#
-                                                          farInp_35,
-                                                          farExp_36
-                                                          #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp_26 failInp_25 of
+                                                 in let failExp =
+                                                          Data.Set.Internal.Bin
+                                                            1
+                                                            ( Symantic.Parser.Grammar.Combinators.SomeFailure
+                                                                ( case inputToken of
+                                                                    (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 1
+                                                                )
+                                                            )
+                                                            Data.Set.Internal.Tip
+                                                            Data.Set.Internal.Tip
+                                                        (#
+                                                          farInp,
+                                                          farExp
+                                                          #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp failInp of
                                                             GHC.Types.LT ->
                                                               (#
-                                                                failInp_25,
-                                                                [Symantic.Parser.Grammar.Combinators.ErrorItemHorizon 1]
+                                                                failInp,
+                                                                failExp
                                                               #)
                                                             GHC.Types.EQ ->
                                                               (#
-                                                                farInp_26,
-                                                                farExp_27 GHC.Base.<> [Symantic.Parser.Grammar.Combinators.ErrorItemHorizon 1]
+                                                                farInp,
+                                                                failExp GHC.Base.<> farExp
                                                               #)
                                                             GHC.Types.GT ->
                                                               (#
-                                                                farInp_26,
-                                                                farExp_27
+                                                                farInp,
+                                                                farExp
                                                               #)
-                                                     in finalRaise_18 failInp_25 farInp_35 farExp_36
+                                                     in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp
                                   else
                                     let _ = "choicesBranch.else"
-                                     in let (#
-                                              farInp_37,
-                                              farExp_38
-                                              #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp_26 failInp_25 of
-                                                GHC.Types.LT ->
-                                                  (#
-                                                    failInp_25,
-                                                    []
-                                                  #)
-                                                GHC.Types.EQ ->
-                                                  (#
-                                                    farInp_26,
-                                                    farExp_27 GHC.Base.<> []
-                                                  #)
-                                                GHC.Types.GT ->
-                                                  (#
-                                                    farInp_26,
-                                                    farExp_27
-                                                  #)
-                                         in finalRaise_18 failInp_25 farInp_37 farExp_38
-                       in let readFail_39 = catchHandler_24
-                           in if readMore_2 init_1
+                                     in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp
+                       in let readFail = catchHandler
+                           in if readMore init
                                 then
-                                  let !(#
-                                         c_40,
-                                         cs_41
-                                         #) = readNext_3 init_1
-                                   in if ('a' GHC.Classes.==) c_40
+                                  let !(# c, cs #) = readNext init
+                                   in if ('a' GHC.Classes.==) c
                                         then
                                           let _ = "resume"
-                                           in finalRet_13 init_1 GHC.Types
-                                                . []
-                                                  ( let _ = "resume.genCode"
-                                                     in 'a'
-                                                  )
-                                                  cs_41
+                                           in join
+                                                init
+                                                Data.Set.Internal.empty
+                                                ( let _ = "resume.genCode"
+                                                   in 'a'
+                                                )
+                                                cs
                                         else
                                           let _ = "checkToken.else"
-                                           in let (#
-                                                    farInp_42,
-                                                    farExp_43
-                                                    #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init_1 init_1 of
+                                           in let failExp =
+                                                    Data.Set.Internal.Bin
+                                                      1
+                                                      ( Symantic.Parser.Grammar.Combinators.SomeFailure
+                                                          ( case inputToken of
+                                                              (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'a'
+                                                          )
+                                                      )
+                                                      Data.Set.Internal.Tip
+                                                      Data.Set.Internal.Tip
+                                                  (#
+                                                    farInp,
+                                                    farExp
+                                                    #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init init of
                                                       GHC.Types.LT ->
                                                         (#
-                                                          init_1,
-                                                          [Symantic.Parser.Grammar.Combinators.ErrorItemToken 'a']
+                                                          init,
+                                                          failExp
                                                         #)
                                                       GHC.Types.EQ ->
                                                         (#
-                                                          init_1,
-                                                          GHC.Types . [] GHC.Base.<> [Symantic.Parser.Grammar.Combinators.ErrorItemToken 'a']
+                                                          init,
+                                                          failExp GHC.Base.<> Data.Set.Internal.empty
                                                         #)
                                                       GHC.Types.GT ->
                                                         (#
-                                                          init_1,
-                                                          GHC.Types . []
+                                                          init,
+                                                          Data.Set.Internal.empty
                                                         #)
-                                               in readFail_39 init_1 farInp_42 farExp_43
+                                               in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure init farInp farExp
                                 else
                                   let _ = "checkHorizon.else"
-                                   in let (#
-                                            farInp_44,
-                                            farExp_45
-                                            #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init_1 init_1 of
+                                   in let failExp =
+                                            Data.Set.Internal.Bin
+                                              1
+                                              ( Symantic.Parser.Grammar.Combinators.SomeFailure
+                                                  ( case inputToken of
+                                                      (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 1
+                                                  )
+                                              )
+                                              Data.Set.Internal.Tip
+                                              Data.Set.Internal.Tip
+                                          (#
+                                            farInp,
+                                            farExp
+                                            #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init init of
                                               GHC.Types.LT ->
                                                 (#
-                                                  init_1,
-                                                  [Symantic.Parser.Grammar.Combinators.ErrorItemHorizon 1]
+                                                  init,
+                                                  failExp
                                                 #)
                                               GHC.Types.EQ ->
                                                 (#
-                                                  init_1,
-                                                  GHC.Types . [] GHC.Base.<> [Symantic.Parser.Grammar.Combinators.ErrorItemHorizon 1]
+                                                  init,
+                                                  failExp GHC.Base.<> Data.Set.Internal.empty
                                                 #)
                                               GHC.Types.GT ->
                                                 (#
-                                                  init_1,
-                                                  GHC.Types . []
+                                                  init,
+                                                  Data.Set.Internal.empty
                                                 #)
-                                       in readFail_39 init_1 farInp_44 farExp_45
+                                       in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure init farInp farExp