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