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