]> Git — Sourcephile - haskell/symantic-parser.git/blob - test/Golden/Splice/G5.expected.txt
rename Symantic.{Univariant => Typed}
[haskell/symantic-parser.git] / test / 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 -> Data.Either.Right v
31 finalRaise ::
32 forall b.
33 Symantic.Parser.Machine.Generate.Catcher
34 inp
35 b = \(!exn) _failInp (!farInp) (!farExp) ->
36 Data.Either.Left
37 Symantic.Parser.Machine.Generate.ParsingErrorStandard
38 { Symantic.Parser.Machine.Generate.parsingErrorOffset = Symantic.Parser.Machine.Input.offset farInp,
39 Symantic.Parser.Machine.Generate.parsingErrorException = exn,
40 Symantic.Parser.Machine.Generate.parsingErrorUnexpected =
41 if readMore farInp
42 then
43 GHC.Maybe.Just
44 ( let (#
45 c,
46 _
47 #) = readNext farInp
48 in c
49 )
50 else GHC.Maybe.Nothing,
51 Symantic.Parser.Machine.Generate.parsingErrorExpecting = farExp
52 }
53 in let inputToken = Data.Proxy.Proxy :: Data.Proxy.Proxy (Symantic.Parser.Machine.Input.InputToken inp)
54 in let name = \(!ok) (!inp) (!koByLabel) ->
55 let _ = "catch ExceptionFailure"
56 in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =
57 let _ = "catch.ko ExceptionFailure"
58 in Data.Map.Strict.Internal.findWithDefault finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure koByLabel Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp
59 in let readFail = catchHandler
60 in if readMore (Symantic.Parser.Machine.Input.shiftRightText 3 inp)
61 then
62 let !(#
63 c,
64 cs
65 #) = readNext inp
66 in if (GHC.Classes.==) 'a' c
67 then
68 let readFail = readFail
69 in let !(#
70 c,
71 cs
72 #) = readNext cs
73 in if (GHC.Classes.==) 'b' c
74 then
75 let readFail = readFail
76 in let !(#
77 c,
78 cs
79 #) = readNext cs
80 in if (GHC.Classes.==) 'c' c
81 then
82 let readFail = readFail
83 in let !(#
84 c,
85 cs
86 #) = readNext cs
87 in if (GHC.Classes.==) 'd' c
88 then
89 let _ = "resume"
90 in ok
91 init
92 Data.Set.Internal.empty
93 ( let _ = "resume.genCode"
94 in (GHC.Types.:) 'a' ((GHC.Types.:) 'b' ((GHC.Types.:) 'c' ((GHC.Types.:) 'd' GHC.Types . [])))
95 )
96 cs
97 else
98 let _ = "checkToken.else"
99 in let failExp =
100 Data.Set.Internal.Bin
101 1
102 ( Symantic.Parser.Grammar.Combinators.SomeFailure
103 ( case inputToken of
104 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'd'
105 )
106 )
107 Data.Set.Internal.Tip
108 Data.Set.Internal.Tip
109 in let (#
110 farInp,
111 farExp
112 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init cs of
113 GHC.Types.LT ->
114 (#
115 cs,
116 failExp
117 #)
118 GHC.Types.EQ ->
119 (#
120 init,
121 failExp GHC.Base.<> Data.Set.Internal.empty
122 #)
123 GHC.Types.GT ->
124 (#
125 init,
126 Data.Set.Internal.empty
127 #)
128 in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure cs farInp farExp
129 else
130 let _ = "checkToken.else"
131 in let failExp =
132 Data.Set.Internal.Bin
133 1
134 ( Symantic.Parser.Grammar.Combinators.SomeFailure
135 ( case inputToken of
136 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'c'
137 )
138 )
139 Data.Set.Internal.Tip
140 Data.Set.Internal.Tip
141 in let (#
142 farInp,
143 farExp
144 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init cs of
145 GHC.Types.LT ->
146 (#
147 cs,
148 failExp
149 #)
150 GHC.Types.EQ ->
151 (#
152 init,
153 failExp GHC.Base.<> Data.Set.Internal.empty
154 #)
155 GHC.Types.GT ->
156 (#
157 init,
158 Data.Set.Internal.empty
159 #)
160 in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure cs farInp farExp
161 else
162 let _ = "checkToken.else"
163 in let failExp =
164 Data.Set.Internal.Bin
165 1
166 ( Symantic.Parser.Grammar.Combinators.SomeFailure
167 ( case inputToken of
168 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'b'
169 )
170 )
171 Data.Set.Internal.Tip
172 Data.Set.Internal.Tip
173 in let (#
174 farInp,
175 farExp
176 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init cs of
177 GHC.Types.LT ->
178 (#
179 cs,
180 failExp
181 #)
182 GHC.Types.EQ ->
183 (#
184 init,
185 failExp GHC.Base.<> Data.Set.Internal.empty
186 #)
187 GHC.Types.GT ->
188 (#
189 init,
190 Data.Set.Internal.empty
191 #)
192 in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure cs farInp farExp
193 else
194 let _ = "checkToken.else"
195 in let failExp =
196 Data.Set.Internal.Bin
197 1
198 ( Symantic.Parser.Grammar.Combinators.SomeFailure
199 ( case inputToken of
200 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'a'
201 )
202 )
203 Data.Set.Internal.Tip
204 Data.Set.Internal.Tip
205 in let (#
206 farInp,
207 farExp
208 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of
209 GHC.Types.LT ->
210 (#
211 inp,
212 failExp
213 #)
214 GHC.Types.EQ ->
215 (#
216 init,
217 failExp GHC.Base.<> Data.Set.Internal.empty
218 #)
219 GHC.Types.GT ->
220 (#
221 init,
222 Data.Set.Internal.empty
223 #)
224 in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp
225 else
226 let _ = "checkHorizon.else"
227 in let failExp =
228 Data.Set.Internal.Bin
229 1
230 ( Symantic.Parser.Grammar.Combinators.SomeFailure
231 ( case inputToken of
232 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 4
233 )
234 )
235 Data.Set.Internal.Tip
236 Data.Set.Internal.Tip
237 in let (#
238 farInp,
239 farExp
240 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of
241 GHC.Types.LT ->
242 (#
243 inp,
244 failExp
245 #)
246 GHC.Types.EQ ->
247 (#
248 init,
249 failExp GHC.Base.<> Data.Set.Internal.empty
250 #)
251 GHC.Types.GT ->
252 (#
253 init,
254 Data.Set.Internal.empty
255 #)
256 in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp
257 name = \(!ok) (!inp) (!koByLabel) ->
258 let _ = "catch ExceptionFailure"
259 in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =
260 let _ = "catch.ko ExceptionFailure"
261 in if ( \( Data.Text.Internal.Text
262 _
263 i
264 _
265 )
266 ( Data.Text.Internal.Text
267 _
268 j
269 _
270 ) -> i GHC.Classes.== j
271 )
272 inp
273 failInp
274 then
275 let _ = "choicesBranch.then"
276 in let _ = "resume"
277 in ok
278 farInp
279 farExp
280 ( let _ = "resume.genCode"
281 in \x -> x
282 )
283 failInp
284 else
285 let _ = "choicesBranch.else"
286 in Data.Map.Strict.Internal.findWithDefault finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure koByLabel Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp
287 in name
288 ( let _ = "suspend"
289 in \farInp farExp v (!inp) ->
290 name
291 ( let _ = "suspend"
292 in \farInp farExp v (!inp) ->
293 let _ = "resume"
294 in ok
295 farInp
296 farExp
297 ( let _ = "resume.genCode"
298 in \x -> (GHC.Types.:) v (v x)
299 )
300 inp
301 )
302 inp
303 (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure catchHandler Data.Map.Internal.Tip Data.Map.Internal.Tip)
304 )
305 inp
306 (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure catchHandler Data.Map.Internal.Tip Data.Map.Internal.Tip)
307 in name
308 ( let _ = "suspend"
309 in \farInp farExp v (!inp) ->
310 name
311 ( let _ = "suspend"
312 in \farInp farExp v (!inp) ->
313 let join = \farInp farExp v (!inp) ->
314 let _ = "resume"
315 in finalRet
316 farInp
317 farExp
318 ( let _ = "resume.genCode"
319 in GHC.Show.show ((GHC.Types.:) v (v GHC.Types . []))
320 )
321 inp
322 in let _ = "catch ExceptionFailure"
323 in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =
324 let _ = "catch.ko ExceptionFailure"
325 in if ( \( Data.Text.Internal.Text
326 _
327 i
328 _
329 )
330 ( Data.Text.Internal.Text
331 _
332 j
333 _
334 ) -> i GHC.Classes.== j
335 )
336 inp
337 failInp
338 then
339 let _ = "choicesBranch.then"
340 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
341 in let (#
342 farInp,
343 farExp
344 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp failInp of
345 GHC.Types.LT ->
346 (#
347 failInp,
348 failExp
349 #)
350 GHC.Types.EQ ->
351 (#
352 farInp,
353 failExp GHC.Base.<> farExp
354 #)
355 GHC.Types.GT ->
356 (#
357 farInp,
358 farExp
359 #)
360 in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp
361 else
362 let _ = "choicesBranch.else"
363 in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp
364 in let _ = "catch ExceptionFailure"
365 in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =
366 let _ = "catch.ko ExceptionFailure"
367 in let _ = "resume"
368 in join
369 farInp
370 farExp
371 ( let _ = "resume.genCode"
372 in GHC.Tuple . ()
373 )
374 inp
375 in let readFail = catchHandler
376 in if readMore inp
377 then
378 let !(#
379 c,
380 cs
381 #) = readNext inp
382 in if (\x -> GHC.Types.True) c
383 then catchHandler Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp
384 else
385 let _ = "checkToken.else"
386 in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp
387 else
388 let _ = "checkHorizon.else"
389 in let failExp =
390 Data.Set.Internal.Bin
391 1
392 ( Symantic.Parser.Grammar.Combinators.SomeFailure
393 ( case inputToken of
394 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 1
395 )
396 )
397 Data.Set.Internal.Tip
398 Data.Set.Internal.Tip
399 in let (#
400 farInp,
401 farExp
402 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp inp of
403 GHC.Types.LT ->
404 (#
405 inp,
406 failExp
407 #)
408 GHC.Types.EQ ->
409 (#
410 farInp,
411 failExp GHC.Base.<> farExp
412 #)
413 GHC.Types.GT ->
414 (#
415 farInp,
416 farExp
417 #)
418 in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp
419 )
420 inp
421 Data.Map.Internal.Tip
422 )
423 init
424 Data.Map.Internal.Tip