]> Git — Sourcephile - haskell/symantic-parser.git/blob - tests/Golden/Splice/G10.expected.txt
!fixup impl: move `liftTypedString` to `Language.Haskell.TH.Show`
[haskell/symantic-parser.git] / tests / Golden / Splice / G10.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=1"
82 in if readMore buf 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 _ = "resume"
89 in finalRet
90 farInp
91 farExp
92 ( let _ = "resume.genCode"
93 in GHC.Show.show v
94 )
95 inp
96 buf
97 end
98 in let _ = "catch ExceptionFailure checkedHorizon=1"
99 in let onException =
100 let _ = "onException"
101 in \(!_exn) (!failInp) (!farInp) (!farExp) buf end ->
102 let _ = "comment: raiseAgainIfConsumed"
103 in let _ = "saveInput checkedHorizon=0"
104 in let _ = "lift2Value checkedHorizon=0"
105 in if (GHC.Classes.==) @GHC.Types.Int initPos failInp
106 then
107 let _ = "choicesBranch checkedHorizon=0"
108 in let _ = "pushValue"
109 in let _ = "comment: satisfy ((GHC.Classes.==) 'b')"
110 in let partialCont buf =
111 let readFail = Symantic.Parser.Machine.Generate.unForallOnException finalRaise
112 in let _ = "checkHorizon.newCheck: checkedHorizon=0 minHoriz=1"
113 in if readMore buf failInp
114 then
115 let _ = "checkToken"
116 in let !(#
117 c,
118 cs
119 #) = readNext buf failInp
120 in if (GHC.Classes.==) 'b' c
121 then
122 let _ = "lift2Value checkedHorizon=1"
123 in let _ = "resume"
124 in join
125 farInp
126 farExp
127 ( let _ = "resume.genCode"
128 in 'b'
129 )
130 cs
131 buf
132 end
133 else
134 let _ = "checkToken.fail"
135 in let failExp =
136 Data.Set.Internal.Bin
137 1
138 ( Symantic.Parser.Grammar.Combinators.SomeFailure
139 ( case inputToken of
140 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'b'
141 )
142 )
143 Data.Set.Internal.Tip
144 Data.Set.Internal.Tip
145 in let (#
146 farInp,
147 farExp
148 #) = case GHC.Classes.compare @GHC.Types.Int farInp failInp of
149 GHC.Types.LT ->
150 (#
151 failInp,
152 failExp
153 #)
154 GHC.Types.EQ ->
155 (#
156 farInp,
157 failExp GHC.Base.<> farExp
158 #)
159 GHC.Types.GT ->
160 (#
161 farInp,
162 farExp
163 #)
164 in Symantic.Parser.Machine.Generate.unForallOnException finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp buf end
165 else
166 let _ = "checkHorizon.newCheck.fail"
167 in let noMoreInput =
168 let failExp =
169 Data.Set.Internal.Bin
170 1
171 ( Symantic.Parser.Grammar.Combinators.SomeFailure
172 ( case inputToken of
173 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 1
174 )
175 )
176 Data.Set.Internal.Tip
177 Data.Set.Internal.Tip
178 in let (#
179 farInp,
180 farExp
181 #) = case GHC.Classes.compare @GHC.Types.Int farInp failInp of
182 GHC.Types.LT ->
183 (#
184 failInp,
185 failExp
186 #)
187 GHC.Types.EQ ->
188 (#
189 farInp,
190 failExp GHC.Base.<> farExp
191 #)
192 GHC.Types.GT ->
193 (#
194 farInp,
195 farExp
196 #)
197 in Symantic.Parser.Machine.Generate.unForallOnException finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp buf GHC.Types.True
198 in if end
199 then noMoreInput
200 else
201 Symantic.Parser.Machine.Generate.returnST GHC.Base.$
202 ( Symantic.Parser.Machine.Generate.ResultPartial GHC.Base.$
203 ( \newInput ->
204 if Symantic.Parser.Machine.Input.nullInput newInput
205 then noMoreInput
206 else partialCont (append buf newInput)
207 )
208 )
209 in partialCont buf
210 else
211 let _ = "choicesBranch.else"
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 _ = "comment: satisfy ((GHC.Classes.==) 'a')"
215 in let _ = "checkHorizon.oldCheck: checkedHorizon=1"
216 in let _ = "checkToken"
217 in let !(#
218 c,
219 cs
220 #) = readNext buf initPos
221 in if (GHC.Classes.==) 'a' c
222 then
223 let _ = "lift2Value checkedHorizon=0"
224 in let _ = "commit"
225 in let _ = "resume"
226 in join
227 initPos
228 Data.Set.Internal.empty
229 ( let _ = "resume.genCode"
230 in 'a'
231 )
232 cs
233 buf
234 GHC.Types.False
235 else
236 let _ = "checkToken.fail"
237 in let failExp =
238 Data.Set.Internal.Bin
239 1
240 ( Symantic.Parser.Grammar.Combinators.SomeFailure
241 ( case inputToken of
242 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'a'
243 )
244 )
245 Data.Set.Internal.Tip
246 Data.Set.Internal.Tip
247 in let (#
248 farInp,
249 farExp
250 #) = case GHC.Classes.compare @GHC.Types.Int initPos initPos of
251 GHC.Types.LT ->
252 (#
253 initPos,
254 failExp
255 #)
256 GHC.Types.EQ ->
257 (#
258 initPos,
259 failExp GHC.Base.<> Data.Set.Internal.empty
260 #)
261 GHC.Types.GT ->
262 (#
263 initPos,
264 Data.Set.Internal.empty
265 #)
266 in onException Symantic.Parser.Grammar.Combinators.ExceptionFailure initPos farInp farExp buf GHC.Types.False
267 else
268 let _ = "checkHorizon.newCheck.fail"
269 in let noMoreInput =
270 let failExp =
271 Data.Set.Internal.Bin
272 1
273 ( Symantic.Parser.Grammar.Combinators.SomeFailure
274 ( case inputToken of
275 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 1
276 )
277 )
278 Data.Set.Internal.Tip
279 Data.Set.Internal.Tip
280 in let (#
281 farInp,
282 farExp
283 #) = case GHC.Classes.compare @GHC.Types.Int initPos initPos of
284 GHC.Types.LT ->
285 (#
286 initPos,
287 failExp
288 #)
289 GHC.Types.EQ ->
290 (#
291 initPos,
292 failExp GHC.Base.<> Data.Set.Internal.empty
293 #)
294 GHC.Types.GT ->
295 (#
296 initPos,
297 Data.Set.Internal.empty
298 #)
299 in Symantic.Parser.Machine.Generate.unForallOnException finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure initPos farInp farExp buf GHC.Types.True
300 in if GHC.Types.False
301 then noMoreInput
302 else
303 Symantic.Parser.Machine.Generate.returnST GHC.Base.$
304 ( Symantic.Parser.Machine.Generate.ResultPartial GHC.Base.$
305 ( \newInput ->
306 if Symantic.Parser.Machine.Input.nullInput newInput
307 then noMoreInput
308 else partialCont (append buf newInput)
309 )
310 )
311 in partialCont initBuffer