]> Git — Sourcephile - haskell/symantic-parser.git/blob - tests/Golden/Splice/G2.expected.txt
wip
[haskell/symantic-parser.git] / tests / Golden / Splice / G2.expected.txt
1 \(input :: inp) ->
2 let !(#
3 initBuffer,
4 initPos,
5 readMore,
6 readNext,
7 append
8 #) =
9 let next buf pos =
10 let !( Data.Text.Unsafe.Iter
11 c
12 d
13 ) = Symantic.Parser.Machine.Input.Text.Buffer.iter buf pos
14 in (# c, pos GHC.Num.+ d #)
15 more buf pos = pos GHC.Classes.< Symantic.Parser.Machine.Input.Text.Buffer.length buf
16 append = Symantic.Parser.Machine.Input.Text.Buffer.pappend
17 in (#
18 Symantic.Parser.Machine.Input.Text.Buffer.buffer input,
19 0,
20 more,
21 next,
22 append
23 #)
24 finalRet = \_farInp _farExp v _inp _buf _end -> Symantic.Parser.Machine.Generate.returnST GHC.Base.$ Symantic.Parser.Machine.Generate.ResultDone v
25 finalRaise :: Symantic.Parser.Machine.Generate.ForallOnException inp =
26 Symantic.Parser.Machine.Generate.ForallOnException GHC.Base.$
27 ( \(!exn) _failInp (!farInp) (!farExp) buf end ->
28 Symantic.Parser.Machine.Generate.returnST GHC.Base.$
29 Symantic.Parser.Machine.Generate.ResultError
30 Symantic.Parser.Machine.Generate.ParsingError
31 { Symantic.Parser.Machine.Generate.parsingErrorOffset = Symantic.Parser.Machine.Input.position farInp,
32 Symantic.Parser.Machine.Generate.parsingErrorException = exn,
33 Symantic.Parser.Machine.Generate.parsingErrorUnexpected =
34 if readMore buf farInp
35 then
36 GHC.Maybe.Just
37 ( let (#
38 c,
39 _
40 #) = readNext buf farInp
41 in c
42 )
43 else GHC.Maybe.Nothing,
44 Symantic.Parser.Machine.Generate.parsingErrorExpecting =
45 let ( minHoriz,
46 res
47 ) =
48 Data.Set.Internal.foldr
49 ( \f
50 ( minH,
51 acc
52 ) -> case Symantic.Parser.Grammar.Combinators.unSomeFailure f of
53 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)))
54 | GHC.Maybe.Just old <- minH ->
55 ( GHC.Maybe.Just (GHC.Classes.min old h),
56 acc
57 )
58 | GHC.Base.otherwise ->
59 ( GHC.Maybe.Just h,
60 acc
61 )
62 _ ->
63 ( minH,
64 f GHC.Types.: acc
65 )
66 )
67 ( GHC.Maybe.Nothing,
68 GHC.Types . []
69 )
70 farExp
71 in Data.Set.Internal.fromList GHC.Base.$
72 ( case minHoriz of
73 GHC.Maybe.Just h -> Symantic.Parser.Grammar.Combinators.SomeFailure (Symantic.Parser.Grammar.Combinators.FailureHorizon @(Symantic.Parser.Machine.Input.InputToken inp) h) GHC.Types.: res
74 GHC.Maybe.Nothing -> res
75 )
76 }
77 )
78 in let inputToken = Data.Proxy.Proxy :: Data.Proxy.Proxy (Symantic.Parser.Machine.Input.InputToken inp)
79 in let partialCont buf =
80 let readFail = Symantic.Parser.Machine.Generate.unForallOnException finalRaise
81 in let _ = "checkHorizon.newCheck: checkedHorizon=0 minHoriz=3"
82 in if readMore buf ((GHC.Num.+) @GHC.Types.Int 2 initPos)
83 then
84 let
85 in let _ = "pushValue"
86 in let _ = "catch ExceptionFailure checkedHorizon=3"
87 in let onException =
88 let _ = "onException"
89 in \(!_exn) (!failInp) (!farInp) (!farExp) buf end ->
90 let _ = "loadInput checkedHorizon=3"
91 in let _ = "checkHorizon.oldCheck: checkedHorizon=3"
92 in Symantic.Parser.Machine.Generate.unForallOnException finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure initPos farInp farExp buf end
93 in let _ = "pushValue"
94 in let _ = "comment: satisfy ((GHC.Classes.==) 'a')"
95 in let _ = "checkHorizon.oldCheck: checkedHorizon=3"
96 in let _ = "checkToken"
97 in let !(#
98 c,
99 cs
100 #) = readNext buf initPos
101 in if (GHC.Classes.==) 'a' c
102 then
103 let _ = "lift2Value checkedHorizon=2"
104 in let _ = "comment: satisfy ((GHC.Classes.==) 'b')"
105 in let _ = "checkHorizon.oldCheck: checkedHorizon=2"
106 in let _ = "checkToken"
107 in let !(#
108 c,
109 cs
110 #) = readNext buf cs
111 in if (GHC.Classes.==) 'b' c
112 then
113 let _ = "lift2Value checkedHorizon=1"
114 in let _ = "comment: satisfy ((GHC.Classes.==) 'c')"
115 in let _ = "checkHorizon.oldCheck: checkedHorizon=1"
116 in let _ = "checkToken"
117 in let !(#
118 c,
119 cs
120 #) = readNext buf cs
121 in if (GHC.Classes.==) 'c' c
122 then
123 let _ = "lift2Value checkedHorizon=0"
124 in let _ = "commit"
125 in let _ = "lift2Value checkedHorizon=0"
126 in let _ = "resume"
127 in finalRet
128 initPos
129 Data.Set.Internal.empty
130 ( let _ = "resume.genCode"
131 in GHC.Show.show ((GHC.Types.:) 'a' ((GHC.Types.:) 'b' ((GHC.Types.:) 'c' GHC.Types . [])))
132 )
133 cs
134 buf
135 GHC.Types.False
136 else
137 let _ = "checkToken.fail"
138 in let failExp =
139 Data.Set.Internal.Bin
140 1
141 ( Symantic.Parser.Grammar.Combinators.SomeFailure
142 ( case inputToken of
143 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'c'
144 )
145 )
146 Data.Set.Internal.Tip
147 Data.Set.Internal.Tip
148 in let (#
149 farInp,
150 farExp
151 #) = case GHC.Classes.compare @GHC.Types.Int initPos cs of
152 GHC.Types.LT ->
153 (#
154 cs,
155 failExp
156 #)
157 GHC.Types.EQ ->
158 (#
159 initPos,
160 failExp GHC.Base.<> Data.Set.Internal.empty
161 #)
162 GHC.Types.GT ->
163 (#
164 initPos,
165 Data.Set.Internal.empty
166 #)
167 in onException Symantic.Parser.Grammar.Combinators.ExceptionFailure cs farInp farExp buf GHC.Types.False
168 else
169 let _ = "checkToken.fail"
170 in let failExp =
171 Data.Set.Internal.Bin
172 1
173 ( Symantic.Parser.Grammar.Combinators.SomeFailure
174 ( case inputToken of
175 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'b'
176 )
177 )
178 Data.Set.Internal.Tip
179 Data.Set.Internal.Tip
180 in let (#
181 farInp,
182 farExp
183 #) = case GHC.Classes.compare @GHC.Types.Int initPos cs of
184 GHC.Types.LT ->
185 (#
186 cs,
187 failExp
188 #)
189 GHC.Types.EQ ->
190 (#
191 initPos,
192 failExp GHC.Base.<> Data.Set.Internal.empty
193 #)
194 GHC.Types.GT ->
195 (#
196 initPos,
197 Data.Set.Internal.empty
198 #)
199 in onException Symantic.Parser.Grammar.Combinators.ExceptionFailure cs farInp farExp buf GHC.Types.False
200 else
201 let _ = "checkToken.fail"
202 in let failExp =
203 Data.Set.Internal.Bin
204 1
205 ( Symantic.Parser.Grammar.Combinators.SomeFailure
206 ( case inputToken of
207 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'a'
208 )
209 )
210 Data.Set.Internal.Tip
211 Data.Set.Internal.Tip
212 in let (#
213 farInp,
214 farExp
215 #) = case GHC.Classes.compare @GHC.Types.Int initPos initPos of
216 GHC.Types.LT ->
217 (#
218 initPos,
219 failExp
220 #)
221 GHC.Types.EQ ->
222 (#
223 initPos,
224 failExp GHC.Base.<> Data.Set.Internal.empty
225 #)
226 GHC.Types.GT ->
227 (#
228 initPos,
229 Data.Set.Internal.empty
230 #)
231 in onException Symantic.Parser.Grammar.Combinators.ExceptionFailure initPos farInp farExp buf GHC.Types.False
232 else
233 let _ = "checkHorizon.newCheck.fail"
234 in let noMoreInput =
235 let failExp =
236 Data.Set.Internal.Bin
237 1
238 ( Symantic.Parser.Grammar.Combinators.SomeFailure
239 ( case inputToken of
240 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 3
241 )
242 )
243 Data.Set.Internal.Tip
244 Data.Set.Internal.Tip
245 in let (#
246 farInp,
247 farExp
248 #) = case GHC.Classes.compare @GHC.Types.Int initPos initPos of
249 GHC.Types.LT ->
250 (#
251 initPos,
252 failExp
253 #)
254 GHC.Types.EQ ->
255 (#
256 initPos,
257 failExp GHC.Base.<> Data.Set.Internal.empty
258 #)
259 GHC.Types.GT ->
260 (#
261 initPos,
262 Data.Set.Internal.empty
263 #)
264 in Symantic.Parser.Machine.Generate.unForallOnException finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure initPos farInp farExp buf GHC.Types.True
265 in if GHC.Types.False
266 then noMoreInput
267 else
268 Symantic.Parser.Machine.Generate.returnST GHC.Base.$
269 ( Symantic.Parser.Machine.Generate.ResultPartial GHC.Base.$
270 ( \newInput ->
271 if Symantic.Parser.Machine.Input.nullInput newInput
272 then noMoreInput
273 else partialCont (append buf newInput)
274 )
275 )
276 in partialCont initBuffer