]> Git — Sourcephile - haskell/symantic-parser.git/blob - test/Golden/Splice/G5.expected.txt
machine: make failure be minReads=0
[haskell/symantic-parser.git] / test / Golden / Splice / G5.expected.txt
1 \(input_0 :: inp_6989586621679040759) ->
2 let !(#
3 init_1,
4 readMore_2,
5 readNext_3
6 #) =
7 let _ = "cursorOf"
8 in let next_4
9 ( t_5@( Data.Text.Internal.Text
10 arr_6
11 off_7
12 unconsumed_8
13 )
14 ) =
15 let !( Data.Text.Unsafe.Iter
16 c_9
17 d_10
18 ) = Data.Text.Unsafe.iter t_5 0
19 in (#
20 c_9,
21 Data.Text.Internal.Text arr_6 (off_7 GHC.Num.+ d_10) (unconsumed_8 GHC.Num.- d_10)
22 #)
23 more_11
24 ( Data.Text.Internal.Text
25 _
26 _
27 unconsumed_12
28 ) = unconsumed_12 GHC.Classes.> 0
29 in (#
30 input_0,
31 more_11,
32 next_4
33 #)
34 finalRet_13 = \_farInp_14 _farExp_15 v_16 _inp_17 -> Symantic.Parser.Machine.Generate.returnST GHC.Base.$ Data.Either.Right v_16
35 finalRaise_18 ::
36 forall st_19 b_20.
37 Symantic.Parser.Machine.Generate.Catcher
38 st_19
39 inp_6989586621679040759
40 b_20 = \(!exn_21) _failInp_22 (!farInp_23) (!farExp_24) ->
41 Symantic.Parser.Machine.Generate.returnST GHC.Base.$
42 Data.Either.Left
43 Symantic.Parser.Machine.Generate.ParsingError
44 { Symantic.Parser.Machine.Generate.parsingErrorOffset = Symantic.Parser.Machine.Input.offset farInp_23,
45 Symantic.Parser.Machine.Generate.parsingErrorException = exn_21,
46 Symantic.Parser.Machine.Generate.parsingErrorUnexpected =
47 if readMore_2 farInp_23
48 then
49 GHC.Maybe.Just
50 ( let (#
51 c_25,
52 _
53 #) = readNext_3 farInp_23
54 in c_25
55 )
56 else GHC.Maybe.Nothing,
57 Symantic.Parser.Machine.Generate.parsingErrorExpecting =
58 let ( minHoriz_26,
59 res_27
60 ) =
61 Data.Set.Internal.foldr
62 ( \f_28
63 ( minH_29,
64 acc_30
65 ) -> case Symantic.Parser.Grammar.Combinators.unSomeFailure f_28 of
66 GHC.Maybe.Just (Symantic.Parser.Grammar.Combinators.FailureHorizon h_31 :: Symantic.Parser.Grammar.Combinators.Failure (Symantic.Parser.Grammar.Combinators.CombSatisfiable (Symantic.Parser.Machine.Input.InputToken inp_6989586621679040759)))
67 | GHC.Maybe.Just old_32 <- minH_29 ->
68 ( GHC.Maybe.Just (GHC.Classes.min old_32 h_31),
69 acc_30
70 )
71 | GHC.Base.otherwise ->
72 ( GHC.Maybe.Just h_31,
73 acc_30
74 )
75 _ ->
76 ( minH_29,
77 f_28 GHC.Types.: acc_30
78 )
79 )
80 ( GHC.Maybe.Nothing,
81 GHC.Types . []
82 )
83 farExp_24
84 in Data.Set.Internal.fromList GHC.Base.$
85 ( case minHoriz_26 of
86 GHC.Maybe.Just h_33 -> Symantic.Parser.Grammar.Combinators.SomeFailure (Symantic.Parser.Grammar.Combinators.FailureHorizon @(Symantic.Parser.Machine.Input.InputToken inp_6989586621679040759) h_33) GHC.Types.: res_27
87 GHC.Maybe.Nothing -> res_27
88 )
89 }
90 in GHC.ST.runST
91 ( let inputToken = Data.Proxy.Proxy :: Data.Proxy.Proxy (Symantic.Parser.Machine.Input.InputToken inp_6989586621679040759)
92 in let _ = "checkHorizon.noCheck"
93 in let name_34 = \(!callReturn_35) (!callInput_36) (!callCatchStackByLabel_37) ->
94 let _ = "catch ExceptionFailure"
95 in let catchHandler_38 (!_exn_39) (!failInp_40) (!farInp_41) (!farExp_42) =
96 let _ = "catch.ko ExceptionFailure"
97 in let _ = "loadInput"
98 in let _ = "checkHorizon.noCheck"
99 in Data.Map.Strict.Internal.findWithDefault finalRaise_18 Symantic.Parser.Grammar.Combinators.ExceptionFailure callCatchStackByLabel_37 Symantic.Parser.Grammar.Combinators.ExceptionFailure callInput_36 farInp_41 farExp_42
100 in let _ = "pushValue"
101 in let _ = "comment: satisfy"
102 in let inp_43 = callInput_36
103 in let readFail_44 = catchHandler_38
104 in let _ = "checkHorizon.newCheck: checkedHorizon=0 minHoriz=4"
105 in if readMore_2 (Symantic.Parser.Machine.Input.shiftRightText 3 inp_43)
106 then
107 let _ = "checkToken"
108 in let !(#
109 c_45,
110 cs_46
111 #) = readNext_3 inp_43
112 in if (GHC.Classes.==) 'a' c_45
113 then
114 let _ = "comment: satisfy"
115 in let _ = "checkHorizon.oldCheck: checkedHorizon=4"
116 in let _ = "checkToken"
117 in let !(#
118 c_47,
119 cs_48
120 #) = readNext_3 cs_46
121 in if (GHC.Classes.==) 'b' c_47
122 then
123 let _ = "comment: satisfy"
124 in let _ = "checkHorizon.oldCheck: checkedHorizon=3"
125 in let _ = "checkToken"
126 in let !(#
127 c_49,
128 cs_50
129 #) = readNext_3 cs_48
130 in if (GHC.Classes.==) 'c' c_49
131 then
132 let _ = "comment: satisfy"
133 in let _ = "checkHorizon.oldCheck: checkedHorizon=2"
134 in let _ = "checkToken"
135 in let !(#
136 c_51,
137 cs_52
138 #) = readNext_3 cs_50
139 in if (GHC.Classes.==) 'd' c_51
140 then
141 let _ = "commit"
142 in let _ = "resume"
143 in callReturn_35
144 init_1
145 Data.Set.Internal.empty
146 ( let _ = "resume.genCode"
147 in (GHC.Types.:) 'a' ((GHC.Types.:) 'b' ((GHC.Types.:) 'c' ((GHC.Types.:) 'd' GHC.Types . [])))
148 )
149 cs_52
150 else
151 let _ = "checkToken.fail"
152 in let failExp_53 =
153 Data.Set.Internal.Bin
154 1
155 ( Symantic.Parser.Grammar.Combinators.SomeFailure
156 ( case inputToken of
157 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok'_6989586621679080671) -> Symantic.Parser.Grammar.Combinators.FailureToken 'd'
158 )
159 )
160 Data.Set.Internal.Tip
161 Data.Set.Internal.Tip
162 in let (#
163 farInp_54,
164 farExp_55
165 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init_1 cs_50 of
166 GHC.Types.LT ->
167 (#
168 cs_50,
169 failExp_53
170 #)
171 GHC.Types.EQ ->
172 (#
173 init_1,
174 failExp_53 GHC.Base.<> Data.Set.Internal.empty
175 #)
176 GHC.Types.GT ->
177 (#
178 init_1,
179 Data.Set.Internal.empty
180 #)
181 in readFail_44 Symantic.Parser.Grammar.Combinators.ExceptionFailure cs_50 farInp_54 farExp_55
182 else
183 let _ = "checkToken.fail"
184 in let failExp_56 =
185 Data.Set.Internal.Bin
186 1
187 ( Symantic.Parser.Grammar.Combinators.SomeFailure
188 ( case inputToken of
189 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok'_6989586621679080671) -> Symantic.Parser.Grammar.Combinators.FailureToken 'c'
190 )
191 )
192 Data.Set.Internal.Tip
193 Data.Set.Internal.Tip
194 in let (#
195 farInp_57,
196 farExp_58
197 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init_1 cs_48 of
198 GHC.Types.LT ->
199 (#
200 cs_48,
201 failExp_56
202 #)
203 GHC.Types.EQ ->
204 (#
205 init_1,
206 failExp_56 GHC.Base.<> Data.Set.Internal.empty
207 #)
208 GHC.Types.GT ->
209 (#
210 init_1,
211 Data.Set.Internal.empty
212 #)
213 in readFail_44 Symantic.Parser.Grammar.Combinators.ExceptionFailure cs_48 farInp_57 farExp_58
214 else
215 let _ = "checkToken.fail"
216 in let failExp_59 =
217 Data.Set.Internal.Bin
218 1
219 ( Symantic.Parser.Grammar.Combinators.SomeFailure
220 ( case inputToken of
221 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok'_6989586621679080671) -> Symantic.Parser.Grammar.Combinators.FailureToken 'b'
222 )
223 )
224 Data.Set.Internal.Tip
225 Data.Set.Internal.Tip
226 in let (#
227 farInp_60,
228 farExp_61
229 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init_1 cs_46 of
230 GHC.Types.LT ->
231 (#
232 cs_46,
233 failExp_59
234 #)
235 GHC.Types.EQ ->
236 (#
237 init_1,
238 failExp_59 GHC.Base.<> Data.Set.Internal.empty
239 #)
240 GHC.Types.GT ->
241 (#
242 init_1,
243 Data.Set.Internal.empty
244 #)
245 in readFail_44 Symantic.Parser.Grammar.Combinators.ExceptionFailure cs_46 farInp_60 farExp_61
246 else
247 let _ = "checkToken.fail"
248 in let failExp_62 =
249 Data.Set.Internal.Bin
250 1
251 ( Symantic.Parser.Grammar.Combinators.SomeFailure
252 ( case inputToken of
253 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok'_6989586621679080671) -> Symantic.Parser.Grammar.Combinators.FailureToken 'a'
254 )
255 )
256 Data.Set.Internal.Tip
257 Data.Set.Internal.Tip
258 in let (#
259 farInp_63,
260 farExp_64
261 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init_1 inp_43 of
262 GHC.Types.LT ->
263 (#
264 inp_43,
265 failExp_62
266 #)
267 GHC.Types.EQ ->
268 (#
269 init_1,
270 failExp_62 GHC.Base.<> Data.Set.Internal.empty
271 #)
272 GHC.Types.GT ->
273 (#
274 init_1,
275 Data.Set.Internal.empty
276 #)
277 in readFail_44 Symantic.Parser.Grammar.Combinators.ExceptionFailure inp_43 farInp_63 farExp_64
278 else
279 let _ = "checkHorizon.newCheck.fail"
280 in let failExp_65 =
281 Data.Set.Internal.Bin
282 1
283 ( Symantic.Parser.Grammar.Combinators.SomeFailure
284 ( case inputToken of
285 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok'_6989586621679080671) -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok'_6989586621679080671 4
286 )
287 )
288 Data.Set.Internal.Tip
289 Data.Set.Internal.Tip
290 in let (#
291 farInp_66,
292 farExp_67
293 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init_1 inp_43 of
294 GHC.Types.LT ->
295 (#
296 inp_43,
297 failExp_65
298 #)
299 GHC.Types.EQ ->
300 (#
301 init_1,
302 failExp_65 GHC.Base.<> Data.Set.Internal.empty
303 #)
304 GHC.Types.GT ->
305 (#
306 init_1,
307 Data.Set.Internal.empty
308 #)
309 in readFail_44 Symantic.Parser.Grammar.Combinators.ExceptionFailure inp_43 farInp_66 farExp_67
310 in let _ = "pushValue"
311 in name_34
312 ( let _ = "suspend"
313 in \farInp_68 farExp_69 v_70 (!inp_71) ->
314 let _ = "pushValue"
315 in do
316 let dupv_72 = \x_73 -> x_73
317 reg_74 <- GHC.STRef.newSTRef dupv_72
318 let _ = "iter"
319 in let catchHandler_75 loopInput_76 (!_exn_77) (!failInp_78) (!farInp_79) (!farExp_80) =
320 let _ = "pushInput"
321 in if ( \( Data.Text.Internal.Text
322 _
323 i_81
324 _
325 )
326 ( Data.Text.Internal.Text
327 _
328 j_82
329 _
330 ) -> i_81 GHC.Classes.== j_82
331 )
332 loopInput_76
333 failInp_78
334 then
335 let _ = "choicesBranch.then"
336 in do
337 sr_83 <- GHC.STRef.readSTRef reg_74
338 let _ = "pushValue"
339 in let join_84 = \farInp_85 farExp_86 v_87 (!inp_88) ->
340 let _ = "resume"
341 in finalRet_13
342 farInp_85
343 farExp_86
344 ( let _ = "resume.genCode"
345 in GHC.Show.show ((GHC.Types.:) v_70 (sr_83 GHC.Types . []))
346 )
347 inp_88
348 in let _ = "catch ExceptionFailure"
349 in let catchHandler_89 (!_exn_90) (!failInp_91) (!farInp_92) (!farExp_93) =
350 let _ = "catch.ko ExceptionFailure"
351 in let _ = "pushInput"
352 in if ( \( Data.Text.Internal.Text
353 _
354 i_94
355 _
356 )
357 ( Data.Text.Internal.Text
358 _
359 j_95
360 _
361 ) -> i_94 GHC.Classes.== j_95
362 )
363 failInp_78
364 failInp_91
365 then
366 let _ = "choicesBranch.then"
367 in let _ = "comment: eof.fail"
368 in let failExp_96 = Data.Set.Internal.Bin 1 (Symantic.Parser.Grammar.Combinators.SomeFailure Symantic.Parser.Grammar.Combinators.FailureEnd) Data.Set.Internal.Tip Data.Set.Internal.Tip
369 in let (#
370 farInp_97,
371 farExp_98
372 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp_92 failInp_91 of
373 GHC.Types.LT ->
374 (#
375 failInp_91,
376 failExp_96
377 #)
378 GHC.Types.EQ ->
379 (#
380 farInp_92,
381 failExp_96 GHC.Base.<> farExp_93
382 #)
383 GHC.Types.GT ->
384 (#
385 farInp_92,
386 farExp_93
387 #)
388 in finalRaise_18 Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp_91 farInp_97 farExp_98
389 else
390 let _ = "choicesBranch.else"
391 in finalRaise_18 Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp_91 farInp_92 farExp_93
392 in let _ = "comment: negLook"
393 in let _ = "catch ExceptionFailure"
394 in let catchHandler_99 (!_exn_100) (!failInp_101) (!farInp_102) (!farExp_103) =
395 let _ = "catch.ko ExceptionFailure"
396 in let _ = "comment: negLook.reset"
397 in let _ = "loadInput"
398 in let _ = "checkHorizon.noCheck"
399 in let _ = "pushValue"
400 in let _ = "commit"
401 in let _ = "resume"
402 in join_84
403 farInp_102
404 farExp_103
405 ( let _ = "resume.genCode"
406 in GHC.Tuple . ()
407 )
408 failInp_78
409 in let _ = "comment: negLook.ahead"
410 in let _ = "pushInput"
411 in let _ = "comment: satisfy"
412 in let inp_104 = failInp_78
413 in let readFail_105 = catchHandler_99
414 in let _ = "checkHorizon.newCheck: checkedHorizon=0 minHoriz=1"
415 in if readMore_2 inp_104
416 then
417 let _ = "checkToken"
418 in let !(#
419 c_106,
420 cs_107
421 #) = readNext_3 inp_104
422 in let _ = "popValue"
423 in let _ = "commit"
424 in let _ = "loadInput"
425 in let _ = "checkHorizon.noCheck"
426 in catchHandler_89 Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp_78 farInp_79 farExp_80
427 else
428 let _ = "checkHorizon.newCheck.fail"
429 in let failExp_108 =
430 Data.Set.Internal.Bin
431 1
432 ( Symantic.Parser.Grammar.Combinators.SomeFailure
433 ( case inputToken of
434 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok'_6989586621679080671) -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok'_6989586621679080671 1
435 )
436 )
437 Data.Set.Internal.Tip
438 Data.Set.Internal.Tip
439 in let (#
440 farInp_109,
441 farExp_110
442 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp_79 inp_104 of
443 GHC.Types.LT ->
444 (#
445 inp_104,
446 failExp_108
447 #)
448 GHC.Types.EQ ->
449 (#
450 farInp_79,
451 failExp_108 GHC.Base.<> farExp_80
452 #)
453 GHC.Types.GT ->
454 (#
455 farInp_79,
456 farExp_80
457 #)
458 in readFail_105 Symantic.Parser.Grammar.Combinators.ExceptionFailure inp_104 farInp_109 farExp_110
459 else
460 let _ = "choicesBranch.else"
461 in finalRaise_18 Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp_78 farInp_79 farExp_80
462 loop_111 = \_callReturn_112 callInput_113 callCatchStackByLabel_114 ->
463 let _ = "pushValue"
464 in name_34
465 ( let _ = "suspend"
466 in \farInp_115 farExp_116 v_117 (!inp_118) ->
467 let _ = "pushValue"
468 in do
469 sr_119 <- GHC.STRef.readSTRef reg_74
470 do
471 let dupv_120 = \x_121 -> sr_119 ((GHC.Types.:) v_117 x_121)
472 GHC.STRef.writeSTRef reg_74 dupv_120
473 let _ = "jump"
474 in loop_111 (GHC.Err.error "invalid return") inp_118 (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure (catchHandler_75 callInput_113) Data.Map.Internal.Tip Data.Map.Internal.Tip)
475 )
476 callInput_113
477 (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure (catchHandler_75 callInput_113) Data.Map.Internal.Tip Data.Map.Internal.Tip)
478 in let _ = "jump"
479 in loop_111 finalRet_13 inp_71 Data.Map.Internal.Tip
480 )
481 init_1
482 Data.Map.Internal.Tip
483 )