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