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