]> Git — Sourcephile - haskell/symantic-parser.git/blob - test/Golden/Splice/G16.expected.txt
machine: fix mayRaise analysis of catch
[haskell/symantic-parser.git] / test / Golden / Splice / G16.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
55 in let join = \farInp farExp v (!inp) ->
56 let readFail = finalRaise
57 in if readMore inp
58 then
59 let !(#
60 c,
61 cs
62 #) = readNext inp
63 in if ('d' GHC.Classes.==) c
64 then
65 let _ = "resume"
66 in finalRet
67 farInp
68 farExp
69 ( let _ = "resume.genCode"
70 in GHC.Show.show v
71 )
72 cs
73 else
74 let _ = "checkToken.else"
75 in let failExp =
76 Data.Set.Internal.Bin
77 1
78 ( Symantic.Parser.Grammar.Combinators.SomeFailure
79 ( case inputToken of
80 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'd'
81 )
82 )
83 Data.Set.Internal.Tip
84 Data.Set.Internal.Tip
85 (#
86 farInp,
87 farExp
88 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp inp of
89 GHC.Types.LT ->
90 (#
91 inp,
92 failExp
93 #)
94 GHC.Types.EQ ->
95 (#
96 farInp,
97 failExp GHC.Base.<> farExp
98 #)
99 GHC.Types.GT ->
100 (#
101 farInp,
102 farExp
103 #)
104 in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp
105 else
106 let _ = "checkHorizon.else"
107 in let failExp =
108 Data.Set.Internal.Bin
109 1
110 ( Symantic.Parser.Grammar.Combinators.SomeFailure
111 ( case inputToken of
112 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 1
113 )
114 )
115 Data.Set.Internal.Tip
116 Data.Set.Internal.Tip
117 (#
118 farInp,
119 farExp
120 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp inp of
121 GHC.Types.LT ->
122 (#
123 inp,
124 failExp
125 #)
126 GHC.Types.EQ ->
127 (#
128 farInp,
129 failExp GHC.Base.<> farExp
130 #)
131 GHC.Types.GT ->
132 (#
133 farInp,
134 farExp
135 #)
136 in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp
137 in let _ = "catch ExceptionFailure"
138 in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =
139 let _ = "catch.ko ExceptionFailure"
140 in if ( \( Data.Text.Internal.Text
141 _
142 i
143 _
144 )
145 ( Data.Text.Internal.Text
146 _
147 j
148 _
149 ) -> i GHC.Classes.== j
150 )
151 init
152 failInp
153 then
154 let _ = "choicesBranch.then"
155 in let readFail = finalRaise
156 in if readMore (Symantic.Parser.Machine.Input.shiftRightText 1 failInp)
157 then
158 let !(#
159 c,
160 cs
161 #) = readNext failInp
162 in if ('c' GHC.Classes.==) c
163 then
164 let _ = "resume"
165 in join
166 farInp
167 farExp
168 ( let _ = "resume.genCode"
169 in 'c'
170 )
171 cs
172 else
173 let _ = "checkToken.else"
174 in let failExp =
175 Data.Set.Internal.Bin
176 1
177 ( Symantic.Parser.Grammar.Combinators.SomeFailure
178 ( case inputToken of
179 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'c'
180 )
181 )
182 Data.Set.Internal.Tip
183 Data.Set.Internal.Tip
184 (#
185 farInp,
186 farExp
187 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp failInp of
188 GHC.Types.LT ->
189 (#
190 failInp,
191 failExp
192 #)
193 GHC.Types.EQ ->
194 (#
195 farInp,
196 failExp GHC.Base.<> farExp
197 #)
198 GHC.Types.GT ->
199 (#
200 farInp,
201 farExp
202 #)
203 in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp
204 else
205 let _ = "checkHorizon.else"
206 in let failExp =
207 Data.Set.Internal.Bin
208 1
209 ( Symantic.Parser.Grammar.Combinators.SomeFailure
210 ( case inputToken of
211 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 2
212 )
213 )
214 Data.Set.Internal.Tip
215 Data.Set.Internal.Tip
216 (#
217 farInp,
218 farExp
219 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp failInp of
220 GHC.Types.LT ->
221 (#
222 failInp,
223 failExp
224 #)
225 GHC.Types.EQ ->
226 (#
227 farInp,
228 failExp GHC.Base.<> farExp
229 #)
230 GHC.Types.GT ->
231 (#
232 farInp,
233 farExp
234 #)
235 in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp
236 else
237 let _ = "choicesBranch.else"
238 in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp
239 in let join = \farInp farExp v (!inp) ->
240 let _ = "resume"
241 in join
242 farInp
243 farExp
244 ( let _ = "resume.genCode"
245 in v
246 )
247 inp
248 in let _ = "catch ExceptionFailure"
249 in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =
250 let _ = "catch.ko ExceptionFailure"
251 in if ( \( Data.Text.Internal.Text
252 _
253 i
254 _
255 )
256 ( Data.Text.Internal.Text
257 _
258 j
259 _
260 ) -> i GHC.Classes.== j
261 )
262 init
263 failInp
264 then
265 let _ = "choicesBranch.then"
266 in let readFail = catchHandler
267 in if readMore (Symantic.Parser.Machine.Input.shiftRightText 1 failInp)
268 then
269 let !(#
270 c,
271 cs
272 #) = readNext failInp
273 in if ('b' GHC.Classes.==) c
274 then
275 let _ = "resume"
276 in join
277 farInp
278 farExp
279 ( let _ = "resume.genCode"
280 in 'b'
281 )
282 cs
283 else
284 let _ = "checkToken.else"
285 in let failExp =
286 Data.Set.Internal.Bin
287 1
288 ( Symantic.Parser.Grammar.Combinators.SomeFailure
289 ( case inputToken of
290 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'b'
291 )
292 )
293 Data.Set.Internal.Tip
294 Data.Set.Internal.Tip
295 (#
296 farInp,
297 farExp
298 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp failInp of
299 GHC.Types.LT ->
300 (#
301 failInp,
302 failExp
303 #)
304 GHC.Types.EQ ->
305 (#
306 farInp,
307 failExp GHC.Base.<> farExp
308 #)
309 GHC.Types.GT ->
310 (#
311 farInp,
312 farExp
313 #)
314 in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp
315 else
316 let _ = "checkHorizon.else"
317 in let failExp =
318 Data.Set.Internal.Bin
319 1
320 ( Symantic.Parser.Grammar.Combinators.SomeFailure
321 ( case inputToken of
322 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 2
323 )
324 )
325 Data.Set.Internal.Tip
326 Data.Set.Internal.Tip
327 (#
328 farInp,
329 farExp
330 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp failInp of
331 GHC.Types.LT ->
332 (#
333 failInp,
334 failExp
335 #)
336 GHC.Types.EQ ->
337 (#
338 farInp,
339 failExp GHC.Base.<> farExp
340 #)
341 GHC.Types.GT ->
342 (#
343 farInp,
344 farExp
345 #)
346 in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp
347 else
348 let _ = "choicesBranch.else"
349 in catchHandler Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp
350 in let readFail = catchHandler
351 in if readMore (Symantic.Parser.Machine.Input.shiftRightText 1 init)
352 then
353 let !(# c, cs #) = readNext init
354 in if ('a' GHC.Classes.==) c
355 then
356 let _ = "resume"
357 in join
358 init
359 Data.Set.Internal.empty
360 ( let _ = "resume.genCode"
361 in 'a'
362 )
363 cs
364 else
365 let _ = "checkToken.else"
366 in let failExp =
367 Data.Set.Internal.Bin
368 1
369 ( Symantic.Parser.Grammar.Combinators.SomeFailure
370 ( case inputToken of
371 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'a'
372 )
373 )
374 Data.Set.Internal.Tip
375 Data.Set.Internal.Tip
376 (#
377 farInp,
378 farExp
379 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init init of
380 GHC.Types.LT ->
381 (#
382 init,
383 failExp
384 #)
385 GHC.Types.EQ ->
386 (#
387 init,
388 failExp GHC.Base.<> Data.Set.Internal.empty
389 #)
390 GHC.Types.GT ->
391 (#
392 init,
393 Data.Set.Internal.empty
394 #)
395 in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure init farInp farExp
396 else
397 let _ = "checkHorizon.else"
398 in let failExp =
399 Data.Set.Internal.Bin
400 1
401 ( Symantic.Parser.Grammar.Combinators.SomeFailure
402 ( case inputToken of
403 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 2
404 )
405 )
406 Data.Set.Internal.Tip
407 Data.Set.Internal.Tip
408 (#
409 farInp,
410 farExp
411 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init init of
412 GHC.Types.LT ->
413 (#
414 init,
415 failExp
416 #)
417 GHC.Types.EQ ->
418 (#
419 init,
420 failExp GHC.Base.<> Data.Set.Internal.empty
421 #)
422 GHC.Types.GT ->
423 (#
424 init,
425 Data.Set.Internal.empty
426 #)
427 in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure init farInp farExp