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