]> Git — Sourcephile - haskell/symantic-parser.git/blob - tests/Golden/Splice/G8.expected.txt
iface: update release `version`
[haskell/symantic-parser.git] / tests / Golden / Splice / G8.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 ((GHC.Classes.==) 'r')"
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 (GHC.Classes.==) 'r' 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.:) 'r' 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 1
281 ( Symantic.Parser.Grammar.Combinators.SomeFailure
282 ( case inputToken of
283 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'r'
284 )
285 )
286 Data.Set.Internal.Tip
287 Data.Set.Internal.Tip
288 in let (#
289 farInp,
290 farExp
291 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of
292 GHC.Types.LT ->
293 (#
294 inp,
295 failExp
296 #)
297 GHC.Types.EQ ->
298 (#
299 init,
300 failExp GHC.Base.<> Data.Set.Internal.empty
301 #)
302 GHC.Types.GT ->
303 (#
304 init,
305 Data.Set.Internal.empty
306 #)
307 in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp
308 else
309 let _ = "checkHorizon.newCheck.fail"
310 in let failExp =
311 Data.Set.Internal.Bin
312 1
313 ( Symantic.Parser.Grammar.Combinators.SomeFailure
314 ( case inputToken of
315 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 1
316 )
317 )
318 Data.Set.Internal.Tip
319 Data.Set.Internal.Tip
320 in let (#
321 farInp,
322 farExp
323 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of
324 GHC.Types.LT ->
325 (#
326 inp,
327 failExp
328 #)
329 GHC.Types.EQ ->
330 (#
331 init,
332 failExp GHC.Base.<> Data.Set.Internal.empty
333 #)
334 GHC.Types.GT ->
335 (#
336 init,
337 Data.Set.Internal.empty
338 #)
339 in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp
340 in let _ = "jump"
341 in loop finalRet init Data.Map.Internal.Tip
342 )