]> Git — Sourcephile - haskell/symantic-parser.git/blob - tests/Golden/Splice/G7.expected.txt
!fixup impl: move `liftTypedString` to `Language.Haskell.TH.Show`
[haskell/symantic-parser.git] / tests / Golden / Splice / G7.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 _ = "resume"
89 in finalRet
90 farInp
91 farExp
92 ( let _ = "resume.genCode"
93 in GHC.Show.show v
94 )
95 inp
96 buf
97 end
98 in let _ = "catch ExceptionFailure checkedHorizon=2"
99 in let onException =
100 let _ = "onException"
101 in \(!_exn) (!failInp) (!farInp) (!farExp) buf end ->
102 let _ = "comment: raiseAgainIfConsumed"
103 in let _ = "saveInput checkedHorizon=0"
104 in let _ = "lift2Value checkedHorizon=0"
105 in if (GHC.Classes.==) @GHC.Types.Int initPos failInp
106 then
107 let _ = "choicesBranch checkedHorizon=0"
108 in let _ = "catch ExceptionFailure checkedHorizon=0"
109 in let onException =
110 let _ = "onException"
111 in \(!_exn) (!failInp) (!farInp) (!farExp) buf end ->
112 let _ = "loadInput checkedHorizon=0"
113 in let _ = "checkHorizon.noCheck"
114 in Symantic.Parser.Machine.Generate.unForallOnException finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp buf end
115 in let _ = "pushValue"
116 in let _ = "comment: satisfy ((GHC.Classes.==) 'a')"
117 in let partialCont buf =
118 let readFail = onException
119 in let _ = "checkHorizon.newCheck: checkedHorizon=0 minHoriz=2"
120 in if readMore buf ((GHC.Num.+) @GHC.Types.Int 1 failInp)
121 then
122 let _ = "checkToken"
123 in let !(#
124 c,
125 cs
126 #) = readNext buf failInp
127 in if (GHC.Classes.==) 'a' c
128 then
129 let _ = "lift2Value checkedHorizon=2"
130 in let _ = "comment: satisfy ((GHC.Classes.==) 'b')"
131 in let _ = "checkHorizon.oldCheck: checkedHorizon=2"
132 in let _ = "checkToken"
133 in let !(#
134 c,
135 cs
136 #) = readNext buf cs
137 in if (GHC.Classes.==) 'b' c
138 then
139 let _ = "lift2Value checkedHorizon=1"
140 in let _ = "commit"
141 in let _ = "resume"
142 in join
143 farInp
144 farExp
145 ( let _ = "resume.genCode"
146 in (GHC.Types.:) 'a' ((GHC.Types.:) 'b' GHC.Types . [])
147 )
148 cs
149 buf
150 end
151 else
152 let _ = "checkToken.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.FailureToken 'b'
159 )
160 )
161 Data.Set.Internal.Tip
162 Data.Set.Internal.Tip
163 in let (#
164 farInp,
165 farExp
166 #) = case GHC.Classes.compare @GHC.Types.Int farInp cs of
167 GHC.Types.LT ->
168 (#
169 cs,
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 readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure cs farInp farExp buf end
183 else
184 let _ = "checkToken.fail"
185 in let failExp =
186 Data.Set.Internal.Bin
187 1
188 ( Symantic.Parser.Grammar.Combinators.SomeFailure
189 ( case inputToken of
190 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'a'
191 )
192 )
193 Data.Set.Internal.Tip
194 Data.Set.Internal.Tip
195 in let (#
196 farInp,
197 farExp
198 #) = case GHC.Classes.compare @GHC.Types.Int farInp failInp of
199 GHC.Types.LT ->
200 (#
201 failInp,
202 failExp
203 #)
204 GHC.Types.EQ ->
205 (#
206 farInp,
207 failExp GHC.Base.<> farExp
208 #)
209 GHC.Types.GT ->
210 (#
211 farInp,
212 farExp
213 #)
214 in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp buf end
215 else
216 let _ = "checkHorizon.newCheck.fail"
217 in let noMoreInput =
218 let failExp =
219 Data.Set.Internal.Bin
220 1
221 ( Symantic.Parser.Grammar.Combinators.SomeFailure
222 ( case inputToken of
223 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 2
224 )
225 )
226 Data.Set.Internal.Tip
227 Data.Set.Internal.Tip
228 in let (#
229 farInp,
230 farExp
231 #) = case GHC.Classes.compare @GHC.Types.Int farInp failInp of
232 GHC.Types.LT ->
233 (#
234 failInp,
235 failExp
236 #)
237 GHC.Types.EQ ->
238 (#
239 farInp,
240 failExp GHC.Base.<> farExp
241 #)
242 GHC.Types.GT ->
243 (#
244 farInp,
245 farExp
246 #)
247 in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp buf GHC.Types.True
248 in if end
249 then noMoreInput
250 else
251 Symantic.Parser.Machine.Generate.returnST GHC.Base.$
252 ( Symantic.Parser.Machine.Generate.ResultPartial GHC.Base.$
253 ( \newInput ->
254 if Symantic.Parser.Machine.Input.nullInput newInput
255 then noMoreInput
256 else partialCont (append buf newInput)
257 )
258 )
259 in partialCont buf
260 else
261 let _ = "choicesBranch.else"
262 in Symantic.Parser.Machine.Generate.unForallOnException finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp buf end
263 in let _ = "catch ExceptionFailure checkedHorizon=2"
264 in let onException =
265 let _ = "onException"
266 in \(!_exn) (!failInp) (!farInp) (!farExp) buf end ->
267 let _ = "loadInput checkedHorizon=2"
268 in let _ = "checkHorizon.oldCheck: checkedHorizon=2"
269 in onException Symantic.Parser.Grammar.Combinators.ExceptionFailure initPos farInp farExp buf end
270 in let _ = "pushValue"
271 in let _ = "comment: satisfy ((GHC.Classes.==) 'a')"
272 in let _ = "checkHorizon.oldCheck: checkedHorizon=2"
273 in let _ = "checkToken"
274 in let !(#
275 c,
276 cs
277 #) = readNext buf initPos
278 in if (GHC.Classes.==) 'a' c
279 then
280 let _ = "lift2Value checkedHorizon=1"
281 in let _ = "comment: satisfy ((GHC.Classes.==) 'a')"
282 in let _ = "checkHorizon.oldCheck: checkedHorizon=1"
283 in let _ = "checkToken"
284 in let !(#
285 c,
286 cs
287 #) = readNext buf cs
288 in if (GHC.Classes.==) 'a' c
289 then
290 let _ = "lift2Value checkedHorizon=0"
291 in let _ = "commit"
292 in let _ = "commit"
293 in let _ = "resume"
294 in join
295 initPos
296 Data.Set.Internal.empty
297 ( let _ = "resume.genCode"
298 in (GHC.Types.:) 'a' ((GHC.Types.:) 'a' GHC.Types . [])
299 )
300 cs
301 buf
302 GHC.Types.False
303 else
304 let _ = "checkToken.fail"
305 in let failExp =
306 Data.Set.Internal.Bin
307 1
308 ( Symantic.Parser.Grammar.Combinators.SomeFailure
309 ( case inputToken of
310 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'a'
311 )
312 )
313 Data.Set.Internal.Tip
314 Data.Set.Internal.Tip
315 in let (#
316 farInp,
317 farExp
318 #) = case GHC.Classes.compare @GHC.Types.Int initPos cs of
319 GHC.Types.LT ->
320 (#
321 cs,
322 failExp
323 #)
324 GHC.Types.EQ ->
325 (#
326 initPos,
327 failExp GHC.Base.<> Data.Set.Internal.empty
328 #)
329 GHC.Types.GT ->
330 (#
331 initPos,
332 Data.Set.Internal.empty
333 #)
334 in onException Symantic.Parser.Grammar.Combinators.ExceptionFailure cs farInp farExp buf GHC.Types.False
335 else
336 let _ = "checkToken.fail"
337 in let failExp =
338 Data.Set.Internal.Bin
339 1
340 ( Symantic.Parser.Grammar.Combinators.SomeFailure
341 ( case inputToken of
342 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'a'
343 )
344 )
345 Data.Set.Internal.Tip
346 Data.Set.Internal.Tip
347 in let (#
348 farInp,
349 farExp
350 #) = case GHC.Classes.compare @GHC.Types.Int initPos initPos of
351 GHC.Types.LT ->
352 (#
353 initPos,
354 failExp
355 #)
356 GHC.Types.EQ ->
357 (#
358 initPos,
359 failExp GHC.Base.<> Data.Set.Internal.empty
360 #)
361 GHC.Types.GT ->
362 (#
363 initPos,
364 Data.Set.Internal.empty
365 #)
366 in onException Symantic.Parser.Grammar.Combinators.ExceptionFailure initPos farInp farExp buf GHC.Types.False
367 else
368 let _ = "checkHorizon.newCheck.fail"
369 in let noMoreInput =
370 let failExp =
371 Data.Set.Internal.Bin
372 1
373 ( Symantic.Parser.Grammar.Combinators.SomeFailure
374 ( case inputToken of
375 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 2
376 )
377 )
378 Data.Set.Internal.Tip
379 Data.Set.Internal.Tip
380 in let (#
381 farInp,
382 farExp
383 #) = case GHC.Classes.compare @GHC.Types.Int initPos initPos of
384 GHC.Types.LT ->
385 (#
386 initPos,
387 failExp
388 #)
389 GHC.Types.EQ ->
390 (#
391 initPos,
392 failExp GHC.Base.<> Data.Set.Internal.empty
393 #)
394 GHC.Types.GT ->
395 (#
396 initPos,
397 Data.Set.Internal.empty
398 #)
399 in Symantic.Parser.Machine.Generate.unForallOnException finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure initPos farInp farExp buf GHC.Types.True
400 in if GHC.Types.False
401 then noMoreInput
402 else
403 Symantic.Parser.Machine.Generate.returnST GHC.Base.$
404 ( Symantic.Parser.Machine.Generate.ResultPartial GHC.Base.$
405 ( \newInput ->
406 if Symantic.Parser.Machine.Input.nullInput newInput
407 then noMoreInput
408 else partialCont (append buf newInput)
409 )
410 )
411 in partialCont initBuffer