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