]> Git — Sourcephile - haskell/symantic-parser.git/blob - tests/Golden/Splice/G20.expected.txt
!fixup impl: move `liftTypedString` to `Language.Haskell.TH.Show`
[haskell/symantic-parser.git] / tests / Golden / Splice / G20.expected.txt
1 \(input :: inp) ->
2 let !(#
3 initBuffer,
4 initPos,
5 readMore,
6 readNext,
7 append
8 #) =
9 let next buf pos =
10 let !( Data.Text.Unsafe.Iter
11 c
12 d
13 ) = Symantic.Parser.Machine.Input.Text.Buffer.iter buf pos
14 in (# c, pos GHC.Num.+ d #)
15 more buf pos = pos GHC.Classes.< Symantic.Parser.Machine.Input.Text.Buffer.length buf
16 append = Symantic.Parser.Machine.Input.Text.Buffer.pappend
17 in (#
18 Symantic.Parser.Machine.Input.Text.Buffer.buffer input,
19 0,
20 more,
21 next,
22 append
23 #)
24 finalRet = \_farInp _farExp v _inp _buf _end -> Symantic.Parser.Machine.Generate.returnST GHC.Base.$ Symantic.Parser.Machine.Generate.ResultDone v
25 finalRaise :: Symantic.Parser.Machine.Generate.ForallOnException inp =
26 Symantic.Parser.Machine.Generate.ForallOnException GHC.Base.$
27 ( \(!exn) _failInp (!farInp) (!farExp) buf end ->
28 Symantic.Parser.Machine.Generate.returnST GHC.Base.$
29 Symantic.Parser.Machine.Generate.ResultError
30 Symantic.Parser.Machine.Generate.ParsingError
31 { Symantic.Parser.Machine.Generate.parsingErrorOffset = Symantic.Parser.Machine.Input.position farInp,
32 Symantic.Parser.Machine.Generate.parsingErrorException = exn,
33 Symantic.Parser.Machine.Generate.parsingErrorUnexpected =
34 if readMore buf farInp
35 then
36 GHC.Maybe.Just
37 ( let (#
38 c,
39 _
40 #) = readNext buf farInp
41 in c
42 )
43 else GHC.Maybe.Nothing,
44 Symantic.Parser.Machine.Generate.parsingErrorExpecting =
45 let ( minHoriz,
46 res
47 ) =
48 Data.Set.Internal.foldr
49 ( \f
50 ( minH,
51 acc
52 ) -> case Symantic.Parser.Grammar.Combinators.unSomeFailure f of
53 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)))
54 | GHC.Maybe.Just old <- minH ->
55 ( GHC.Maybe.Just (GHC.Classes.min old h),
56 acc
57 )
58 | GHC.Base.otherwise ->
59 ( GHC.Maybe.Just h,
60 acc
61 )
62 _ ->
63 ( minH,
64 f GHC.Types.: acc
65 )
66 )
67 ( GHC.Maybe.Nothing,
68 GHC.Types . []
69 )
70 farExp
71 in Data.Set.Internal.fromList GHC.Base.$
72 ( case minHoriz of
73 GHC.Maybe.Just h -> Symantic.Parser.Grammar.Combinators.SomeFailure (Symantic.Parser.Grammar.Combinators.FailureHorizon @(Symantic.Parser.Machine.Input.InputToken inp) h) GHC.Types.: res
74 GHC.Maybe.Nothing -> res
75 )
76 }
77 )
78 in let inputToken = Data.Proxy.Proxy :: Data.Proxy.Proxy (Symantic.Parser.Machine.Input.InputToken inp)
79 in let partialCont buf =
80 let readFail = Symantic.Parser.Machine.Generate.unForallOnException finalRaise
81 in let _ = "checkHorizon.newCheck: checkedHorizon=0 minHoriz=3"
82 in if readMore buf ((GHC.Num.+) @GHC.Types.Int 2 initPos)
83 then
84 let
85 in let _ = "pushValue"
86 in let join = \farInp farExp v (!inp) buf end ->
87 let _ = "lift2Value checkedHorizon=0"
88 in let _ = "catch ExceptionFailure checkedHorizon=0"
89 in let onException =
90 let _ = "onException"
91 in \(!_exn) (!failInp) (!farInp) (!farExp) buf end ->
92 let _ = "loadInput checkedHorizon=0"
93 in let _ = "checkHorizon.noCheck"
94 in Symantic.Parser.Machine.Generate.unForallOnException finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp buf end
95 in let _ = "pushValue"
96 in let _ = "comment: satisfy ((GHC.Classes.==) 'd')"
97 in let partialCont buf =
98 let readFail = onException
99 in let _ = "checkHorizon.newCheck: checkedHorizon=0 minHoriz=3"
100 in if readMore buf ((GHC.Num.+) @GHC.Types.Int 2 inp)
101 then
102 let _ = "checkToken"
103 in let !(#
104 c,
105 cs
106 #) = readNext buf inp
107 in if (GHC.Classes.==) 'd' c
108 then
109 let _ = "lift2Value checkedHorizon=3"
110 in let _ = "comment: satisfy ((GHC.Classes.==) 'e')"
111 in let _ = "checkHorizon.oldCheck: checkedHorizon=3"
112 in let _ = "checkToken"
113 in let !(#
114 c,
115 cs
116 #) = readNext buf cs
117 in if (GHC.Classes.==) 'e' c
118 then
119 let _ = "lift2Value checkedHorizon=2"
120 in let _ = "comment: satisfy ((GHC.Classes.==) 'f')"
121 in let _ = "checkHorizon.oldCheck: checkedHorizon=2"
122 in let _ = "checkToken"
123 in let !(#
124 c,
125 cs
126 #) = readNext buf cs
127 in if (GHC.Classes.==) 'f' c
128 then
129 let _ = "lift2Value checkedHorizon=1"
130 in let _ = "commit"
131 in let _ = "lift2Value checkedHorizon=1"
132 in let _ = "resume"
133 in finalRet
134 farInp
135 farExp
136 ( let _ = "resume.genCode"
137 in GHC.Show.show GHC.Tuple . ()
138 )
139 cs
140 buf
141 end
142 else
143 let _ = "checkToken.fail"
144 in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure cs farInp farExp buf end
145 else
146 let _ = "checkToken.fail"
147 in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure cs farInp farExp buf end
148 else
149 let _ = "checkToken.fail"
150 in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp buf end
151 else
152 let _ = "checkHorizon.newCheck.fail"
153 in let noMoreInput =
154 let failExp =
155 Data.Set.Internal.Bin
156 1
157 ( Symantic.Parser.Grammar.Combinators.SomeFailure
158 ( case inputToken of
159 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 3
160 )
161 )
162 Data.Set.Internal.Tip
163 Data.Set.Internal.Tip
164 in let (#
165 farInp,
166 farExp
167 #) = case GHC.Classes.compare @GHC.Types.Int farInp inp of
168 GHC.Types.LT ->
169 (#
170 inp,
171 failExp
172 #)
173 GHC.Types.EQ ->
174 (#
175 farInp,
176 failExp GHC.Base.<> farExp
177 #)
178 GHC.Types.GT ->
179 (#
180 farInp,
181 farExp
182 #)
183 in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp buf GHC.Types.True
184 in if end
185 then noMoreInput
186 else
187 Symantic.Parser.Machine.Generate.returnST GHC.Base.$
188 ( Symantic.Parser.Machine.Generate.ResultPartial GHC.Base.$
189 ( \newInput ->
190 if Symantic.Parser.Machine.Input.nullInput newInput
191 then noMoreInput
192 else partialCont (append buf newInput)
193 )
194 )
195 in partialCont buf
196 in let _ = "catch ExceptionFailure checkedHorizon=3"
197 in let onException =
198 let _ = "onException"
199 in \(!_exn) (!failInp) (!farInp) (!farExp) buf end ->
200 let _ = "comment: raiseAgainIfConsumed"
201 in let _ = "saveInput checkedHorizon=0"
202 in let _ = "lift2Value checkedHorizon=0"
203 in if (GHC.Classes.==) @GHC.Types.Int initPos failInp
204 then
205 let _ = "choicesBranch checkedHorizon=0"
206 in let _ = "catch ExceptionFailure checkedHorizon=0"
207 in let onException =
208 let _ = "onException"
209 in \(!_exn) (!failInp) (!farInp) (!farExp) buf end ->
210 let _ = "loadInput checkedHorizon=0"
211 in let _ = "checkHorizon.noCheck"
212 in Symantic.Parser.Machine.Generate.unForallOnException finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp buf end
213 in let _ = "pushValue"
214 in let _ = "commit"
215 in let _ = "resume"
216 in join
217 farInp
218 farExp
219 ( let _ = "resume.genCode"
220 in GHC.Types . []
221 )
222 failInp
223 buf
224 end
225 else
226 let _ = "choicesBranch.else"
227 in Symantic.Parser.Machine.Generate.unForallOnException finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp buf end
228 in let _ = "catch ExceptionFailure checkedHorizon=3"
229 in let onException =
230 let _ = "onException"
231 in \(!_exn) (!failInp) (!farInp) (!farExp) buf end ->
232 let _ = "loadInput checkedHorizon=3"
233 in let _ = "checkHorizon.oldCheck: checkedHorizon=3"
234 in onException Symantic.Parser.Grammar.Combinators.ExceptionFailure initPos farInp farExp buf end
235 in let _ = "pushValue"
236 in let _ = "comment: satisfy ((GHC.Classes.==) 'a')"
237 in let _ = "checkHorizon.oldCheck: checkedHorizon=3"
238 in let _ = "checkToken"
239 in let !(#
240 c,
241 cs
242 #) = readNext buf initPos
243 in if (GHC.Classes.==) 'a' c
244 then
245 let _ = "lift2Value checkedHorizon=2"
246 in let _ = "comment: satisfy ((GHC.Classes.==) 'b')"
247 in let _ = "checkHorizon.oldCheck: checkedHorizon=2"
248 in let _ = "checkToken"
249 in let !(#
250 c,
251 cs
252 #) = readNext buf cs
253 in if (GHC.Classes.==) 'b' c
254 then
255 let _ = "lift2Value checkedHorizon=1"
256 in let _ = "comment: satisfy ((GHC.Classes.==) 'c')"
257 in let _ = "checkHorizon.oldCheck: checkedHorizon=1"
258 in let _ = "checkToken"
259 in let !(#
260 c,
261 cs
262 #) = readNext buf cs
263 in if (GHC.Classes.==) 'c' c
264 then
265 let _ = "lift2Value checkedHorizon=0"
266 in let _ = "commit"
267 in let _ = "commit"
268 in let _ = "resume"
269 in join
270 initPos
271 Data.Set.Internal.empty
272 ( let _ = "resume.genCode"
273 in (GHC.Types.:) 'a' ((GHC.Types.:) 'b' ((GHC.Types.:) 'c' GHC.Types . []))
274 )
275 cs
276 buf
277 GHC.Types.False
278 else
279 let _ = "checkToken.fail"
280 in onException Symantic.Parser.Grammar.Combinators.ExceptionFailure cs initPos Data.Set.Internal.empty buf GHC.Types.False
281 else
282 let _ = "checkToken.fail"
283 in onException Symantic.Parser.Grammar.Combinators.ExceptionFailure cs initPos Data.Set.Internal.empty buf GHC.Types.False
284 else
285 let _ = "checkToken.fail"
286 in onException Symantic.Parser.Grammar.Combinators.ExceptionFailure initPos initPos Data.Set.Internal.empty buf GHC.Types.False
287 else
288 let _ = "checkHorizon.newCheck.fail"
289 in let noMoreInput =
290 let failExp =
291 Data.Set.Internal.Bin
292 1
293 ( Symantic.Parser.Grammar.Combinators.SomeFailure
294 ( case inputToken of
295 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 3
296 )
297 )
298 Data.Set.Internal.Tip
299 Data.Set.Internal.Tip
300 in let (#
301 farInp,
302 farExp
303 #) = case GHC.Classes.compare @GHC.Types.Int initPos initPos of
304 GHC.Types.LT ->
305 (#
306 initPos,
307 failExp
308 #)
309 GHC.Types.EQ ->
310 (#
311 initPos,
312 failExp GHC.Base.<> Data.Set.Internal.empty
313 #)
314 GHC.Types.GT ->
315 (#
316 initPos,
317 Data.Set.Internal.empty
318 #)
319 in Symantic.Parser.Machine.Generate.unForallOnException finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure initPos farInp farExp buf GHC.Types.True
320 in if GHC.Types.False
321 then noMoreInput
322 else
323 Symantic.Parser.Machine.Generate.returnST GHC.Base.$
324 ( Symantic.Parser.Machine.Generate.ResultPartial GHC.Base.$
325 ( \newInput ->
326 if Symantic.Parser.Machine.Input.nullInput newInput
327 then noMoreInput
328 else partialCont (append buf newInput)
329 )
330 )
331 in partialCont initBuffer