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