]> Git — Sourcephile - haskell/symantic-parser.git/blob - tests/Golden/Splice/G5.expected.txt
doc: update `ChangeLog.md`
[haskell/symantic-parser.git] / tests / Golden / Splice / G5.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 inp = init
89 in let readFail = finalRaise
90 in let _ = "checkHorizon.newCheck: checkedHorizon=0 minHoriz=4"
91 in if readMore (Symantic.Parser.Machine.Input.shiftRightText 3 inp)
92 then
93 let name = \(!callerOnReturn) (!callerInput) (!callerOnExceptionStackByLabel) ->
94 let _ = "catch ExceptionFailure checkedHorizon=0"
95 in let onException =
96 let _ = "onException"
97 in \(!_exn) (!failInp) (!farInp) (!farExp) ->
98 let _ = "loadInput checkedHorizon=0"
99 in let _ = "checkHorizon.noCheck"
100 in Data.Map.Strict.Internal.findWithDefault finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure callerOnExceptionStackByLabel Symantic.Parser.Grammar.Combinators.ExceptionFailure callerInput farInp farExp
101 in let _ = "pushValue"
102 in let _ = "comment: satisfy ((GHC.Classes.==) 'a')"
103 in let inp = callerInput
104 in let readFail = onException
105 in let _ = "checkHorizon.newCheck: checkedHorizon=0 minHoriz=4"
106 in if readMore (Symantic.Parser.Machine.Input.shiftRightText 3 inp)
107 then
108 let _ = "checkToken"
109 in let !(#
110 c,
111 cs
112 #) = readNext inp
113 in if (GHC.Classes.==) 'a' c
114 then
115 let _ = "lift2Value checkedHorizon=4"
116 in let _ = "comment: satisfy ((GHC.Classes.==) 'b')"
117 in let _ = "checkHorizon.oldCheck: checkedHorizon=4"
118 in let _ = "checkToken"
119 in let !(#
120 c,
121 cs
122 #) = readNext cs
123 in if (GHC.Classes.==) 'b' c
124 then
125 let _ = "lift2Value checkedHorizon=3"
126 in let _ = "comment: satisfy ((GHC.Classes.==) 'c')"
127 in let _ = "checkHorizon.oldCheck: checkedHorizon=3"
128 in let _ = "checkToken"
129 in let !(#
130 c,
131 cs
132 #) = readNext cs
133 in if (GHC.Classes.==) 'c' c
134 then
135 let _ = "lift2Value checkedHorizon=2"
136 in let _ = "comment: satisfy ((GHC.Classes.==) 'd')"
137 in let _ = "checkHorizon.oldCheck: checkedHorizon=2"
138 in let _ = "checkToken"
139 in let !(#
140 c,
141 cs
142 #) = readNext cs
143 in if (GHC.Classes.==) 'd' c
144 then
145 let _ = "lift2Value checkedHorizon=1"
146 in let _ = "commit"
147 in let _ = "resume"
148 in callerOnReturn
149 init
150 Data.Set.Internal.empty
151 ( let _ = "resume.genCode"
152 in (GHC.Types.:) 'a' ((GHC.Types.:) 'b' ((GHC.Types.:) 'c' ((GHC.Types.:) 'd' GHC.Types . [])))
153 )
154 cs
155 else
156 let _ = "checkToken.fail"
157 in let failExp =
158 Data.Set.Internal.Bin
159 1
160 ( Symantic.Parser.Grammar.Combinators.SomeFailure
161 ( case inputToken of
162 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'd'
163 )
164 )
165 Data.Set.Internal.Tip
166 Data.Set.Internal.Tip
167 in let (#
168 farInp,
169 farExp
170 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init cs of
171 GHC.Types.LT ->
172 (#
173 cs,
174 failExp
175 #)
176 GHC.Types.EQ ->
177 (#
178 init,
179 failExp GHC.Base.<> Data.Set.Internal.empty
180 #)
181 GHC.Types.GT ->
182 (#
183 init,
184 Data.Set.Internal.empty
185 #)
186 in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure cs farInp farExp
187 else
188 let _ = "checkToken.fail"
189 in let failExp =
190 Data.Set.Internal.Bin
191 1
192 ( Symantic.Parser.Grammar.Combinators.SomeFailure
193 ( case inputToken of
194 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'c'
195 )
196 )
197 Data.Set.Internal.Tip
198 Data.Set.Internal.Tip
199 in let (#
200 farInp,
201 farExp
202 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init cs of
203 GHC.Types.LT ->
204 (#
205 cs,
206 failExp
207 #)
208 GHC.Types.EQ ->
209 (#
210 init,
211 failExp GHC.Base.<> Data.Set.Internal.empty
212 #)
213 GHC.Types.GT ->
214 (#
215 init,
216 Data.Set.Internal.empty
217 #)
218 in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure cs farInp farExp
219 else
220 let _ = "checkToken.fail"
221 in let failExp =
222 Data.Set.Internal.Bin
223 1
224 ( Symantic.Parser.Grammar.Combinators.SomeFailure
225 ( case inputToken of
226 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'b'
227 )
228 )
229 Data.Set.Internal.Tip
230 Data.Set.Internal.Tip
231 in let (#
232 farInp,
233 farExp
234 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init cs of
235 GHC.Types.LT ->
236 (#
237 cs,
238 failExp
239 #)
240 GHC.Types.EQ ->
241 (#
242 init,
243 failExp GHC.Base.<> Data.Set.Internal.empty
244 #)
245 GHC.Types.GT ->
246 (#
247 init,
248 Data.Set.Internal.empty
249 #)
250 in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure cs farInp farExp
251 else
252 let _ = "checkToken.fail"
253 in let failExp =
254 Data.Set.Internal.Bin
255 1
256 ( Symantic.Parser.Grammar.Combinators.SomeFailure
257 ( case inputToken of
258 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'a'
259 )
260 )
261 Data.Set.Internal.Tip
262 Data.Set.Internal.Tip
263 in let (#
264 farInp,
265 farExp
266 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of
267 GHC.Types.LT ->
268 (#
269 inp,
270 failExp
271 #)
272 GHC.Types.EQ ->
273 (#
274 init,
275 failExp GHC.Base.<> Data.Set.Internal.empty
276 #)
277 GHC.Types.GT ->
278 (#
279 init,
280 Data.Set.Internal.empty
281 #)
282 in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp
283 else
284 let _ = "checkHorizon.newCheck.fail"
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.FailureHorizon @tok' 4
291 )
292 )
293 Data.Set.Internal.Tip
294 Data.Set.Internal.Tip
295 in let (#
296 farInp,
297 farExp
298 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of
299 GHC.Types.LT ->
300 (#
301 inp,
302 failExp
303 #)
304 GHC.Types.EQ ->
305 (#
306 init,
307 failExp GHC.Base.<> Data.Set.Internal.empty
308 #)
309 GHC.Types.GT ->
310 (#
311 init,
312 Data.Set.Internal.empty
313 #)
314 in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp
315 in let _ = "pushValue"
316 in name
317 ( let _ = "onReturn"
318 in \farInp farExp v (!inp) ->
319 let _ = "lift2Value checkedHorizon=0"
320 in let _ = "pushValue"
321 in do
322 let dupv = \x -> x
323 reg <- GHC.STRef.newSTRef dupv
324 let _ = "iter"
325 in let onException loopInput =
326 let _ = "onException"
327 in \(!_exn) (!failInp) (!farInp) (!farExp) ->
328 let _ = "comment: raiseAgainIfConsumed"
329 in let _ = "saveInput checkedHorizon=0"
330 in let _ = "lift2Value checkedHorizon=0"
331 in if ( \( Data.Text.Internal.Text
332 _
333 i
334 _
335 )
336 ( Data.Text.Internal.Text
337 _
338 j
339 _
340 ) -> i GHC.Classes.== j
341 )
342 loopInput
343 failInp
344 then
345 let _ = "choicesBranch checkedHorizon=0"
346 in do
347 sr <- GHC.STRef.readSTRef reg
348 let _ = "pushValue"
349 in let _ = "lift2Value checkedHorizon=0"
350 in let _ = "lift2Value checkedHorizon=0"
351 in let join = \farInp farExp v (!inp) ->
352 let _ = "lift2Value checkedHorizon=0"
353 in let _ = "resume"
354 in finalRet
355 farInp
356 farExp
357 ( let _ = "resume.genCode"
358 in GHC.Show.show ((GHC.Types.:) v (sr GHC.Types . []))
359 )
360 inp
361 in let _ = "catch ExceptionFailure checkedHorizon=0"
362 in let onException =
363 let _ = "onException"
364 in \(!_exn) (!failInp) (!farInp) (!farExp) ->
365 let _ = "comment: raiseAgainIfConsumed"
366 in let _ = "saveInput checkedHorizon=0"
367 in let _ = "lift2Value checkedHorizon=0"
368 in if ( \( Data.Text.Internal.Text
369 _
370 i
371 _
372 )
373 ( Data.Text.Internal.Text
374 _
375 j
376 _
377 ) -> i GHC.Classes.== j
378 )
379 failInp
380 failInp
381 then
382 let _ = "choicesBranch checkedHorizon=0"
383 in let _ = "comment: eof.fail"
384 in let failExp = Data.Set.Internal.Bin 1 (Symantic.Parser.Grammar.Combinators.SomeFailure Symantic.Parser.Grammar.Combinators.FailureEnd) Data.Set.Internal.Tip Data.Set.Internal.Tip
385 in let (#
386 farInp,
387 farExp
388 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp failInp of
389 GHC.Types.LT ->
390 (#
391 failInp,
392 failExp
393 #)
394 GHC.Types.EQ ->
395 (#
396 farInp,
397 failExp GHC.Base.<> farExp
398 #)
399 GHC.Types.GT ->
400 (#
401 farInp,
402 farExp
403 #)
404 in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp
405 else
406 let _ = "choicesBranch.else"
407 in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp
408 in let _ = "comment: negLook"
409 in let _ = "catch ExceptionFailure checkedHorizon=0"
410 in let onException =
411 let _ = "onException"
412 in \(!_exn) (!failInp) (!farInp) (!farExp) ->
413 let _ = "comment: negLook.reset"
414 in let _ = "loadInput checkedHorizon=0"
415 in let _ = "checkHorizon.noCheck"
416 in let _ = "pushValue"
417 in let _ = "commit"
418 in let _ = "resume"
419 in join
420 farInp
421 farExp
422 ( let _ = "resume.genCode"
423 in GHC.Tuple . ()
424 )
425 failInp
426 in let _ = "comment: negLook.ahead"
427 in let _ = "saveInput checkedHorizon=0"
428 in let _ = "comment: satisfy ((\\x_0 -> \\x_1 -> x_0) GHC.Types.True)"
429 in let inp = failInp
430 in let readFail = onException
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 let _ = "popValue"
440 in let _ = "commit"
441 in let _ = "loadInput checkedHorizon=0"
442 in let _ = "checkHorizon.noCheck"
443 in onException Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp
444 else
445 let _ = "checkHorizon.newCheck.fail"
446 in let failExp =
447 Data.Set.Internal.Bin
448 1
449 ( Symantic.Parser.Grammar.Combinators.SomeFailure
450 ( case inputToken of
451 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 1
452 )
453 )
454 Data.Set.Internal.Tip
455 Data.Set.Internal.Tip
456 in let (#
457 farInp,
458 farExp
459 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp inp of
460 GHC.Types.LT ->
461 (#
462 inp,
463 failExp
464 #)
465 GHC.Types.EQ ->
466 (#
467 farInp,
468 failExp GHC.Base.<> farExp
469 #)
470 GHC.Types.GT ->
471 (#
472 farInp,
473 farExp
474 #)
475 in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp
476 else
477 let _ = "choicesBranch.else"
478 in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp
479 loop = \_callerOnReturn callerInput callerOnExceptionStackByLabel ->
480 let _ = "pushValue"
481 in name
482 ( let _ = "onReturn"
483 in \farInp farExp v (!inp) ->
484 let _ = "lift2Value checkedHorizon=0"
485 in let _ = "pushValue"
486 in let _ = "lift2Value checkedHorizon=0"
487 in do
488 sr <- GHC.STRef.readSTRef reg
489 let _ = "lift2Value checkedHorizon=0"
490 in do
491 let dupv = \x -> sr ((GHC.Types.:) v x)
492 GHC.STRef.writeSTRef reg dupv
493 let _ = "jump"
494 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)
495 )
496 callerInput
497 (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure (onException callerInput) Data.Map.Internal.Tip Data.Map.Internal.Tip)
498 in let _ = "jump"
499 in loop finalRet inp Data.Map.Internal.Tip
500 )
501 inp
502 Data.Map.Internal.Tip
503 else
504 let _ = "checkHorizon.newCheck.fail"
505 in let failExp =
506 Data.Set.Internal.Bin
507 1
508 ( Symantic.Parser.Grammar.Combinators.SomeFailure
509 ( case inputToken of
510 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 4
511 )
512 )
513 Data.Set.Internal.Tip
514 Data.Set.Internal.Tip
515 in let (#
516 farInp,
517 farExp
518 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of
519 GHC.Types.LT ->
520 (#
521 inp,
522 failExp
523 #)
524 GHC.Types.EQ ->
525 (#
526 init,
527 failExp GHC.Base.<> Data.Set.Internal.empty
528 #)
529 GHC.Types.GT ->
530 (#
531 init,
532 Data.Set.Internal.empty
533 #)
534 in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp
535 )