]> Git — Sourcephile - haskell/symantic-parser.git/blob - tests/Golden/Splice/G6.expected.txt
doc: update `ChangeLog.md`
[haskell/symantic-parser.git] / tests / Golden / Splice / G6.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 _ = "pushValue"
128 in let _ = "comment: satisfy ((GHC.Classes.==) 'a')"
129 in let inp = failInp
130 in let readFail = finalRaise
131 in let _ = "checkHorizon.newCheck: checkedHorizon=0 minHoriz=2"
132 in if readMore (Symantic.Parser.Machine.Input.shiftRightText 1 inp)
133 then
134 let _ = "checkToken"
135 in let !(#
136 c,
137 cs
138 #) = readNext inp
139 in if (GHC.Classes.==) 'a' c
140 then
141 let _ = "lift2Value checkedHorizon=2"
142 in let _ = "comment: satisfy ((GHC.Classes.==) 'b')"
143 in let _ = "checkHorizon.oldCheck: checkedHorizon=2"
144 in let _ = "checkToken"
145 in let !(#
146 c,
147 cs
148 #) = readNext cs
149 in if (GHC.Classes.==) 'b' c
150 then
151 let _ = "lift2Value checkedHorizon=1"
152 in let _ = "resume"
153 in join
154 farInp
155 farExp
156 ( let _ = "resume.genCode"
157 in (GHC.Types.:) 'a' ((GHC.Types.:) 'b' GHC.Types . [])
158 )
159 cs
160 else
161 let _ = "checkToken.fail"
162 in let failExp =
163 Data.Set.Internal.Bin
164 1
165 ( Symantic.Parser.Grammar.Combinators.SomeFailure
166 ( case inputToken of
167 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'b'
168 )
169 )
170 Data.Set.Internal.Tip
171 Data.Set.Internal.Tip
172 in let (#
173 farInp,
174 farExp
175 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp cs of
176 GHC.Types.LT ->
177 (#
178 cs,
179 failExp
180 #)
181 GHC.Types.EQ ->
182 (#
183 farInp,
184 failExp GHC.Base.<> farExp
185 #)
186 GHC.Types.GT ->
187 (#
188 farInp,
189 farExp
190 #)
191 in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure cs farInp farExp
192 else
193 let _ = "checkToken.fail"
194 in let failExp =
195 Data.Set.Internal.Bin
196 1
197 ( Symantic.Parser.Grammar.Combinators.SomeFailure
198 ( case inputToken of
199 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'a'
200 )
201 )
202 Data.Set.Internal.Tip
203 Data.Set.Internal.Tip
204 in let (#
205 farInp,
206 farExp
207 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp inp of
208 GHC.Types.LT ->
209 (#
210 inp,
211 failExp
212 #)
213 GHC.Types.EQ ->
214 (#
215 farInp,
216 failExp GHC.Base.<> farExp
217 #)
218 GHC.Types.GT ->
219 (#
220 farInp,
221 farExp
222 #)
223 in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp
224 else
225 let _ = "checkHorizon.newCheck.fail"
226 in let failExp =
227 Data.Set.Internal.Bin
228 1
229 ( Symantic.Parser.Grammar.Combinators.SomeFailure
230 ( case inputToken of
231 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 2
232 )
233 )
234 Data.Set.Internal.Tip
235 Data.Set.Internal.Tip
236 in let (#
237 farInp,
238 farExp
239 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp inp of
240 GHC.Types.LT ->
241 (#
242 inp,
243 failExp
244 #)
245 GHC.Types.EQ ->
246 (#
247 farInp,
248 failExp GHC.Base.<> farExp
249 #)
250 GHC.Types.GT ->
251 (#
252 farInp,
253 farExp
254 #)
255 in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp
256 else
257 let _ = "choicesBranch.else"
258 in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp
259 in let _ = "pushValue"
260 in let _ = "comment: satisfy ((GHC.Classes.==) 'a')"
261 in let _ = "checkHorizon.oldCheck: checkedHorizon=2"
262 in let _ = "checkToken"
263 in let !(#
264 c,
265 cs
266 #) = readNext inp
267 in if (GHC.Classes.==) 'a' c
268 then
269 let _ = "lift2Value checkedHorizon=1"
270 in let _ = "comment: satisfy ((GHC.Classes.==) 'a')"
271 in let _ = "checkHorizon.oldCheck: checkedHorizon=1"
272 in let _ = "checkToken"
273 in let !(#
274 c,
275 cs
276 #) = readNext cs
277 in if (GHC.Classes.==) 'a' c
278 then
279 let _ = "lift2Value checkedHorizon=0"
280 in let _ = "commit"
281 in let _ = "resume"
282 in join
283 init
284 Data.Set.Internal.empty
285 ( let _ = "resume.genCode"
286 in (GHC.Types.:) 'a' ((GHC.Types.:) 'a' GHC.Types . [])
287 )
288 cs
289 else
290 let _ = "checkToken.fail"
291 in let failExp =
292 Data.Set.Internal.Bin
293 1
294 ( Symantic.Parser.Grammar.Combinators.SomeFailure
295 ( case inputToken of
296 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'a'
297 )
298 )
299 Data.Set.Internal.Tip
300 Data.Set.Internal.Tip
301 in let (#
302 farInp,
303 farExp
304 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init cs of
305 GHC.Types.LT ->
306 (#
307 cs,
308 failExp
309 #)
310 GHC.Types.EQ ->
311 (#
312 init,
313 failExp GHC.Base.<> Data.Set.Internal.empty
314 #)
315 GHC.Types.GT ->
316 (#
317 init,
318 Data.Set.Internal.empty
319 #)
320 in onException Symantic.Parser.Grammar.Combinators.ExceptionFailure cs farInp farExp
321 else
322 let _ = "checkToken.fail"
323 in let failExp =
324 Data.Set.Internal.Bin
325 1
326 ( Symantic.Parser.Grammar.Combinators.SomeFailure
327 ( case inputToken of
328 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'a'
329 )
330 )
331 Data.Set.Internal.Tip
332 Data.Set.Internal.Tip
333 in let (#
334 farInp,
335 farExp
336 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of
337 GHC.Types.LT ->
338 (#
339 inp,
340 failExp
341 #)
342 GHC.Types.EQ ->
343 (#
344 init,
345 failExp GHC.Base.<> Data.Set.Internal.empty
346 #)
347 GHC.Types.GT ->
348 (#
349 init,
350 Data.Set.Internal.empty
351 #)
352 in onException Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp
353 else
354 let _ = "checkHorizon.newCheck.fail"
355 in let failExp =
356 Data.Set.Internal.Bin
357 1
358 ( Symantic.Parser.Grammar.Combinators.SomeFailure
359 ( case inputToken of
360 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 2
361 )
362 )
363 Data.Set.Internal.Tip
364 Data.Set.Internal.Tip
365 in let (#
366 farInp,
367 farExp
368 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of
369 GHC.Types.LT ->
370 (#
371 inp,
372 failExp
373 #)
374 GHC.Types.EQ ->
375 (#
376 init,
377 failExp GHC.Base.<> Data.Set.Internal.empty
378 #)
379 GHC.Types.GT ->
380 (#
381 init,
382 Data.Set.Internal.empty
383 #)
384 in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp
385 )