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