]> Git — Sourcephile - haskell/symantic-parser.git/blob - test/Golden/Splice/G13.expected.txt
tests: accept
[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 -> Symantic.Parser.Machine.Generate.returnST GHC.Base.$ Data.Either.Right v
31 finalRaise ::
32 forall st b.
33 Symantic.Parser.Machine.Generate.OnException
34 st
35 inp
36 b = \(!exn) _failInp (!farInp) (!farExp) ->
37 Symantic.Parser.Machine.Generate.returnST GHC.Base.$
38 Data.Either.Left
39 Symantic.Parser.Machine.Generate.ParsingError
40 { Symantic.Parser.Machine.Generate.parsingErrorOffset = Symantic.Parser.Machine.Input.offset farInp,
41 Symantic.Parser.Machine.Generate.parsingErrorException = exn,
42 Symantic.Parser.Machine.Generate.parsingErrorUnexpected =
43 if readMore farInp
44 then
45 GHC.Maybe.Just
46 ( let (#
47 c,
48 _
49 #) = readNext farInp
50 in c
51 )
52 else GHC.Maybe.Nothing,
53 Symantic.Parser.Machine.Generate.parsingErrorExpecting =
54 let ( minHoriz,
55 res
56 ) =
57 Data.Set.Internal.foldr
58 ( \f
59 ( minH,
60 acc
61 ) -> case Symantic.Parser.Grammar.Combinators.unSomeFailure f of
62 GHC.Maybe.Just (Symantic.Parser.Grammar.Combinators.FailureHorizon h :: Symantic.Parser.Grammar.Combinators.Failure (Symantic.Parser.Grammar.Combinators.CombSatisfiable (Symantic.Parser.Machine.Input.InputToken inp)))
63 | GHC.Maybe.Just old <- minH ->
64 ( GHC.Maybe.Just (GHC.Classes.min old h),
65 acc
66 )
67 | GHC.Base.otherwise ->
68 ( GHC.Maybe.Just h,
69 acc
70 )
71 _ ->
72 ( minH,
73 f GHC.Types.: acc
74 )
75 )
76 ( GHC.Maybe.Nothing,
77 GHC.Types . []
78 )
79 farExp
80 in Data.Set.Internal.fromList GHC.Base.$
81 ( case minHoriz of
82 GHC.Maybe.Just h -> Symantic.Parser.Grammar.Combinators.SomeFailure (Symantic.Parser.Grammar.Combinators.FailureHorizon @(Symantic.Parser.Machine.Input.InputToken inp) h) GHC.Types.: res
83 GHC.Maybe.Nothing -> res
84 )
85 }
86 in GHC.ST.runST
87 ( let inputToken = Data.Proxy.Proxy :: Data.Proxy.Proxy (Symantic.Parser.Machine.Input.InputToken inp)
88 in let _ = "checkHorizon.noCheck"
89 in let name = \(!callerOnReturn) (!callerInput) (!callerOnExceptionStackByLabel) ->
90 let _ = "pushValue"
91 in let _ = "pushValue"
92 in do
93 let dupv = \x -> x
94 reg <- GHC.STRef.newSTRef dupv
95 let _ = "iter"
96 in let onException loopInput =
97 let _ = "onException"
98 in \(!_exn) (!failInp) (!farInp) (!farExp) ->
99 let _ = "comment: raiseAgainIfConsumed"
100 in let _ = "saveInput checkedHorizon=0"
101 in let _ = "lift2Value checkedHorizon=0"
102 in if ( \( Data.Text.Internal.Text
103 _
104 i
105 _
106 )
107 ( Data.Text.Internal.Text
108 _
109 j
110 _
111 ) -> i GHC.Classes.== j
112 )
113 loopInput
114 failInp
115 then
116 let _ = "choicesBranch checkedHorizon=0"
117 in do
118 sr <- GHC.STRef.readSTRef reg
119 let _ = "pushValue"
120 in let _ = "lift2Value checkedHorizon=0"
121 in let _ = "lift2Value checkedHorizon=0"
122 in let _ = "resume"
123 in callerOnReturn
124 farInp
125 farExp
126 ( let _ = "resume.genCode"
127 in GHC.Tuple . ()
128 )
129 failInp
130 else
131 let _ = "choicesBranch.else"
132 in Data.Map.Strict.Internal.findWithDefault finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure callerOnExceptionStackByLabel Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp
133 loop = \_callerOnReturn callerInput callerOnExceptionStackByLabel ->
134 let _ = "pushValue"
135 in let _ = "comment: satisfy (\\c_0 -> GHC.Classes.not (('<' GHC.Classes.== c_0) GHC.Classes.|| (('>' GHC.Classes.== c_0) GHC.Classes.|| (('+' GHC.Classes.== c_0) GHC.Classes.|| (('-' GHC.Classes.== c_0) GHC.Classes.|| ((',' GHC.Classes.== c_0) GHC.Classes.|| (('.' GHC.Classes.== c_0) GHC.Classes.|| (('[' GHC.Classes.== c_0) GHC.Classes.|| ((']' GHC.Classes.== c_0) GHC.Classes.|| GHC.Types.False)))))))))"
136 in let inp = callerInput
137 in let readFail = onException callerInput
138 in let _ = "checkHorizon.newCheck: checkedHorizon=0 minHoriz=1"
139 in if readMore inp
140 then
141 let _ = "checkToken"
142 in let !(#
143 c,
144 cs
145 #) = readNext inp
146 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
147 then
148 let _ = "lift2Value checkedHorizon=1"
149 in do
150 sr <- GHC.STRef.readSTRef reg
151 let _ = "lift2Value checkedHorizon=1"
152 in do
153 let dupv = sr
154 GHC.STRef.writeSTRef reg dupv
155 let _ = "jump"
156 in loop (GHC.Err.error "invalid onReturn") cs (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure readFail Data.Map.Internal.Tip Data.Map.Internal.Tip)
157 else
158 let _ = "checkToken.fail"
159 in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp init Data.Set.Internal.empty
160 else
161 let _ = "checkHorizon.newCheck.fail"
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 in let _ = "jump"
193 in loop callerOnReturn callerInput (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure (Data.Map.Strict.Internal.findWithDefault finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure callerOnExceptionStackByLabel) Data.Map.Internal.Tip Data.Map.Internal.Tip)
194 name = \(!callerOnReturn) (!callerInput) (!callerOnExceptionStackByLabel) ->
195 let _ = "pushValue"
196 in do
197 let dupv = \x -> x
198 reg <- GHC.STRef.newSTRef dupv
199 let _ = "iter"
200 in let onException loopInput =
201 let _ = "onException"
202 in \(!_exn) (!failInp) (!farInp) (!farExp) ->
203 let _ = "comment: raiseAgainIfConsumed"
204 in let _ = "saveInput checkedHorizon=0"
205 in let _ = "lift2Value checkedHorizon=0"
206 in if ( \( Data.Text.Internal.Text
207 _
208 i
209 _
210 )
211 ( Data.Text.Internal.Text
212 _
213 j
214 _
215 ) -> i GHC.Classes.== j
216 )
217 loopInput
218 failInp
219 then
220 let _ = "choicesBranch checkedHorizon=0"
221 in do
222 sr <- GHC.STRef.readSTRef reg
223 let _ = "pushValue"
224 in let _ = "lift2Value checkedHorizon=0"
225 in let _ = "resume"
226 in callerOnReturn
227 farInp
228 farExp
229 ( let _ = "resume.genCode"
230 in sr GHC.Types . []
231 )
232 failInp
233 else
234 let _ = "choicesBranch.else"
235 in Data.Map.Strict.Internal.findWithDefault finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure callerOnExceptionStackByLabel Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp
236 loop = \_callerOnReturn callerInput callerOnExceptionStackByLabel ->
237 let _ = "pushValue"
238 in let join = \farInp farExp v (!inp) ->
239 let _ = "lift2Value checkedHorizon=0"
240 in name
241 ( let _ = "onReturn"
242 in \farInp farExp v (!inp) ->
243 let _ = "lift2Value checkedHorizon=0"
244 in let _ = "pushValue"
245 in let _ = "lift2Value checkedHorizon=0"
246 in do
247 sr <- GHC.STRef.readSTRef reg
248 let _ = "lift2Value checkedHorizon=0"
249 in do
250 let dupv = \x -> sr ((GHC.Types.:) v x)
251 GHC.STRef.writeSTRef reg dupv
252 let _ = "jump"
253 in loop (GHC.Err.error "invalid onReturn") inp (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure (onException callerInput) Data.Map.Internal.Tip Data.Map.Internal.Tip)
254 )
255 inp
256 (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure (onException callerInput) Data.Map.Internal.Tip Data.Map.Internal.Tip)
257 in let _ = "comment: look"
258 in let _ = "saveInput checkedHorizon=0"
259 in let _ = "comment: satisfy ((\\x_0 -> \\x_1 -> x_0) GHC.Types.True)"
260 in let inp = callerInput
261 in let readFail = onException callerInput
262 in let _ = "checkHorizon.newCheck: checkedHorizon=0 minHoriz=1"
263 in if readMore inp
264 then
265 let _ = "checkToken"
266 in let !(#
267 c,
268 cs
269 #) = readNext inp
270 in let _ = "loadInput checkedHorizon=0"
271 in let inp = callerInput
272 in let readFail = readFail
273 in let _ = "checkHorizon.newCheck: checkedHorizon=0 minHoriz=1"
274 in if readMore inp
275 then
276 if (\x -> (\x -> \x -> (GHC.Classes.==) x x) '<' x) c
277 then
278 let _ = "choicesBranch checkedHorizon=1"
279 in let _ = "pushValue"
280 in let _ = "comment: satisfy ((\\x_0 -> \\x_1 -> x_0) GHC.Types.True)"
281 in let _ = "checkHorizon.oldCheck: checkedHorizon=1"
282 in let _ = "checkToken"
283 in let !(#
284 c,
285 cs
286 #) = readNext inp
287 in let _ = "lift2Value checkedHorizon=0"
288 in let _ = "resume"
289 in join
290 init
291 Data.Set.Internal.empty
292 ( let _ = "resume.genCode"
293 in Parsers.Brainfuck.Types.Backward
294 )
295 cs
296 else
297 let _ = "choicesBranch.else"
298 in if (\x -> (\x -> \x -> (GHC.Classes.==) x x) '>' x) c
299 then
300 let _ = "choicesBranch checkedHorizon=1"
301 in let _ = "pushValue"
302 in let _ = "comment: satisfy ((\\x_0 -> \\x_1 -> x_0) GHC.Types.True)"
303 in let _ = "checkHorizon.oldCheck: checkedHorizon=1"
304 in let _ = "checkToken"
305 in let !(#
306 c,
307 cs
308 #) = readNext inp
309 in let _ = "lift2Value checkedHorizon=0"
310 in let _ = "resume"
311 in join
312 init
313 Data.Set.Internal.empty
314 ( let _ = "resume.genCode"
315 in Parsers.Brainfuck.Types.Forward
316 )
317 cs
318 else
319 let _ = "choicesBranch.else"
320 in if (\x -> (\x -> \x -> (GHC.Classes.==) x x) '+' x) c
321 then
322 let _ = "choicesBranch checkedHorizon=1"
323 in let _ = "pushValue"
324 in let _ = "comment: satisfy ((\\x_0 -> \\x_1 -> x_0) GHC.Types.True)"
325 in let _ = "checkHorizon.oldCheck: checkedHorizon=1"
326 in let _ = "checkToken"
327 in let !(#
328 c,
329 cs
330 #) = readNext inp
331 in let _ = "lift2Value checkedHorizon=0"
332 in let _ = "resume"
333 in join
334 init
335 Data.Set.Internal.empty
336 ( let _ = "resume.genCode"
337 in Parsers.Brainfuck.Types.Increment
338 )
339 cs
340 else
341 let _ = "choicesBranch.else"
342 in if (\x -> (\x -> \x -> (GHC.Classes.==) x x) '-' x) c
343 then
344 let _ = "choicesBranch checkedHorizon=1"
345 in let _ = "pushValue"
346 in let _ = "comment: satisfy ((\\x_0 -> \\x_1 -> x_0) GHC.Types.True)"
347 in let _ = "checkHorizon.oldCheck: checkedHorizon=1"
348 in let _ = "checkToken"
349 in let !(#
350 c,
351 cs
352 #) = readNext inp
353 in let _ = "lift2Value checkedHorizon=0"
354 in let _ = "resume"
355 in join
356 init
357 Data.Set.Internal.empty
358 ( let _ = "resume.genCode"
359 in Parsers.Brainfuck.Types.Decrement
360 )
361 cs
362 else
363 let _ = "choicesBranch.else"
364 in if (\x -> (\x -> \x -> (GHC.Classes.==) x x) ',' x) c
365 then
366 let _ = "choicesBranch checkedHorizon=1"
367 in let _ = "pushValue"
368 in let _ = "comment: satisfy ((\\x_0 -> \\x_1 -> x_0) GHC.Types.True)"
369 in let _ = "checkHorizon.oldCheck: checkedHorizon=1"
370 in let _ = "checkToken"
371 in let !(#
372 c,
373 cs
374 #) = readNext inp
375 in let _ = "lift2Value checkedHorizon=0"
376 in let _ = "resume"
377 in join
378 init
379 Data.Set.Internal.empty
380 ( let _ = "resume.genCode"
381 in Parsers.Brainfuck.Types.Input
382 )
383 cs
384 else
385 let _ = "choicesBranch.else"
386 in if (\x -> (\x -> \x -> (GHC.Classes.==) x x) '.' x) c
387 then
388 let _ = "choicesBranch checkedHorizon=1"
389 in let _ = "pushValue"
390 in let _ = "comment: satisfy ((\\x_0 -> \\x_1 -> x_0) GHC.Types.True)"
391 in let _ = "checkHorizon.oldCheck: checkedHorizon=1"
392 in let _ = "checkToken"
393 in let !(#
394 c,
395 cs
396 #) = readNext inp
397 in let _ = "lift2Value checkedHorizon=0"
398 in let _ = "resume"
399 in join
400 init
401 Data.Set.Internal.empty
402 ( let _ = "resume.genCode"
403 in Parsers.Brainfuck.Types.Output
404 )
405 cs
406 else
407 let _ = "choicesBranch.else"
408 in if (\x -> (\x -> \x -> (GHC.Classes.==) x x) '[' x) c
409 then
410 let _ = "choicesBranch checkedHorizon=1"
411 in let _ = "pushValue"
412 in let _ = "comment: satisfy ((\\x_0 -> \\x_1 -> x_0) GHC.Types.True)"
413 in let _ = "checkHorizon.oldCheck: checkedHorizon=1"
414 in let _ = "checkToken"
415 in let !(#
416 c,
417 cs
418 #) = readNext inp
419 in let _ = "lift2Value checkedHorizon=0"
420 in name
421 ( let _ = "onReturn"
422 in \farInp farExp v (!inp) ->
423 let _ = "lift2Value checkedHorizon=0"
424 in name
425 ( let _ = "onReturn"
426 in \farInp farExp v (!inp) ->
427 let _ = "lift2Value checkedHorizon=0"
428 in let _ = "comment: satisfy ((GHC.Classes.==) ']')"
429 in let inp = inp
430 in let readFail = readFail
431 in let _ = "checkHorizon.newCheck: checkedHorizon=0 minHoriz=1"
432 in if readMore inp
433 then
434 let _ = "checkToken"
435 in let !(#
436 c,
437 cs
438 #) = readNext inp
439 in if (GHC.Classes.==) ']' c
440 then
441 let _ = "lift2Value checkedHorizon=1"
442 in let _ = "resume"
443 in join
444 farInp
445 farExp
446 ( let _ = "resume.genCode"
447 in Parsers.Brainfuck.Types.Loop v
448 )
449 cs
450 else
451 let _ = "checkToken.fail"
452 in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp
453 else
454 let _ = "checkHorizon.newCheck.fail"
455 in let failExp =
456 Data.Set.Internal.Bin
457 1
458 ( Symantic.Parser.Grammar.Combinators.SomeFailure
459 ( case inputToken of
460 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 1
461 )
462 )
463 Data.Set.Internal.Tip
464 Data.Set.Internal.Tip
465 in let (#
466 farInp,
467 farExp
468 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp inp of
469 GHC.Types.LT ->
470 (#
471 inp,
472 failExp
473 #)
474 GHC.Types.EQ ->
475 (#
476 farInp,
477 failExp GHC.Base.<> farExp
478 #)
479 GHC.Types.GT ->
480 (#
481 farInp,
482 farExp
483 #)
484 in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp
485 )
486 inp
487 (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure readFail Data.Map.Internal.Tip Data.Map.Internal.Tip)
488 )
489 cs
490 (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure readFail Data.Map.Internal.Tip Data.Map.Internal.Tip)
491 else
492 let _ = "choicesBranch.else"
493 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
494 in let (#
495 farInp,
496 farExp
497 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of
498 GHC.Types.LT ->
499 (#
500 inp,
501 failExp
502 #)
503 GHC.Types.EQ ->
504 (#
505 init,
506 failExp GHC.Base.<> Data.Set.Internal.empty
507 #)
508 GHC.Types.GT ->
509 (#
510 init,
511 Data.Set.Internal.empty
512 #)
513 in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp
514 else
515 let _ = "checkHorizon.newCheck.fail"
516 in let failExp =
517 Data.Set.Internal.Bin
518 1
519 ( Symantic.Parser.Grammar.Combinators.SomeFailure
520 ( case inputToken of
521 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 1
522 )
523 )
524 Data.Set.Internal.Tip
525 Data.Set.Internal.Tip
526 in let (#
527 farInp,
528 farExp
529 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of
530 GHC.Types.LT ->
531 (#
532 inp,
533 failExp
534 #)
535 GHC.Types.EQ ->
536 (#
537 init,
538 failExp GHC.Base.<> Data.Set.Internal.empty
539 #)
540 GHC.Types.GT ->
541 (#
542 init,
543 Data.Set.Internal.empty
544 #)
545 in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp
546 else
547 let _ = "checkHorizon.newCheck.fail"
548 in let failExp =
549 Data.Set.Internal.Bin
550 1
551 ( Symantic.Parser.Grammar.Combinators.SomeFailure
552 ( case inputToken of
553 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 1
554 )
555 )
556 Data.Set.Internal.Tip
557 Data.Set.Internal.Tip
558 in let (#
559 farInp,
560 farExp
561 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of
562 GHC.Types.LT ->
563 (#
564 inp,
565 failExp
566 #)
567 GHC.Types.EQ ->
568 (#
569 init,
570 failExp GHC.Base.<> Data.Set.Internal.empty
571 #)
572 GHC.Types.GT ->
573 (#
574 init,
575 Data.Set.Internal.empty
576 #)
577 in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp
578 in let _ = "jump"
579 in loop callerOnReturn callerInput (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure (Data.Map.Strict.Internal.findWithDefault finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure callerOnExceptionStackByLabel) Data.Map.Internal.Tip Data.Map.Internal.Tip)
580 in let _ = "pushValue"
581 in name
582 ( let _ = "onReturn"
583 in \farInp farExp v (!inp) ->
584 let _ = "lift2Value checkedHorizon=0"
585 in name
586 ( let _ = "onReturn"
587 in \farInp farExp v (!inp) ->
588 let _ = "lift2Value checkedHorizon=0"
589 in let _ = "resume"
590 in finalRet
591 farInp
592 farExp
593 ( let _ = "resume.genCode"
594 in GHC.Show.show v
595 )
596 inp
597 )
598 inp
599 Data.Map.Internal.Tip
600 )
601 init
602 Data.Map.Internal.Tip
603 )