]> Git — Sourcephile - haskell/symantic-parser.git/blob - test/Golden/Splice/G15.expected.txt
replace ValueCode by Production
[haskell/symantic-parser.git] / test / Golden / Splice / G15.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 -> Data.Either.Right v
31 finalRaise ::
32 forall b.
33 Symantic.Parser.Machine.Generate.Catcher
34 inp
35 b = \(!exn) _failInp (!farInp) (!farExp) ->
36 Data.Either.Left
37 Symantic.Parser.Machine.Generate.ParsingErrorStandard
38 { Symantic.Parser.Machine.Generate.parsingErrorOffset = Symantic.Parser.Machine.Input.offset farInp,
39 Symantic.Parser.Machine.Generate.parsingErrorException = exn,
40 Symantic.Parser.Machine.Generate.parsingErrorUnexpected =
41 if readMore farInp
42 then
43 GHC.Maybe.Just
44 ( let (#
45 c,
46 _
47 #) = readNext farInp
48 in c
49 )
50 else GHC.Maybe.Nothing,
51 Symantic.Parser.Machine.Generate.parsingErrorExpecting = farExp
52 }
53 in let inputToken = Data.Proxy.Proxy :: Data.Proxy.Proxy (Symantic.Parser.Machine.Input.InputToken inp)
54 in let
55 in let join = \farInp farExp v (!inp) ->
56 let readFail = finalRaise
57 in if readMore inp
58 then
59 let !(#
60 c,
61 cs
62 #) = readNext inp
63 in if ('c' GHC.Classes.==) c
64 then
65 let _ = "resume"
66 in finalRet
67 farInp
68 farExp
69 ( let _ = "resume.genCode"
70 in GHC.Show.show v
71 )
72 cs
73 else
74 let _ = "checkToken.else"
75 in let failExp =
76 Data.Set.Internal.Bin
77 1
78 ( Symantic.Parser.Grammar.Combinators.SomeFailure
79 ( case inputToken of
80 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'c'
81 )
82 )
83 Data.Set.Internal.Tip
84 Data.Set.Internal.Tip
85 in let (#
86 farInp,
87 farExp
88 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp inp of
89 GHC.Types.LT ->
90 (#
91 inp,
92 failExp
93 #)
94 GHC.Types.EQ ->
95 (#
96 farInp,
97 failExp GHC.Base.<> farExp
98 #)
99 GHC.Types.GT ->
100 (#
101 farInp,
102 farExp
103 #)
104 in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp
105 else
106 let _ = "checkHorizon.else"
107 in let failExp =
108 Data.Set.Internal.Bin
109 1
110 ( Symantic.Parser.Grammar.Combinators.SomeFailure
111 ( case inputToken of
112 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 1
113 )
114 )
115 Data.Set.Internal.Tip
116 Data.Set.Internal.Tip
117 in let (#
118 farInp,
119 farExp
120 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp inp of
121 GHC.Types.LT ->
122 (#
123 inp,
124 failExp
125 #)
126 GHC.Types.EQ ->
127 (#
128 farInp,
129 failExp GHC.Base.<> farExp
130 #)
131 GHC.Types.GT ->
132 (#
133 farInp,
134 farExp
135 #)
136 in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp
137 in let _ = "catch ExceptionFailure"
138 in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =
139 let _ = "catch.ko ExceptionFailure"
140 in if ( \( Data.Text.Internal.Text
141 _
142 i
143 _
144 )
145 ( Data.Text.Internal.Text
146 _
147 j
148 _
149 ) -> i GHC.Classes.== j
150 )
151 init
152 failInp
153 then
154 let _ = "choicesBranch.then"
155 in let readFail = finalRaise
156 in if readMore (Symantic.Parser.Machine.Input.shiftRightText 1 failInp)
157 then
158 let !(#
159 c,
160 cs
161 #) = readNext failInp
162 in if ('b' GHC.Classes.==) c
163 then
164 let _ = "resume"
165 in join
166 farInp
167 farExp
168 ( let _ = "resume.genCode"
169 in 'b'
170 )
171 cs
172 else
173 let _ = "checkToken.else"
174 in let failExp =
175 Data.Set.Internal.Bin
176 1
177 ( Symantic.Parser.Grammar.Combinators.SomeFailure
178 ( case inputToken of
179 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'b'
180 )
181 )
182 Data.Set.Internal.Tip
183 Data.Set.Internal.Tip
184 in let (#
185 farInp,
186 farExp
187 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp failInp of
188 GHC.Types.LT ->
189 (#
190 failInp,
191 failExp
192 #)
193 GHC.Types.EQ ->
194 (#
195 farInp,
196 failExp GHC.Base.<> farExp
197 #)
198 GHC.Types.GT ->
199 (#
200 farInp,
201 farExp
202 #)
203 in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp
204 else
205 let _ = "checkHorizon.else"
206 in let failExp =
207 Data.Set.Internal.Bin
208 1
209 ( Symantic.Parser.Grammar.Combinators.SomeFailure
210 ( case inputToken of
211 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 2
212 )
213 )
214 Data.Set.Internal.Tip
215 Data.Set.Internal.Tip
216 in let (#
217 farInp,
218 farExp
219 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp failInp of
220 GHC.Types.LT ->
221 (#
222 failInp,
223 failExp
224 #)
225 GHC.Types.EQ ->
226 (#
227 farInp,
228 failExp GHC.Base.<> farExp
229 #)
230 GHC.Types.GT ->
231 (#
232 farInp,
233 farExp
234 #)
235 in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp
236 else
237 let _ = "choicesBranch.else"
238 in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp
239 in let readFail = catchHandler
240 in if readMore (Symantic.Parser.Machine.Input.shiftRightText 1 init)
241 then
242 let !(# c, cs #) = readNext init
243 in if ('a' GHC.Classes.==) c
244 then
245 let _ = "resume"
246 in join
247 init
248 Data.Set.Internal.empty
249 ( let _ = "resume.genCode"
250 in 'a'
251 )
252 cs
253 else
254 let _ = "checkToken.else"
255 in let failExp =
256 Data.Set.Internal.Bin
257 1
258 ( Symantic.Parser.Grammar.Combinators.SomeFailure
259 ( case inputToken of
260 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'a'
261 )
262 )
263 Data.Set.Internal.Tip
264 Data.Set.Internal.Tip
265 in let (#
266 farInp,
267 farExp
268 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init init of
269 GHC.Types.LT ->
270 (#
271 init,
272 failExp
273 #)
274 GHC.Types.EQ ->
275 (#
276 init,
277 failExp GHC.Base.<> Data.Set.Internal.empty
278 #)
279 GHC.Types.GT ->
280 (#
281 init,
282 Data.Set.Internal.empty
283 #)
284 in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure init farInp farExp
285 else
286 let _ = "checkHorizon.else"
287 in let failExp =
288 Data.Set.Internal.Bin
289 1
290 ( Symantic.Parser.Grammar.Combinators.SomeFailure
291 ( case inputToken of
292 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 2
293 )
294 )
295 Data.Set.Internal.Tip
296 Data.Set.Internal.Tip
297 in let (#
298 farInp,
299 farExp
300 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init init of
301 GHC.Types.LT ->
302 (#
303 init,
304 failExp
305 #)
306 GHC.Types.EQ ->
307 (#
308 init,
309 failExp GHC.Base.<> Data.Set.Internal.empty
310 #)
311 GHC.Types.GT ->
312 (#
313 init,
314 Data.Set.Internal.empty
315 #)
316 in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure init farInp farExp