]> Git — Sourcephile - haskell/symantic-parser.git/blob - test/Golden/Splice/G12.expected.txt
machine: normalOrderReduction at the last moment
[haskell/symantic-parser.git] / test / Golden / Splice / G12.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
58 in do
59 let dupv = \x -> x
60 reg <- GHC.STRef.newSTRef dupv
61 let _ = "iter"
62 in let catchHandler loopInput (!_exn) (!failInp) (!farInp) (!farExp) =
63 if ( \( Data.Text.Internal.Text
64 _
65 i
66 _
67 )
68 ( Data.Text.Internal.Text
69 _
70 j
71 _
72 ) -> i GHC.Classes.== j
73 )
74 loopInput
75 failInp
76 then
77 let _ = "choicesBranch.then"
78 in do
79 sr <- GHC.STRef.readSTRef reg
80 let join = \farInp farExp v (!inp) ->
81 let _ = "resume"
82 in finalRet
83 farInp
84 farExp
85 ( let _ = "resume.genCode"
86 in GHC.Show.show (sr GHC.Types . [])
87 )
88 inp
89 in let _ = "catch ExceptionFailure"
90 in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =
91 let _ = "catch.ko ExceptionFailure"
92 in if ( \( Data.Text.Internal.Text
93 _
94 i
95 _
96 )
97 ( Data.Text.Internal.Text
98 _
99 j
100 _
101 ) -> i GHC.Classes.== j
102 )
103 failInp
104 failInp
105 then
106 let _ = "choicesBranch.then"
107 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
108 in let (#
109 farInp,
110 farExp
111 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp failInp of
112 GHC.Types.LT ->
113 (#
114 failInp,
115 failExp
116 #)
117 GHC.Types.EQ ->
118 (#
119 farInp,
120 failExp GHC.Base.<> farExp
121 #)
122 GHC.Types.GT ->
123 (#
124 farInp,
125 farExp
126 #)
127 in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp
128 else
129 let _ = "choicesBranch.else"
130 in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp
131 in let _ = "catch ExceptionFailure"
132 in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =
133 let _ = "catch.ko ExceptionFailure"
134 in let _ = "resume"
135 in join
136 farInp
137 farExp
138 ( let _ = "resume.genCode"
139 in GHC.Tuple . ()
140 )
141 failInp
142 in let readFail = catchHandler
143 in if readMore failInp
144 then
145 let !(#
146 c,
147 cs
148 #) = readNext failInp
149 in catchHandler Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp
150 else
151 let _ = "checkHorizon.else"
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.FailureHorizon @tok' 1
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 failInp of
166 GHC.Types.LT ->
167 (#
168 failInp,
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 readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp
182 else
183 let _ = "choicesBranch.else"
184 in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp
185 loop = \_callReturn callInput callCatchStackByLabel ->
186 let readFail = catchHandler callInput
187 in if readMore callInput
188 then
189 let !(#
190 c,
191 cs
192 #) = readNext callInput
193 in if (\t -> ('a' GHC.Classes.== t) GHC.Classes.|| (('b' GHC.Classes.== t) GHC.Classes.|| (('c' GHC.Classes.== t) GHC.Classes.|| (('d' GHC.Classes.== t) GHC.Classes.|| GHC.Types.False)))) c
194 then do
195 sr <- GHC.STRef.readSTRef reg
196 do
197 let dupv = \x -> sr ((GHC.Types.:) c x)
198 GHC.STRef.writeSTRef reg dupv
199 let _ = "jump"
200 in loop (GHC.Err.error "invalid return") cs (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure readFail Data.Map.Internal.Tip Data.Map.Internal.Tip)
201 else
202 let _ = "checkToken.else"
203 in let failExp =
204 Data.Set.Internal.Bin
205 4
206 ( Symantic.Parser.Grammar.Combinators.SomeFailure
207 ( case inputToken of
208 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'b'
209 )
210 )
211 ( Data.Set.Internal.Bin
212 1
213 ( Symantic.Parser.Grammar.Combinators.SomeFailure
214 ( case inputToken of
215 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'a'
216 )
217 )
218 Data.Set.Internal.Tip
219 Data.Set.Internal.Tip
220 )
221 ( Data.Set.Internal.Bin
222 2
223 ( Symantic.Parser.Grammar.Combinators.SomeFailure
224 ( case inputToken of
225 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'c'
226 )
227 )
228 Data.Set.Internal.Tip
229 ( Data.Set.Internal.Bin
230 1
231 ( Symantic.Parser.Grammar.Combinators.SomeFailure
232 ( case inputToken of
233 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'd'
234 )
235 )
236 Data.Set.Internal.Tip
237 Data.Set.Internal.Tip
238 )
239 )
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 else
261 let _ = "checkHorizon.else"
262 in let failExp =
263 Data.Set.Internal.Bin
264 1
265 ( Symantic.Parser.Grammar.Combinators.SomeFailure
266 ( case inputToken of
267 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 1
268 )
269 )
270 Data.Set.Internal.Tip
271 Data.Set.Internal.Tip
272 in let (#
273 farInp,
274 farExp
275 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init callInput of
276 GHC.Types.LT ->
277 (#
278 callInput,
279 failExp
280 #)
281 GHC.Types.EQ ->
282 (#
283 init,
284 failExp GHC.Base.<> Data.Set.Internal.empty
285 #)
286 GHC.Types.GT ->
287 (#
288 init,
289 Data.Set.Internal.empty
290 #)
291 in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure callInput farInp farExp
292 in let _ = "jump"
293 in loop finalRet init Data.Map.Internal.Tip
294 )