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