]> Git — Sourcephile - haskell/symantic-parser.git/blob - test/Golden/Splice/G13.expected.txt
doc: fix license and {def => shareable}
[haskell/symantic-parser.git] / test / Golden / Splice / G13.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.ParsingError
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 name
56 ( let _ = "suspend"
57 in \farInp farExp v (!inp) ->
58 let _ = "resume"
59 in ok
60 farInp
61 farExp
62 ( let _ = "resume.genCode"
63 in GHC.Tuple . ()
64 )
65 inp
66 )
67 inp
68 (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure (Data.Map.Strict.Internal.findWithDefault finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure koByLabel) Data.Map.Internal.Tip Data.Map.Internal.Tip)
69 name = \(!ok) (!inp) (!koByLabel) ->
70 name
71 ( let _ = "suspend"
72 in \farInp farExp v (!inp) ->
73 let _ = "resume"
74 in ok
75 farInp
76 farExp
77 ( let _ = "resume.genCode"
78 in v GHC.Types . []
79 )
80 inp
81 )
82 inp
83 (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure (Data.Map.Strict.Internal.findWithDefault finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure koByLabel) Data.Map.Internal.Tip Data.Map.Internal.Tip)
84 name = \(!ok) (!inp) (!koByLabel) ->
85 let _ = "catch ExceptionFailure"
86 in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =
87 let _ = "catch.ko ExceptionFailure"
88 in if ( \( Data.Text.Internal.Text
89 _
90 i
91 _
92 )
93 ( Data.Text.Internal.Text
94 _
95 j
96 _
97 ) -> i GHC.Classes.== j
98 )
99 inp
100 failInp
101 then
102 let _ = "choicesBranch.then"
103 in let _ = "resume"
104 in ok
105 farInp
106 farExp
107 ( let _ = "resume.genCode"
108 in \x -> x
109 )
110 failInp
111 else
112 let _ = "choicesBranch.else"
113 in Data.Map.Strict.Internal.findWithDefault finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure koByLabel Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp
114 in let join = \farInp farExp v (!inp) ->
115 name
116 ( let _ = "suspend"
117 in \farInp farExp v (!inp) ->
118 name
119 ( let _ = "suspend"
120 in \farInp farExp v (!inp) ->
121 let _ = "resume"
122 in ok
123 farInp
124 farExp
125 ( let _ = "resume.genCode"
126 in \x -> (GHC.Types.:) v (v x)
127 )
128 inp
129 )
130 inp
131 (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure catchHandler Data.Map.Internal.Tip Data.Map.Internal.Tip)
132 )
133 inp
134 (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure catchHandler Data.Map.Internal.Tip Data.Map.Internal.Tip)
135 in let readFail = catchHandler
136 in if readMore inp
137 then
138 let !(#
139 c,
140 cs
141 #) = readNext inp
142 in if (GHC.Classes.==) '<' c
143 then
144 let _ = "choicesBranch.then"
145 in let readFail = readFail
146 in if readMore inp
147 then
148 let !(#
149 c,
150 cs
151 #) = readNext inp
152 in let _ = "resume"
153 in join
154 init
155 Data.Set.Internal.empty
156 ( let _ = "resume.genCode"
157 in Parsers.Brainfuck.Types.Backward
158 )
159 cs
160 else
161 let _ = "checkHorizon.else"
162 in let failExp =
163 Data.Set.Internal.Bin
164 1
165 ( Symantic.Parser.Grammar.Combinators.SomeFailure
166 ( case inputToken of
167 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 1
168 )
169 )
170 Data.Set.Internal.Tip
171 Data.Set.Internal.Tip
172 in let (#
173 farInp,
174 farExp
175 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of
176 GHC.Types.LT ->
177 (#
178 inp,
179 failExp
180 #)
181 GHC.Types.EQ ->
182 (#
183 init,
184 failExp GHC.Base.<> Data.Set.Internal.empty
185 #)
186 GHC.Types.GT ->
187 (#
188 init,
189 Data.Set.Internal.empty
190 #)
191 in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp
192 else
193 let _ = "choicesBranch.else"
194 in if (GHC.Classes.==) '>' c
195 then
196 let _ = "choicesBranch.then"
197 in let readFail = readFail
198 in if readMore inp
199 then
200 let !(#
201 c,
202 cs
203 #) = readNext inp
204 in let _ = "resume"
205 in join
206 init
207 Data.Set.Internal.empty
208 ( let _ = "resume.genCode"
209 in Parsers.Brainfuck.Types.Forward
210 )
211 cs
212 else
213 let _ = "checkHorizon.else"
214 in let failExp =
215 Data.Set.Internal.Bin
216 1
217 ( Symantic.Parser.Grammar.Combinators.SomeFailure
218 ( case inputToken of
219 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 1
220 )
221 )
222 Data.Set.Internal.Tip
223 Data.Set.Internal.Tip
224 in let (#
225 farInp,
226 farExp
227 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of
228 GHC.Types.LT ->
229 (#
230 inp,
231 failExp
232 #)
233 GHC.Types.EQ ->
234 (#
235 init,
236 failExp GHC.Base.<> Data.Set.Internal.empty
237 #)
238 GHC.Types.GT ->
239 (#
240 init,
241 Data.Set.Internal.empty
242 #)
243 in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp
244 else
245 let _ = "choicesBranch.else"
246 in if (GHC.Classes.==) '+' c
247 then
248 let _ = "choicesBranch.then"
249 in let readFail = readFail
250 in if readMore inp
251 then
252 let !(#
253 c,
254 cs
255 #) = readNext inp
256 in let _ = "resume"
257 in join
258 init
259 Data.Set.Internal.empty
260 ( let _ = "resume.genCode"
261 in Parsers.Brainfuck.Types.Increment
262 )
263 cs
264 else
265 let _ = "checkHorizon.else"
266 in let failExp =
267 Data.Set.Internal.Bin
268 1
269 ( Symantic.Parser.Grammar.Combinators.SomeFailure
270 ( case inputToken of
271 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 1
272 )
273 )
274 Data.Set.Internal.Tip
275 Data.Set.Internal.Tip
276 in let (#
277 farInp,
278 farExp
279 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of
280 GHC.Types.LT ->
281 (#
282 inp,
283 failExp
284 #)
285 GHC.Types.EQ ->
286 (#
287 init,
288 failExp GHC.Base.<> Data.Set.Internal.empty
289 #)
290 GHC.Types.GT ->
291 (#
292 init,
293 Data.Set.Internal.empty
294 #)
295 in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp
296 else
297 let _ = "choicesBranch.else"
298 in if (GHC.Classes.==) '-' c
299 then
300 let _ = "choicesBranch.then"
301 in let readFail = readFail
302 in if readMore inp
303 then
304 let !(#
305 c,
306 cs
307 #) = readNext inp
308 in let _ = "resume"
309 in join
310 init
311 Data.Set.Internal.empty
312 ( let _ = "resume.genCode"
313 in Parsers.Brainfuck.Types.Decrement
314 )
315 cs
316 else
317 let _ = "checkHorizon.else"
318 in let failExp =
319 Data.Set.Internal.Bin
320 1
321 ( Symantic.Parser.Grammar.Combinators.SomeFailure
322 ( case inputToken of
323 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 1
324 )
325 )
326 Data.Set.Internal.Tip
327 Data.Set.Internal.Tip
328 in let (#
329 farInp,
330 farExp
331 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of
332 GHC.Types.LT ->
333 (#
334 inp,
335 failExp
336 #)
337 GHC.Types.EQ ->
338 (#
339 init,
340 failExp GHC.Base.<> Data.Set.Internal.empty
341 #)
342 GHC.Types.GT ->
343 (#
344 init,
345 Data.Set.Internal.empty
346 #)
347 in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp
348 else
349 let _ = "choicesBranch.else"
350 in if (GHC.Classes.==) ',' c
351 then
352 let _ = "choicesBranch.then"
353 in let readFail = readFail
354 in if readMore inp
355 then
356 let !(#
357 c,
358 cs
359 #) = readNext inp
360 in let _ = "resume"
361 in join
362 init
363 Data.Set.Internal.empty
364 ( let _ = "resume.genCode"
365 in Parsers.Brainfuck.Types.Input
366 )
367 cs
368 else
369 let _ = "checkHorizon.else"
370 in let failExp =
371 Data.Set.Internal.Bin
372 1
373 ( Symantic.Parser.Grammar.Combinators.SomeFailure
374 ( case inputToken of
375 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 1
376 )
377 )
378 Data.Set.Internal.Tip
379 Data.Set.Internal.Tip
380 in let (#
381 farInp,
382 farExp
383 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of
384 GHC.Types.LT ->
385 (#
386 inp,
387 failExp
388 #)
389 GHC.Types.EQ ->
390 (#
391 init,
392 failExp GHC.Base.<> Data.Set.Internal.empty
393 #)
394 GHC.Types.GT ->
395 (#
396 init,
397 Data.Set.Internal.empty
398 #)
399 in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp
400 else
401 let _ = "choicesBranch.else"
402 in if (GHC.Classes.==) '.' c
403 then
404 let _ = "choicesBranch.then"
405 in let readFail = readFail
406 in if readMore inp
407 then
408 let !(#
409 c,
410 cs
411 #) = readNext inp
412 in let _ = "resume"
413 in join
414 init
415 Data.Set.Internal.empty
416 ( let _ = "resume.genCode"
417 in Parsers.Brainfuck.Types.Output
418 )
419 cs
420 else
421 let _ = "checkHorizon.else"
422 in let failExp =
423 Data.Set.Internal.Bin
424 1
425 ( Symantic.Parser.Grammar.Combinators.SomeFailure
426 ( case inputToken of
427 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 1
428 )
429 )
430 Data.Set.Internal.Tip
431 Data.Set.Internal.Tip
432 in let (#
433 farInp,
434 farExp
435 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of
436 GHC.Types.LT ->
437 (#
438 inp,
439 failExp
440 #)
441 GHC.Types.EQ ->
442 (#
443 init,
444 failExp GHC.Base.<> Data.Set.Internal.empty
445 #)
446 GHC.Types.GT ->
447 (#
448 init,
449 Data.Set.Internal.empty
450 #)
451 in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp
452 else
453 let _ = "choicesBranch.else"
454 in if (GHC.Classes.==) '[' c
455 then
456 let _ = "choicesBranch.then"
457 in let readFail = readFail
458 in if readMore (Symantic.Parser.Machine.Input.shiftRightText 1 inp)
459 then
460 let !(#
461 c,
462 cs
463 #) = readNext inp
464 in name
465 ( let _ = "suspend"
466 in \farInp farExp v (!inp) ->
467 name
468 ( let _ = "suspend"
469 in \farInp farExp v (!inp) ->
470 let readFail = readFail
471 in if readMore inp
472 then
473 let !(#
474 c,
475 cs
476 #) = readNext inp
477 in if (GHC.Classes.==) ']' c
478 then
479 let _ = "resume"
480 in join
481 farInp
482 farExp
483 ( let _ = "resume.genCode"
484 in Parsers.Brainfuck.Types.Loop v
485 )
486 cs
487 else
488 let _ = "checkToken.else"
489 in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp
490 else
491 let _ = "checkHorizon.else"
492 in let failExp =
493 Data.Set.Internal.Bin
494 1
495 ( Symantic.Parser.Grammar.Combinators.SomeFailure
496 ( case inputToken of
497 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 1
498 )
499 )
500 Data.Set.Internal.Tip
501 Data.Set.Internal.Tip
502 in let (#
503 farInp,
504 farExp
505 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp inp of
506 GHC.Types.LT ->
507 (#
508 inp,
509 failExp
510 #)
511 GHC.Types.EQ ->
512 (#
513 farInp,
514 failExp GHC.Base.<> farExp
515 #)
516 GHC.Types.GT ->
517 (#
518 farInp,
519 farExp
520 #)
521 in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp
522 )
523 inp
524 (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure readFail Data.Map.Internal.Tip Data.Map.Internal.Tip)
525 )
526 cs
527 (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure readFail Data.Map.Internal.Tip Data.Map.Internal.Tip)
528 else
529 let _ = "checkHorizon.else"
530 in let failExp =
531 Data.Set.Internal.Bin
532 1
533 ( Symantic.Parser.Grammar.Combinators.SomeFailure
534 ( case inputToken of
535 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 2
536 )
537 )
538 Data.Set.Internal.Tip
539 Data.Set.Internal.Tip
540 in let (#
541 farInp,
542 farExp
543 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of
544 GHC.Types.LT ->
545 (#
546 inp,
547 failExp
548 #)
549 GHC.Types.EQ ->
550 (#
551 init,
552 failExp GHC.Base.<> Data.Set.Internal.empty
553 #)
554 GHC.Types.GT ->
555 (#
556 init,
557 Data.Set.Internal.empty
558 #)
559 in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp
560 else
561 let _ = "choicesBranch.else"
562 in let failExp = Data.Set.Internal.Bin 1 (Symantic.Parser.Grammar.Combinators.SomeFailure Symantic.Parser.Grammar.Combinators.FailureEmpty) Data.Set.Internal.Tip Data.Set.Internal.Tip
563 in let (#
564 farInp,
565 farExp
566 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of
567 GHC.Types.LT ->
568 (#
569 inp,
570 failExp
571 #)
572 GHC.Types.EQ ->
573 (#
574 init,
575 failExp GHC.Base.<> Data.Set.Internal.empty
576 #)
577 GHC.Types.GT ->
578 (#
579 init,
580 Data.Set.Internal.empty
581 #)
582 in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp
583 else
584 let _ = "checkHorizon.else"
585 in let failExp =
586 Data.Set.Internal.Bin
587 1
588 ( Symantic.Parser.Grammar.Combinators.SomeFailure
589 ( case inputToken of
590 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 1
591 )
592 )
593 Data.Set.Internal.Tip
594 Data.Set.Internal.Tip
595 in let (#
596 farInp,
597 farExp
598 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of
599 GHC.Types.LT ->
600 (#
601 inp,
602 failExp
603 #)
604 GHC.Types.EQ ->
605 (#
606 init,
607 failExp GHC.Base.<> Data.Set.Internal.empty
608 #)
609 GHC.Types.GT ->
610 (#
611 init,
612 Data.Set.Internal.empty
613 #)
614 in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp
615 name = \(!ok) (!inp) (!koByLabel) ->
616 let _ = "catch ExceptionFailure"
617 in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =
618 let _ = "catch.ko ExceptionFailure"
619 in if ( \( Data.Text.Internal.Text
620 _
621 i
622 _
623 )
624 ( Data.Text.Internal.Text
625 _
626 j
627 _
628 ) -> i GHC.Classes.== j
629 )
630 inp
631 failInp
632 then
633 let _ = "choicesBranch.then"
634 in let _ = "resume"
635 in ok
636 farInp
637 farExp
638 ( let _ = "resume.genCode"
639 in \x -> x
640 )
641 failInp
642 else
643 let _ = "choicesBranch.else"
644 in Data.Map.Strict.Internal.findWithDefault finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure koByLabel Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp
645 in let readFail = catchHandler
646 in if readMore inp
647 then
648 let !(#
649 c,
650 cs
651 #) = readNext inp
652 in if (\c -> GHC.Classes.not (('<' GHC.Classes.== c) GHC.Classes.|| (('>' GHC.Classes.== c) GHC.Classes.|| (('+' GHC.Classes.== c) GHC.Classes.|| (('-' GHC.Classes.== c) GHC.Classes.|| ((',' GHC.Classes.== c) GHC.Classes.|| (('.' GHC.Classes.== c) GHC.Classes.|| (('[' GHC.Classes.== c) GHC.Classes.|| ((']' GHC.Classes.== c) GHC.Classes.|| GHC.Types.False))))))))) c
653 then
654 name
655 ( let _ = "suspend"
656 in \farInp farExp v (!inp) ->
657 let _ = "resume"
658 in ok
659 farInp
660 farExp
661 ( let _ = "resume.genCode"
662 in \x -> v x
663 )
664 inp
665 )
666 cs
667 (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure readFail Data.Map.Internal.Tip Data.Map.Internal.Tip)
668 else
669 let _ = "checkToken.else"
670 in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp init Data.Set.Internal.empty
671 else
672 let _ = "checkHorizon.else"
673 in let failExp =
674 Data.Set.Internal.Bin
675 1
676 ( Symantic.Parser.Grammar.Combinators.SomeFailure
677 ( case inputToken of
678 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 1
679 )
680 )
681 Data.Set.Internal.Tip
682 Data.Set.Internal.Tip
683 in let (#
684 farInp,
685 farExp
686 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of
687 GHC.Types.LT ->
688 (#
689 inp,
690 failExp
691 #)
692 GHC.Types.EQ ->
693 (#
694 init,
695 failExp GHC.Base.<> Data.Set.Internal.empty
696 #)
697 GHC.Types.GT ->
698 (#
699 init,
700 Data.Set.Internal.empty
701 #)
702 in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp
703 in name
704 ( let _ = "suspend"
705 in \farInp farExp v (!inp) ->
706 name
707 ( let _ = "suspend"
708 in \farInp farExp v (!inp) ->
709 let _ = "resume"
710 in finalRet
711 farInp
712 farExp
713 ( let _ = "resume.genCode"
714 in GHC.Show.show v
715 )
716 inp
717 )
718 inp
719 Data.Map.Internal.Tip
720 )
721 init
722 Data.Map.Internal.Tip