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