]> Git — Sourcephile - haskell/symantic-parser.git/blob - tests/Golden/Splice/G12.expected.txt
wip
[haskell/symantic-parser.git] / tests / Golden / Splice / G12.expected.txt
1 \(input_0 :: inp_6989586621679402203) ->
2 let !(#
3 initBuffer_1,
4 initPos_2,
5 readMore_3,
6 readNext_4,
7 append_5
8 #) =
9 let next_6 buf_7 pos_8 =
10 let !( Data.Text.Unsafe.Iter
11 c_9
12 d_10
13 ) = Symantic.Parser.Machine.Input.Text.Buffer.iter buf_7 pos_8
14 in (#
15 c_9,
16 pos_8 GHC.Num.+ d_10
17 #)
18 more_11 buf_12 pos_13 = pos_13 GHC.Classes.< Symantic.Parser.Machine.Input.Text.Buffer.length buf_12
19 append_14 = Symantic.Parser.Machine.Input.Text.Buffer.pappend
20 in (#
21 Symantic.Parser.Machine.Input.Text.Buffer.buffer input_0,
22 0,
23 more_11,
24 next_6,
25 append_14
26 #)
27 finalRet_15 = \_farInp_16 _farExp_17 v_18 _inp_19 -> Symantic.Parser.Machine.Generate.returnST GHC.Base.$ Symantic.Parser.Machine.Generate.ResultDone v_18
28 finalRaise_20 ::
29 forall b_21.
30 Symantic.Parser.Machine.Generate.OnException
31 inp_6989586621679402203
32 b_21 = \(!exn_22) _failInp_23 (!farInp_24) (!farExp_25) buf_26 ->
33 Symantic.Parser.Machine.Generate.returnST GHC.Base.$
34 Symantic.Parser.Machine.Generate.ResultError
35 Symantic.Parser.Machine.Generate.ParsingError
36 { Symantic.Parser.Machine.Generate.parsingErrorOffset = Symantic.Parser.Machine.Input.position farInp_24,
37 Symantic.Parser.Machine.Generate.parsingErrorException = exn_22,
38 Symantic.Parser.Machine.Generate.parsingErrorUnexpected =
39 if readMore_3 buf_26 farInp_24
40 then
41 GHC.Maybe.Just
42 ( let (#
43 c_27,
44 _
45 #) = readNext_4 buf_26 farInp_24
46 in c_27
47 )
48 else GHC.Maybe.Nothing,
49 Symantic.Parser.Machine.Generate.parsingErrorExpecting =
50 let ( minHoriz_28,
51 res_29
52 ) =
53 Data.Set.Internal.foldr
54 ( \f_30
55 ( minH_31,
56 acc_32
57 ) -> case Symantic.Parser.Grammar.Combinators.unSomeFailure f_30 of
58 GHC.Maybe.Just (Symantic.Parser.Grammar.Combinators.FailureHorizon h_33 :: Symantic.Parser.Grammar.Combinators.Failure (Symantic.Parser.Grammar.Combinators.CombSatisfiable (Symantic.Parser.Machine.Input.InputToken inp_6989586621679402203)))
59 | GHC.Maybe.Just old_34 <- minH_31 ->
60 ( GHC.Maybe.Just (GHC.Classes.min old_34 h_33),
61 acc_32
62 )
63 | GHC.Base.otherwise ->
64 ( GHC.Maybe.Just h_33,
65 acc_32
66 )
67 _ ->
68 ( minH_31,
69 f_30 GHC.Types.: acc_32
70 )
71 )
72 ( GHC.Maybe.Nothing,
73 GHC.Types . []
74 )
75 farExp_25
76 in Data.Set.Internal.fromList GHC.Base.$
77 ( case minHoriz_28 of
78 GHC.Maybe.Just h_35 -> Symantic.Parser.Grammar.Combinators.SomeFailure (Symantic.Parser.Grammar.Combinators.FailureHorizon @(Symantic.Parser.Machine.Input.InputToken inp_6989586621679402203) h_35) GHC.Types.: res_29
79 GHC.Maybe.Nothing -> res_29
80 )
81 }
82 in let inputToken = Data.Proxy.Proxy :: Data.Proxy.Proxy (Symantic.Parser.Machine.Input.InputToken inp_6989586621679402203)
83 in let _ = "checkHorizon.noCheck"
84 in let
85 in let _ = "pushValue"
86 in let _ = "pushValue"
87 in do
88 let dupv_36 = \x_37 -> x_37
89 reg_38 <- GHC.STRef.newSTRef dupv_36
90 let _ = "iter"
91 in let onException_39 loopInput_40 =
92 let _ = "onException"
93 in \(!_exn_41) (!failInp_42) (!farInp_43) (!farExp_44) buf_45 ->
94 let _ = "comment: raiseAgainIfConsumed"
95 in let _ = "saveInput checkedHorizon=0"
96 in let _ = "lift2Value checkedHorizon=0"
97 in if (GHC.Classes.==) @GHC.Types.Int loopInput_40 failInp_42
98 then
99 let _ = "choicesBranch checkedHorizon=0"
100 in do
101 sr_46 <- GHC.STRef.readSTRef reg_38
102 let _ = "pushValue"
103 in let _ = "lift2Value checkedHorizon=0"
104 in let _ = "lift2Value checkedHorizon=0"
105 in let join_47 = \farInp_48 farExp_49 v_50 (!inp_51) ->
106 let _ = "lift2Value checkedHorizon=0"
107 in let _ = "resume"
108 in finalRet_15
109 farInp_48
110 farExp_49
111 ( let _ = "resume.genCode"
112 in GHC.Show.show (sr_46 GHC.Types . [])
113 )
114 inp_51
115 in let _ = "catch ExceptionFailure checkedHorizon=0"
116 in let onException_52 =
117 let _ = "onException"
118 in \(!_exn_53) (!failInp_54) (!farInp_55) (!farExp_56) buf_57 ->
119 let _ = "comment: raiseAgainIfConsumed"
120 in let _ = "saveInput checkedHorizon=0"
121 in let _ = "lift2Value checkedHorizon=0"
122 in if (GHC.Classes.==) @GHC.Types.Int failInp_42 failInp_54
123 then
124 let _ = "choicesBranch checkedHorizon=0"
125 in let _ = "comment: eof.fail"
126 in let failExp_58 = Data.Set.Internal.Bin 1 (Symantic.Parser.Grammar.Combinators.SomeFailure Symantic.Parser.Grammar.Combinators.FailureEnd) Data.Set.Internal.Tip Data.Set.Internal.Tip
127 in let (#
128 farInp_59,
129 farExp_60
130 #) = case GHC.Classes.compare @GHC.Types.Int farInp_55 failInp_54 of
131 GHC.Types.LT ->
132 (#
133 failInp_54,
134 failExp_58
135 #)
136 GHC.Types.EQ ->
137 (#
138 farInp_55,
139 failExp_58 GHC.Base.<> farExp_56
140 #)
141 GHC.Types.GT ->
142 (#
143 farInp_55,
144 farExp_56
145 #)
146 in finalRaise_20 Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp_54 farInp_59 farExp_60 buf_57
147 else
148 let _ = "choicesBranch.else"
149 in finalRaise_20 Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp_54 farInp_55 farExp_56 buf_57
150 in let _ = "comment: negLook"
151 in let _ = "catch ExceptionFailure checkedHorizon=0"
152 in let onException_61 =
153 let _ = "onException"
154 in \(!_exn_62) (!failInp_63) (!farInp_64) (!farExp_65) buf_66 ->
155 let _ = "comment: negLook.reset"
156 in let _ = "loadInput checkedHorizon=0"
157 in let _ = "checkHorizon.noCheck"
158 in let _ = "pushValue"
159 in let _ = "commit"
160 in let _ = "resume"
161 in join_47
162 farInp_64
163 farExp_65
164 ( let _ = "resume.genCode"
165 in GHC.Tuple . ()
166 )
167 failInp_42
168 in let _ = "comment: negLook.ahead"
169 in let _ = "saveInput checkedHorizon=0"
170 in let _ = "comment: satisfy ((\\x_0 -> \\x_1 -> x_0) GHC.Types.True)"
171 in let partialCont_67 buf_68 =
172 let readFail_69 = onException_61
173 in let _ = "checkHorizon.newCheck: checkedHorizon=0 minHoriz=1"
174 in if readMore_3 buf_68 failInp_42
175 then
176 let _ = "checkToken"
177 in let !(#
178 c_70,
179 cs_71
180 #) = readNext_4 buf_68 failInp_42
181 in let _ = "popValue"
182 in let _ = "commit"
183 in let _ = "loadInput checkedHorizon=0"
184 in let _ = "checkHorizon.noCheck"
185 in onException_52 Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp_42 farInp_43 farExp_44 buf_68
186 else
187 let _ = "checkHorizon.newCheck.fail"
188 in Symantic.Parser.Machine.Generate.returnST GHC.Base.$
189 ( Symantic.Parser.Machine.Generate.ResultPartial GHC.Base.$
190 ( \newInput_72 ->
191 if Symantic.Parser.Machine.Input.nullInput newInput_72
192 then
193 let failExp_73 =
194 Data.Set.Internal.Bin
195 1
196 ( Symantic.Parser.Grammar.Combinators.SomeFailure
197 ( case inputToken of
198 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok'_6989586621679082037) -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok'_6989586621679082037 1
199 )
200 )
201 Data.Set.Internal.Tip
202 Data.Set.Internal.Tip
203 in let (#
204 farInp_74,
205 farExp_75
206 #) = case GHC.Classes.compare @GHC.Types.Int farInp_43 failInp_42 of
207 GHC.Types.LT ->
208 (#
209 failInp_42,
210 failExp_73
211 #)
212 GHC.Types.EQ ->
213 (#
214 farInp_43,
215 failExp_73 GHC.Base.<> farExp_44
216 #)
217 GHC.Types.GT ->
218 (#
219 farInp_43,
220 farExp_44
221 #)
222 in readFail_69 Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp_42 farInp_74 farExp_75 buf_68
223 else partialCont_67 (append_5 buf_68 newInput_72)
224 )
225 )
226 in partialCont_67 buf_45
227 else
228 let _ = "choicesBranch.else"
229 in finalRaise_20 Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp_42 farInp_43 farExp_44 buf_45
230 loop_76 = \_callerOnReturn_77 callerInput_78 callerOnExceptionStackByLabel_79 ->
231 let _ = "pushValue"
232 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))))"
233 in let partialCont_80 buf_81 =
234 let readFail_82 = onException_39 callerInput_78
235 in let _ = "checkHorizon.newCheck: checkedHorizon=0 minHoriz=1"
236 in if readMore_3 buf_81 callerInput_78
237 then
238 let _ = "checkToken"
239 in let !(#
240 c_83,
241 cs_84
242 #) = readNext_4 buf_81 callerInput_78
243 in if (\t_85 -> ('a' GHC.Classes.== t_85) GHC.Classes.|| (('b' GHC.Classes.== t_85) GHC.Classes.|| (('c' GHC.Classes.== t_85) GHC.Classes.|| (('d' GHC.Classes.== t_85) GHC.Classes.|| GHC.Types.False)))) c_83
244 then
245 let _ = "lift2Value checkedHorizon=1"
246 in let _ = "pushValue"
247 in let _ = "lift2Value checkedHorizon=1"
248 in do
249 sr_86 <- GHC.STRef.readSTRef reg_38
250 let _ = "lift2Value checkedHorizon=1"
251 in do
252 let dupv_87 = \x_88 -> sr_86 ((GHC.Types.:) c_83 x_88)
253 GHC.STRef.writeSTRef reg_38 dupv_87
254 let _ = "jump"
255 in loop_76 (GHC.Err.error "invalid onReturn") cs_84 (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure readFail_82 Data.Map.Internal.Tip Data.Map.Internal.Tip)
256 else
257 let _ = "checkToken.fail"
258 in let failExp_89 =
259 Data.Set.Internal.Bin
260 4
261 ( Symantic.Parser.Grammar.Combinators.SomeFailure
262 ( case inputToken of
263 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok'_6989586621679082037) -> Symantic.Parser.Grammar.Combinators.FailureToken 'b'
264 )
265 )
266 ( Data.Set.Internal.Bin
267 1
268 ( Symantic.Parser.Grammar.Combinators.SomeFailure
269 ( case inputToken of
270 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok'_6989586621679082037) -> Symantic.Parser.Grammar.Combinators.FailureToken 'a'
271 )
272 )
273 Data.Set.Internal.Tip
274 Data.Set.Internal.Tip
275 )
276 ( Data.Set.Internal.Bin
277 2
278 ( Symantic.Parser.Grammar.Combinators.SomeFailure
279 ( case inputToken of
280 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok'_6989586621679082037) -> Symantic.Parser.Grammar.Combinators.FailureToken 'c'
281 )
282 )
283 Data.Set.Internal.Tip
284 ( Data.Set.Internal.Bin
285 1
286 ( Symantic.Parser.Grammar.Combinators.SomeFailure
287 ( case inputToken of
288 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok'_6989586621679082037) -> Symantic.Parser.Grammar.Combinators.FailureToken 'd'
289 )
290 )
291 Data.Set.Internal.Tip
292 Data.Set.Internal.Tip
293 )
294 )
295 in let (#
296 farInp_90,
297 farExp_91
298 #) = case GHC.Classes.compare @GHC.Types.Int initPos_2 callerInput_78 of
299 GHC.Types.LT ->
300 (#
301 callerInput_78,
302 failExp_89
303 #)
304 GHC.Types.EQ ->
305 (#
306 initPos_2,
307 failExp_89 GHC.Base.<> Data.Set.Internal.empty
308 #)
309 GHC.Types.GT ->
310 (#
311 initPos_2,
312 Data.Set.Internal.empty
313 #)
314 in readFail_82 Symantic.Parser.Grammar.Combinators.ExceptionFailure callerInput_78 farInp_90 farExp_91 buf_81
315 else
316 let _ = "checkHorizon.newCheck.fail"
317 in Symantic.Parser.Machine.Generate.returnST GHC.Base.$
318 ( Symantic.Parser.Machine.Generate.ResultPartial GHC.Base.$
319 ( \newInput_92 ->
320 if Symantic.Parser.Machine.Input.nullInput newInput_92
321 then
322 let failExp_93 =
323 Data.Set.Internal.Bin
324 1
325 ( Symantic.Parser.Grammar.Combinators.SomeFailure
326 ( case inputToken of
327 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok'_6989586621679082037) -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok'_6989586621679082037 1
328 )
329 )
330 Data.Set.Internal.Tip
331 Data.Set.Internal.Tip
332 in let (#
333 farInp_94,
334 farExp_95
335 #) = case GHC.Classes.compare @GHC.Types.Int initPos_2 callerInput_78 of
336 GHC.Types.LT ->
337 (#
338 callerInput_78,
339 failExp_93
340 #)
341 GHC.Types.EQ ->
342 (#
343 initPos_2,
344 failExp_93 GHC.Base.<> Data.Set.Internal.empty
345 #)
346 GHC.Types.GT ->
347 (#
348 initPos_2,
349 Data.Set.Internal.empty
350 #)
351 in readFail_82 Symantic.Parser.Grammar.Combinators.ExceptionFailure callerInput_78 farInp_94 farExp_95 buf_81
352 else partialCont_80 (append_5 buf_81 newInput_92)
353 )
354 )
355 in partialCont_80 initBuffer_1
356 in let _ = "jump"
357 in loop_76 finalRet_15 initPos_2 Data.Map.Internal.Tip