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