]> Git — Sourcephile - haskell/symantic-parser.git/blob - test/Golden/Splice/G3.expected.txt
machine: fix mayRaise analysis of catch
[haskell/symantic-parser.git] / test / Golden / Splice / G3.expected.txt
1 \(input :: inp) ->
2 let !(#
3 init,
4 readMore,
5 readNext
6 #) =
7 let _ = "cursorOf"
8 in let next
9 ( t@( Data.Text.Internal.Text
10 arr
11 off
12 unconsumed
13 )
14 ) =
15 let !( Data.Text.Unsafe.Iter
16 c
17 d
18 ) = Data.Text.Unsafe.iter t 0
19 in (#
20 c,
21 Data.Text.Internal.Text arr (off GHC.Num.+ d) (unconsumed GHC.Num.- d)
22 #)
23 more
24 ( Data.Text.Internal.Text
25 _
26 _
27 unconsumed
28 ) = unconsumed GHC.Classes.> 0
29 in (# input, more, next #)
30 finalRet = \_farInp _farExp v _inp -> Data.Either.Right v
31 finalRaise ::
32 forall b.
33 Symantic.Parser.Machine.Generate.Catcher
34 inp
35 b = \(!exn) _failInp (!farInp) (!farExp) ->
36 Data.Either.Left
37 Symantic.Parser.Machine.Generate.ParsingErrorStandard
38 { Symantic.Parser.Machine.Generate.parsingErrorOffset = Symantic.Parser.Machine.Input.offset farInp,
39 Symantic.Parser.Machine.Generate.parsingErrorException = exn,
40 Symantic.Parser.Machine.Generate.parsingErrorUnexpected =
41 if readMore farInp
42 then
43 GHC.Maybe.Just
44 ( let (#
45 c,
46 _
47 #) = readNext farInp
48 in c
49 )
50 else GHC.Maybe.Nothing,
51 Symantic.Parser.Machine.Generate.parsingErrorExpecting = farExp
52 }
53 in let inputToken = Data.Proxy.Proxy :: Data.Proxy.Proxy (Symantic.Parser.Machine.Input.InputToken inp)
54 in let name = \(!ok) (!inp) (!koByLabel) ->
55 let _ = "catch ExceptionFailure"
56 in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =
57 let _ = "catch.ko ExceptionFailure"
58 in if ( \( Data.Text.Internal.Text
59 _
60 i
61 _
62 )
63 ( Data.Text.Internal.Text
64 _
65 j
66 _
67 ) -> i GHC.Classes.== j
68 )
69 inp
70 failInp
71 then
72 let _ = "choicesBranch.then"
73 in let _ = "resume"
74 in ok
75 farInp
76 farExp
77 ( let _ = "resume.genCode"
78 in \x -> x
79 )
80 failInp
81 else
82 let _ = "choicesBranch.else"
83 in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp
84 in let readFail = catchHandler
85 in if readMore inp
86 then
87 let !(#
88 c,
89 cs
90 #) = readNext inp
91 in if ('a' GHC.Classes.==) c
92 then
93 name
94 ( let _ = "suspend"
95 in \farInp farExp v (!inp) ->
96 let _ = "resume"
97 in ok
98 farInp
99 farExp
100 ( let _ = "resume.genCode"
101 in \x -> 'a' GHC.Types.: v x
102 )
103 inp
104 )
105 cs
106 Data.Map.Internal.Tip
107 else
108 let _ = "checkToken.else"
109 in let failExp =
110 Data.Set.Internal.Bin
111 1
112 ( Symantic.Parser.Grammar.Combinators.SomeFailure
113 ( case inputToken of
114 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'a'
115 )
116 )
117 Data.Set.Internal.Tip
118 Data.Set.Internal.Tip
119 (#
120 farInp,
121 farExp
122 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of
123 GHC.Types.LT ->
124 (#
125 inp,
126 failExp
127 #)
128 GHC.Types.EQ ->
129 (#
130 init,
131 failExp GHC.Base.<> Data.Set.Internal.empty
132 #)
133 GHC.Types.GT ->
134 (#
135 init,
136 Data.Set.Internal.empty
137 #)
138 in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp
139 else
140 let _ = "checkHorizon.else"
141 in let failExp =
142 Data.Set.Internal.Bin
143 1
144 ( Symantic.Parser.Grammar.Combinators.SomeFailure
145 ( case inputToken of
146 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 1
147 )
148 )
149 Data.Set.Internal.Tip
150 Data.Set.Internal.Tip
151 (#
152 farInp,
153 farExp
154 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of
155 GHC.Types.LT ->
156 (#
157 inp,
158 failExp
159 #)
160 GHC.Types.EQ ->
161 (#
162 init,
163 failExp GHC.Base.<> Data.Set.Internal.empty
164 #)
165 GHC.Types.GT ->
166 (#
167 init,
168 Data.Set.Internal.empty
169 #)
170 in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp
171 in name
172 ( let _ = "suspend"
173 in \farInp farExp v (!inp) ->
174 let _ = "resume"
175 in finalRet
176 farInp
177 farExp
178 ( let _ = "resume.genCode"
179 in GHC.Show.show (v GHC.Types . [])
180 )
181 inp
182 )
183 init
184 Data.Map.Internal.Tip