]> Git — Sourcephile - haskell/symantic-parser.git/blob - tests/Golden/Splice/G2.expected.txt
build: move all Nix config to `flake.nix`
[haskell/symantic-parser.git] / tests / Golden / Splice / G2.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.OnException
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 =
54 let ( minHoriz,
55 res
56 ) =
57 Data.Set.Internal.foldr
58 ( \f
59 ( minH,
60 acc
61 ) -> case Symantic.Parser.Grammar.Combinators.unSomeFailure f of
62 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)))
63 | GHC.Maybe.Just old <- minH ->
64 ( GHC.Maybe.Just (GHC.Classes.min old h),
65 acc
66 )
67 | GHC.Base.otherwise ->
68 ( GHC.Maybe.Just h,
69 acc
70 )
71 _ ->
72 ( minH,
73 f GHC.Types.: acc
74 )
75 )
76 ( GHC.Maybe.Nothing,
77 GHC.Types . []
78 )
79 farExp
80 in Data.Set.Internal.fromList GHC.Base.$
81 ( case minHoriz of
82 GHC.Maybe.Just h -> Symantic.Parser.Grammar.Combinators.SomeFailure (Symantic.Parser.Grammar.Combinators.FailureHorizon @(Symantic.Parser.Machine.Input.InputToken inp) h) GHC.Types.: res
83 GHC.Maybe.Nothing -> res
84 )
85 }
86 in GHC.ST.runST
87 ( let inputToken = Data.Proxy.Proxy :: Data.Proxy.Proxy (Symantic.Parser.Machine.Input.InputToken inp)
88 in let inp = init
89 in let readFail = finalRaise
90 in let _ = "checkHorizon.newCheck: checkedHorizon=0 minHoriz=3"
91 in if readMore (Symantic.Parser.Machine.Input.shiftRightText 2 inp)
92 then
93 let
94 in let _ = "pushValue"
95 in let _ = "catch ExceptionFailure checkedHorizon=3"
96 in let onException =
97 let _ = "onException"
98 in \(!_exn) (!failInp) (!farInp) (!farExp) ->
99 let _ = "loadInput checkedHorizon=3"
100 in let _ = "checkHorizon.oldCheck: checkedHorizon=3"
101 in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp
102 in let _ = "pushValue"
103 in let _ = "comment: satisfy ((GHC.Classes.==) 'a')"
104 in let _ = "checkHorizon.oldCheck: checkedHorizon=3"
105 in let _ = "checkToken"
106 in let !(#
107 c,
108 cs
109 #) = readNext inp
110 in if (GHC.Classes.==) 'a' c
111 then
112 let _ = "lift2Value checkedHorizon=2"
113 in let _ = "comment: satisfy ((GHC.Classes.==) 'b')"
114 in let _ = "checkHorizon.oldCheck: checkedHorizon=2"
115 in let _ = "checkToken"
116 in let !(#
117 c,
118 cs
119 #) = readNext cs
120 in if (GHC.Classes.==) 'b' c
121 then
122 let _ = "lift2Value checkedHorizon=1"
123 in let _ = "comment: satisfy ((GHC.Classes.==) 'c')"
124 in let _ = "checkHorizon.oldCheck: checkedHorizon=1"
125 in let _ = "checkToken"
126 in let !(#
127 c,
128 cs
129 #) = readNext cs
130 in if (GHC.Classes.==) 'c' c
131 then
132 let _ = "lift2Value checkedHorizon=0"
133 in let _ = "commit"
134 in let _ = "lift2Value checkedHorizon=0"
135 in let _ = "resume"
136 in finalRet
137 init
138 Data.Set.Internal.empty
139 ( let _ = "resume.genCode"
140 in GHC.Show.show ((GHC.Types.:) 'a' ((GHC.Types.:) 'b' ((GHC.Types.:) 'c' GHC.Types . [])))
141 )
142 cs
143 else
144 let _ = "checkToken.fail"
145 in let failExp =
146 Data.Set.Internal.Bin
147 1
148 ( Symantic.Parser.Grammar.Combinators.SomeFailure
149 ( case inputToken of
150 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'c'
151 )
152 )
153 Data.Set.Internal.Tip
154 Data.Set.Internal.Tip
155 in let (#
156 farInp,
157 farExp
158 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init cs of
159 GHC.Types.LT ->
160 (#
161 cs,
162 failExp
163 #)
164 GHC.Types.EQ ->
165 (#
166 init,
167 failExp GHC.Base.<> Data.Set.Internal.empty
168 #)
169 GHC.Types.GT ->
170 (#
171 init,
172 Data.Set.Internal.empty
173 #)
174 in onException Symantic.Parser.Grammar.Combinators.ExceptionFailure cs farInp farExp
175 else
176 let _ = "checkToken.fail"
177 in let failExp =
178 Data.Set.Internal.Bin
179 1
180 ( Symantic.Parser.Grammar.Combinators.SomeFailure
181 ( case inputToken of
182 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'b'
183 )
184 )
185 Data.Set.Internal.Tip
186 Data.Set.Internal.Tip
187 in let (#
188 farInp,
189 farExp
190 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init cs of
191 GHC.Types.LT ->
192 (#
193 cs,
194 failExp
195 #)
196 GHC.Types.EQ ->
197 (#
198 init,
199 failExp GHC.Base.<> Data.Set.Internal.empty
200 #)
201 GHC.Types.GT ->
202 (#
203 init,
204 Data.Set.Internal.empty
205 #)
206 in onException Symantic.Parser.Grammar.Combinators.ExceptionFailure cs farInp farExp
207 else
208 let _ = "checkToken.fail"
209 in let failExp =
210 Data.Set.Internal.Bin
211 1
212 ( Symantic.Parser.Grammar.Combinators.SomeFailure
213 ( case inputToken of
214 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'a'
215 )
216 )
217 Data.Set.Internal.Tip
218 Data.Set.Internal.Tip
219 in let (#
220 farInp,
221 farExp
222 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of
223 GHC.Types.LT ->
224 (#
225 inp,
226 failExp
227 #)
228 GHC.Types.EQ ->
229 (#
230 init,
231 failExp GHC.Base.<> Data.Set.Internal.empty
232 #)
233 GHC.Types.GT ->
234 (#
235 init,
236 Data.Set.Internal.empty
237 #)
238 in onException Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp
239 else
240 let _ = "checkHorizon.newCheck.fail"
241 in let failExp =
242 Data.Set.Internal.Bin
243 1
244 ( Symantic.Parser.Grammar.Combinators.SomeFailure
245 ( case inputToken of
246 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 3
247 )
248 )
249 Data.Set.Internal.Tip
250 Data.Set.Internal.Tip
251 in let (#
252 farInp,
253 farExp
254 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of
255 GHC.Types.LT ->
256 (#
257 inp,
258 failExp
259 #)
260 GHC.Types.EQ ->
261 (#
262 init,
263 failExp GHC.Base.<> Data.Set.Internal.empty
264 #)
265 GHC.Types.GT ->
266 (#
267 init,
268 Data.Set.Internal.empty
269 #)
270 in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp
271 )