]> Git — Sourcephile - haskell/symantic-parser.git/blob - tests/Golden/Splice/G15.expected.txt
!fixup impl: move `liftTypedString` to `Language.Haskell.TH.Show`
[haskell/symantic-parser.git] / tests / Golden / Splice / G15.expected.txt
1 \(input :: inp) ->
2 let !(#
3 initBuffer,
4 initPos,
5 readMore,
6 readNext,
7 append
8 #) =
9 let next buf pos =
10 let !( Data.Text.Unsafe.Iter
11 c
12 d
13 ) = Symantic.Parser.Machine.Input.Text.Buffer.iter buf pos
14 in (# c, pos GHC.Num.+ d #)
15 more buf pos = pos GHC.Classes.< Symantic.Parser.Machine.Input.Text.Buffer.length buf
16 append = Symantic.Parser.Machine.Input.Text.Buffer.pappend
17 in (#
18 Symantic.Parser.Machine.Input.Text.Buffer.buffer input,
19 0,
20 more,
21 next,
22 append
23 #)
24 finalRet = \_farInp _farExp v _inp _buf _end -> Symantic.Parser.Machine.Generate.returnST GHC.Base.$ Symantic.Parser.Machine.Generate.ResultDone v
25 finalRaise :: Symantic.Parser.Machine.Generate.ForallOnException inp =
26 Symantic.Parser.Machine.Generate.ForallOnException GHC.Base.$
27 ( \(!exn) _failInp (!farInp) (!farExp) buf end ->
28 Symantic.Parser.Machine.Generate.returnST GHC.Base.$
29 Symantic.Parser.Machine.Generate.ResultError
30 Symantic.Parser.Machine.Generate.ParsingError
31 { Symantic.Parser.Machine.Generate.parsingErrorOffset = Symantic.Parser.Machine.Input.position farInp,
32 Symantic.Parser.Machine.Generate.parsingErrorException = exn,
33 Symantic.Parser.Machine.Generate.parsingErrorUnexpected =
34 if readMore buf farInp
35 then
36 GHC.Maybe.Just
37 ( let (#
38 c,
39 _
40 #) = readNext buf farInp
41 in c
42 )
43 else GHC.Maybe.Nothing,
44 Symantic.Parser.Machine.Generate.parsingErrorExpecting =
45 let ( minHoriz,
46 res
47 ) =
48 Data.Set.Internal.foldr
49 ( \f
50 ( minH,
51 acc
52 ) -> case Symantic.Parser.Grammar.Combinators.unSomeFailure f of
53 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)))
54 | GHC.Maybe.Just old <- minH ->
55 ( GHC.Maybe.Just (GHC.Classes.min old h),
56 acc
57 )
58 | GHC.Base.otherwise ->
59 ( GHC.Maybe.Just h,
60 acc
61 )
62 _ ->
63 ( minH,
64 f GHC.Types.: acc
65 )
66 )
67 ( GHC.Maybe.Nothing,
68 GHC.Types . []
69 )
70 farExp
71 in Data.Set.Internal.fromList GHC.Base.$
72 ( case minHoriz of
73 GHC.Maybe.Just h -> Symantic.Parser.Grammar.Combinators.SomeFailure (Symantic.Parser.Grammar.Combinators.FailureHorizon @(Symantic.Parser.Machine.Input.InputToken inp) h) GHC.Types.: res
74 GHC.Maybe.Nothing -> res
75 )
76 }
77 )
78 in let inputToken = Data.Proxy.Proxy :: Data.Proxy.Proxy (Symantic.Parser.Machine.Input.InputToken inp)
79 in let partialCont buf =
80 let readFail = Symantic.Parser.Machine.Generate.unForallOnException finalRaise
81 in let _ = "checkHorizon.newCheck: checkedHorizon=0 minHoriz=2"
82 in if readMore buf ((GHC.Num.+) @GHC.Types.Int 1 initPos)
83 then
84 let
85 in let _ = "pushValue"
86 in let join = \farInp farExp v (!inp) buf end ->
87 let _ = "lift2Value checkedHorizon=0"
88 in let _ = "comment: satisfy ((GHC.Classes.==) 'c')"
89 in let partialCont buf =
90 let readFail = Symantic.Parser.Machine.Generate.unForallOnException finalRaise
91 in let _ = "checkHorizon.newCheck: checkedHorizon=0 minHoriz=1"
92 in if readMore buf inp
93 then
94 let _ = "checkToken"
95 in let !(#
96 c,
97 cs
98 #) = readNext buf inp
99 in if (GHC.Classes.==) 'c' c
100 then
101 let _ = "lift2Value checkedHorizon=1"
102 in let _ = "resume"
103 in finalRet
104 farInp
105 farExp
106 ( let _ = "resume.genCode"
107 in GHC.Show.show v
108 )
109 cs
110 buf
111 end
112 else
113 let _ = "checkToken.fail"
114 in let failExp =
115 Data.Set.Internal.Bin
116 1
117 ( Symantic.Parser.Grammar.Combinators.SomeFailure
118 ( case inputToken of
119 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'c'
120 )
121 )
122 Data.Set.Internal.Tip
123 Data.Set.Internal.Tip
124 in let (#
125 farInp,
126 farExp
127 #) = case GHC.Classes.compare @GHC.Types.Int farInp inp of
128 GHC.Types.LT ->
129 (#
130 inp,
131 failExp
132 #)
133 GHC.Types.EQ ->
134 (#
135 farInp,
136 failExp GHC.Base.<> farExp
137 #)
138 GHC.Types.GT ->
139 (#
140 farInp,
141 farExp
142 #)
143 in Symantic.Parser.Machine.Generate.unForallOnException finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp buf end
144 else
145 let _ = "checkHorizon.newCheck.fail"
146 in let noMoreInput =
147 let failExp =
148 Data.Set.Internal.Bin
149 1
150 ( Symantic.Parser.Grammar.Combinators.SomeFailure
151 ( case inputToken of
152 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 1
153 )
154 )
155 Data.Set.Internal.Tip
156 Data.Set.Internal.Tip
157 in let (#
158 farInp,
159 farExp
160 #) = case GHC.Classes.compare @GHC.Types.Int farInp inp of
161 GHC.Types.LT ->
162 (#
163 inp,
164 failExp
165 #)
166 GHC.Types.EQ ->
167 (#
168 farInp,
169 failExp GHC.Base.<> farExp
170 #)
171 GHC.Types.GT ->
172 (#
173 farInp,
174 farExp
175 #)
176 in Symantic.Parser.Machine.Generate.unForallOnException finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp buf GHC.Types.True
177 in if end
178 then noMoreInput
179 else
180 Symantic.Parser.Machine.Generate.returnST GHC.Base.$
181 ( Symantic.Parser.Machine.Generate.ResultPartial GHC.Base.$
182 ( \newInput ->
183 if Symantic.Parser.Machine.Input.nullInput newInput
184 then noMoreInput
185 else partialCont (append buf newInput)
186 )
187 )
188 in partialCont buf
189 in let _ = "catch ExceptionFailure checkedHorizon=2"
190 in let onException =
191 let _ = "onException"
192 in \(!_exn) (!failInp) (!farInp) (!farExp) buf end ->
193 let _ = "comment: raiseAgainIfConsumed"
194 in let _ = "saveInput checkedHorizon=0"
195 in let _ = "lift2Value checkedHorizon=0"
196 in if (GHC.Classes.==) @GHC.Types.Int initPos failInp
197 then
198 let _ = "choicesBranch checkedHorizon=0"
199 in let _ = "pushValue"
200 in let _ = "comment: satisfy ((GHC.Classes.==) 'b')"
201 in let partialCont buf =
202 let readFail = Symantic.Parser.Machine.Generate.unForallOnException finalRaise
203 in let _ = "checkHorizon.newCheck: checkedHorizon=0 minHoriz=2"
204 in if readMore buf ((GHC.Num.+) @GHC.Types.Int 1 failInp)
205 then
206 let _ = "checkToken"
207 in let !(#
208 c,
209 cs
210 #) = readNext buf failInp
211 in if (GHC.Classes.==) 'b' c
212 then
213 let _ = "lift2Value checkedHorizon=2"
214 in let _ = "resume"
215 in join
216 farInp
217 farExp
218 ( let _ = "resume.genCode"
219 in 'b'
220 )
221 cs
222 buf
223 end
224 else
225 let _ = "checkToken.fail"
226 in let failExp =
227 Data.Set.Internal.Bin
228 1
229 ( Symantic.Parser.Grammar.Combinators.SomeFailure
230 ( case inputToken of
231 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'b'
232 )
233 )
234 Data.Set.Internal.Tip
235 Data.Set.Internal.Tip
236 in let (#
237 farInp,
238 farExp
239 #) = case GHC.Classes.compare @GHC.Types.Int farInp failInp of
240 GHC.Types.LT ->
241 (#
242 failInp,
243 failExp
244 #)
245 GHC.Types.EQ ->
246 (#
247 farInp,
248 failExp GHC.Base.<> farExp
249 #)
250 GHC.Types.GT ->
251 (#
252 farInp,
253 farExp
254 #)
255 in Symantic.Parser.Machine.Generate.unForallOnException finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp buf end
256 else
257 let _ = "checkHorizon.newCheck.fail"
258 in let noMoreInput =
259 let failExp =
260 Data.Set.Internal.Bin
261 1
262 ( Symantic.Parser.Grammar.Combinators.SomeFailure
263 ( case inputToken of
264 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 2
265 )
266 )
267 Data.Set.Internal.Tip
268 Data.Set.Internal.Tip
269 in let (#
270 farInp,
271 farExp
272 #) = case GHC.Classes.compare @GHC.Types.Int farInp failInp of
273 GHC.Types.LT ->
274 (#
275 failInp,
276 failExp
277 #)
278 GHC.Types.EQ ->
279 (#
280 farInp,
281 failExp GHC.Base.<> farExp
282 #)
283 GHC.Types.GT ->
284 (#
285 farInp,
286 farExp
287 #)
288 in Symantic.Parser.Machine.Generate.unForallOnException finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp buf GHC.Types.True
289 in if end
290 then noMoreInput
291 else
292 Symantic.Parser.Machine.Generate.returnST GHC.Base.$
293 ( Symantic.Parser.Machine.Generate.ResultPartial GHC.Base.$
294 ( \newInput ->
295 if Symantic.Parser.Machine.Input.nullInput newInput
296 then noMoreInput
297 else partialCont (append buf newInput)
298 )
299 )
300 in partialCont buf
301 else
302 let _ = "choicesBranch.else"
303 in Symantic.Parser.Machine.Generate.unForallOnException finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp buf end
304 in let _ = "pushValue"
305 in let _ = "comment: satisfy ((GHC.Classes.==) 'a')"
306 in let _ = "checkHorizon.oldCheck: checkedHorizon=2"
307 in let _ = "checkToken"
308 in let !(#
309 c,
310 cs
311 #) = readNext buf initPos
312 in if (GHC.Classes.==) 'a' c
313 then
314 let _ = "lift2Value checkedHorizon=1"
315 in let _ = "commit"
316 in let _ = "resume"
317 in join
318 initPos
319 Data.Set.Internal.empty
320 ( let _ = "resume.genCode"
321 in 'a'
322 )
323 cs
324 buf
325 GHC.Types.False
326 else
327 let _ = "checkToken.fail"
328 in let failExp =
329 Data.Set.Internal.Bin
330 1
331 ( Symantic.Parser.Grammar.Combinators.SomeFailure
332 ( case inputToken of
333 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'a'
334 )
335 )
336 Data.Set.Internal.Tip
337 Data.Set.Internal.Tip
338 in let (#
339 farInp,
340 farExp
341 #) = case GHC.Classes.compare @GHC.Types.Int initPos initPos of
342 GHC.Types.LT ->
343 (#
344 initPos,
345 failExp
346 #)
347 GHC.Types.EQ ->
348 (#
349 initPos,
350 failExp GHC.Base.<> Data.Set.Internal.empty
351 #)
352 GHC.Types.GT ->
353 (#
354 initPos,
355 Data.Set.Internal.empty
356 #)
357 in onException Symantic.Parser.Grammar.Combinators.ExceptionFailure initPos farInp farExp buf GHC.Types.False
358 else
359 let _ = "checkHorizon.newCheck.fail"
360 in let noMoreInput =
361 let failExp =
362 Data.Set.Internal.Bin
363 1
364 ( Symantic.Parser.Grammar.Combinators.SomeFailure
365 ( case inputToken of
366 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 2
367 )
368 )
369 Data.Set.Internal.Tip
370 Data.Set.Internal.Tip
371 in let (#
372 farInp,
373 farExp
374 #) = case GHC.Classes.compare @GHC.Types.Int initPos initPos of
375 GHC.Types.LT ->
376 (#
377 initPos,
378 failExp
379 #)
380 GHC.Types.EQ ->
381 (#
382 initPos,
383 failExp GHC.Base.<> Data.Set.Internal.empty
384 #)
385 GHC.Types.GT ->
386 (#
387 initPos,
388 Data.Set.Internal.empty
389 #)
390 in Symantic.Parser.Machine.Generate.unForallOnException finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure initPos farInp farExp buf GHC.Types.True
391 in if GHC.Types.False
392 then noMoreInput
393 else
394 Symantic.Parser.Machine.Generate.returnST GHC.Base.$
395 ( Symantic.Parser.Machine.Generate.ResultPartial GHC.Base.$
396 ( \newInput ->
397 if Symantic.Parser.Machine.Input.nullInput newInput
398 then noMoreInput
399 else partialCont (append buf newInput)
400 )
401 )
402 in partialCont initBuffer