]> Git — Sourcephile - haskell/symantic-parser.git/blob - test/Golden/Splice/G5.expected.txt
bug: a ref outside its def must be supported
[haskell/symantic-parser.git] / test / Golden / Splice / G5.expected.txt
1 test/Golden/Splice/G5.hs:0:0:: Splicing expression
2 P.runParser @Text Grammar.g5
3 ======>
4 \ (input :: inp)
5 -> let
6 !(# init, readMore, readNext #)
7 = let _ = "cursorOf" in
8 let
9 next t@(Data.Text.Internal.Text arr off unconsumed)
10 = let !(Data.Text.Unsafe.Iter c d) = (Data.Text.Unsafe.iter t) 0
11 in
12 (# c, ((Data.Text.Internal.Text arr) (off + d)) (unconsumed - d) #)
13 more (Data.Text.Internal.Text _ _ unconsumed) = (unconsumed > 0)
14 in (# input, more, next #) in
15 let finalRet = \ _farInp _farExp v _inp -> Right v in
16 let
17 finalRaise :: forall b. P.Catcher inp b
18 = \ _failInp !farInp !farExp
19 -> Left
20 P.ParsingErrorStandard
21 {P.parsingErrorOffset = P.offset farInp,
22 P.parsingErrorUnexpected = if readMore farInp then
23 Just (let (# c, _ #) = readNext farInp in c)
24 else
25 Nothing,
26 P.parsingErrorExpecting = Data.Set.Internal.fromList farExp} in
27 let
28 name
29 = \ !ok !inp !koByLabel
30 -> let _ = "catchException lbl=fail" in
31 let
32 readFail
33 = \ !failInp !farInp !farExp
34 -> let
35 (# farInp, farExp #)
36 = case ((compare `Data.Function.on` P.offset) farInp) inp of
37 LT -> (# inp, [] #)
38 EQ -> (# farInp, (farExp <> []) #)
39 GT -> (# farInp, farExp #)
40 in
41 (((((Data.Map.Strict.Internal.findWithDefault finalRaise) "fail")
42 koByLabel)
43 inp)
44 farInp)
45 farExp
46 in
47 if readMore ((P.shiftRightText 3) inp) then
48 let !(# c, cs #) = readNext inp
49 in
50 if ('a' ==) c then
51 let readFail = readFail in
52 let !(# c, cs #) = readNext cs
53 in
54 if ('b' ==) c then
55 let readFail = readFail in
56 let !(# c, cs #) = readNext cs
57 in
58 if ('c' ==) c then
59 let readFail = readFail in
60 let !(# c, cs #) = readNext cs
61 in
62 if ('d' ==) c then
63 let _ = "resume"
64 in
65 (((ok init) [])
66 (let _ = "resume.genCode"
67 in
68 ((\ x -> \ x -> x x)
69 (((\ x -> \ x -> x x)
70 (((\ x -> \ x -> x x)
71 (((\ x -> \ x -> x x)
72 (\ x
73 -> \ x
74 -> \ x
75 -> \ x
76 -> ('a'
77 : ('b'
78 : ('c'
79 : ('d'
80 : []))))))
81 c))
82 c))
83 c))
84 c))
85 cs
86 else
87 let _ = "checkToken.else" in
88 let
89 (# farInp, farExp #)
90 = case
91 ((compare `Data.Function.on` P.offset)
92 init)
93 cs
94 of
95 LT -> (# cs, [P.ErrorItemToken 'd'] #)
96 EQ
97 -> (# init,
98 ([] <> [P.ErrorItemToken 'd']) #)
99 GT -> (# init, [] #)
100 in ((readFail cs) farInp) farExp
101 else
102 let _ = "checkToken.else" in
103 let
104 (# farInp, farExp #)
105 = case
106 ((compare `Data.Function.on` P.offset) init)
107 cs
108 of
109 LT -> (# cs, [P.ErrorItemToken 'c'] #)
110 EQ -> (# init, ([] <> [P.ErrorItemToken 'c']) #)
111 GT -> (# init, [] #)
112 in ((readFail cs) farInp) farExp
113 else
114 let _ = "checkToken.else" in
115 let
116 (# farInp, farExp #)
117 = case ((compare `Data.Function.on` P.offset) init) cs of
118 LT -> (# cs, [P.ErrorItemToken 'b'] #)
119 EQ -> (# init, ([] <> [P.ErrorItemToken 'b']) #)
120 GT -> (# init, [] #)
121 in ((readFail cs) farInp) farExp
122 else
123 let _ = "checkToken.else" in
124 let
125 (# farInp, farExp #)
126 = case ((compare `Data.Function.on` P.offset) init) inp of
127 LT -> (# inp, [P.ErrorItemToken 'a'] #)
128 EQ -> (# init, ([] <> [P.ErrorItemToken 'a']) #)
129 GT -> (# init, [] #)
130 in ((readFail inp) farInp) farExp
131 else
132 let _ = "checkHorizon.else" in
133 let
134 (# farInp, farExp #)
135 = case ((compare `Data.Function.on` P.offset) init) inp of
136 LT -> (# inp, [P.ErrorItemHorizon 4] #)
137 EQ -> (# init, ([] <> [P.ErrorItemHorizon 4]) #)
138 GT -> (# init, [] #)
139 in ((readFail inp) farInp) farExp in
140 let
141 _ = "call exceptionsByName(name_1)=["fail"] catchStackByLabel(ctx)=[]"
142 in
143 ((name
144 (let
145 _ = "suspend raiseException=fromList [(name_1,fromList [("fail",())])]"
146 in
147 \ farInp farExp v !inp
148 -> let
149 name
150 = \ !ok !inp !koByLabel
151 -> let _ = "catchException lbl=fail" in
152 let
153 _ = "call exceptionsByName(name_1)=["fail"] catchStackByLabel(ctx)=["fail"]"
154 in
155 ((name
156 (let
157 _ = "suspend raiseException=fromList [(name_1,fromList [("fail",())]),(name_2,fromList [])]"
158 in
159 \ farInp farExp v !inp
160 -> let
161 _ = "call exceptionsByName(name_2)=[] catchStackByLabel(ctx)=["fail"]"
162 in
163 ((name
164 (let
165 _ = "suspend raiseException=fromList [(name_1,fromList [("fail",())]),(name_2,fromList [])]"
166 in
167 \ farInp farExp v !inp
168 -> let _ = "resume"
169 in
170 (((ok farInp) farExp)
171 (let _ = "resume.genCode"
172 in
173 ((\ x -> \ x -> x x)
174 (((\ x -> \ x -> x x)
175 (\ x
176 -> \ x
177 -> \ x
178 -> (x : x x)))
179 v))
180 v))
181 inp))
182 inp)
183 (((((Data.Map.Internal.Bin 1) "fail")
184 (\ !failInp !farInp !farExp
185 -> if (\ x -> x)
186 (((\ (Data.Text.Internal.Text _
187 i
188 _)
189 (Data.Text.Internal.Text _
190 j
191 _)
192 -> (i == j))
193 inp)
194 failInp) then
195 let _ = "resume"
196 in
197 (((ok farInp) farExp)
198 (let _ = "resume.genCode"
199 in \ x -> x))
200 failInp
201 else
202 let
203 (# farInp, farExp #)
204 = case
205 ((compare
206 `Data.Function.on`
207 P.offset)
208 farInp)
209 failInp
210 of
211 LT -> (# failInp, [] #)
212 EQ
213 -> (# farInp,
214 (farExp <> []) #)
215 GT
216 -> (# farInp, farExp #)
217 in
218 (((((Data.Map.Strict.Internal.findWithDefault
219 finalRaise)
220 "fail")
221 koByLabel)
222 failInp)
223 farInp)
224 farExp))
225 Data.Map.Internal.Tip)
226 Data.Map.Internal.Tip)))
227 inp)
228 (((((Data.Map.Internal.Bin 1) "fail")
229 (\ !failInp !farInp !farExp
230 -> if (\ x -> x)
231 (((\ (Data.Text.Internal.Text _ i _)
232 (Data.Text.Internal.Text _ j _)
233 -> (i == j))
234 inp)
235 failInp) then
236 let _ = "resume"
237 in
238 (((ok farInp) farExp)
239 (let _ = "resume.genCode" in \ x -> x))
240 failInp
241 else
242 let
243 (# farInp, farExp #)
244 = case
245 ((compare
246 `Data.Function.on` P.offset)
247 farInp)
248 failInp
249 of
250 LT -> (# failInp, [] #)
251 EQ -> (# farInp, (farExp <> []) #)
252 GT -> (# farInp, farExp #)
253 in
254 (((((Data.Map.Strict.Internal.findWithDefault
255 finalRaise)
256 "fail")
257 koByLabel)
258 failInp)
259 farInp)
260 farExp))
261 Data.Map.Internal.Tip)
262 Data.Map.Internal.Tip) in
263 let
264 _ = "call exceptionsByName(name_2)=["fail"] catchStackByLabel(ctx)=[]"
265 in
266 ((name
267 (let
268 _ = "suspend raiseException=fromList [(name_1,fromList [("fail",())]),(name_2,fromList [("fail",())])]"
269 in
270 \ farInp farExp v !inp
271 -> let
272 join
273 = \ farInp farExp v !inp
274 -> let _ = "resume"
275 in
276 (((finalRet farInp) farExp)
277 (let _ = "resume.genCode"
278 in
279 ((\ x -> \ x -> x x)
280 (((\ x -> \ x -> x x)
281 (((\ x -> \ x -> x x)
282 (\ x
283 -> \ x -> \ x -> (x : x [])))
284 v))
285 v))
286 v))
287 inp in
288 let _ = "catchException lbl=fail" in
289 let _ = "catchException lbl=fail" in
290 let
291 readFail
292 = \ !failInp !farInp !farExp
293 -> let _ = "resume"
294 in
295 (((join farInp) farExp)
296 (let _ = "resume.genCode" in ()))
297 inp
298 in
299 if readMore inp then
300 let !(# c, cs #) = readNext inp
301 in
302 if (\ x -> True) c then
303 let
304 (# farInp, farExp #)
305 = case
306 ((compare `Data.Function.on` P.offset)
307 farInp)
308 inp
309 of
310 LT -> (# inp, [] #)
311 EQ -> (# farInp, (farExp <> []) #)
312 GT -> (# farInp, farExp #)
313 in
314 (((\ !failInp !farInp !farExp
315 -> if (\ x -> x)
316 (((\ (Data.Text.Internal.Text _ i _)
317 (Data.Text.Internal.Text _ j _)
318 -> (i == j))
319 inp)
320 failInp) then
321 let
322 (# farInp, farExp #)
323 = case
324 ((compare
325 `Data.Function.on`
326 P.offset)
327 farInp)
328 failInp
329 of
330 LT
331 -> (# failInp,
332 [P.ErrorItemEnd] #)
333 EQ
334 -> (# farInp,
335 (farExp
336 <>
337 [P.ErrorItemEnd]) #)
338 GT -> (# farInp, farExp #)
339 in
340 ((finalRaise failInp) farInp)
341 farExp
342 else
343 let
344 (# farInp, farExp #)
345 = case
346 ((compare
347 `Data.Function.on`
348 P.offset)
349 farInp)
350 failInp
351 of
352 LT -> (# failInp, [] #)
353 EQ
354 -> (# farInp,
355 (farExp <> []) #)
356 GT -> (# farInp, farExp #)
357 in
358 ((finalRaise failInp) farInp)
359 farExp)
360 inp)
361 farInp)
362 farExp
363 else
364 let _ = "checkToken.else" in
365 let
366 (# farInp, farExp #)
367 = case
368 ((compare `Data.Function.on` P.offset)
369 farInp)
370 inp
371 of
372 LT -> (# inp, [] #)
373 EQ -> (# farInp, (farExp <> []) #)
374 GT -> (# farInp, farExp #)
375 in ((readFail inp) farInp) farExp
376 else
377 let _ = "checkHorizon.else" in
378 let
379 (# farInp, farExp #)
380 = case
381 ((compare `Data.Function.on` P.offset) farInp)
382 inp
383 of
384 LT -> (# inp, [P.ErrorItemHorizon 1] #)
385 EQ
386 -> (# farInp,
387 (farExp <> [P.ErrorItemHorizon 1]) #)
388 GT -> (# farInp, farExp #)
389 in ((readFail inp) farInp) farExp))
390 inp)
391 Data.Map.Internal.Tip))
392 init)
393 Data.Map.Internal.Tip