]> Git — Sourcephile - haskell/symantic-parser.git/blob - test/Golden/Splice/G10.expected.txt
machine: fix mayRaise analysis of catch
[haskell/symantic-parser.git] / test / Golden / Splice / G10.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.ParsingErrorStandard
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
55 in let join = \farInp farExp v (!inp) ->
56 let _ = "resume"
57 in finalRet
58 farInp
59 farExp
60 ( let _ = "resume.genCode"
61 in GHC.Show.show v
62 )
63 inp
64 in let _ = "catch ExceptionFailure"
65 in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =
66 let _ = "catch.ko ExceptionFailure"
67 in if ( \( Data.Text.Internal.Text
68 _
69 i
70 _
71 )
72 ( Data.Text.Internal.Text
73 _
74 j
75 _
76 ) -> i GHC.Classes.== j
77 )
78 init
79 failInp
80 then
81 let _ = "choicesBranch.then"
82 in let readFail = finalRaise
83 in if readMore failInp
84 then
85 let !(#
86 c,
87 cs
88 #) = readNext failInp
89 in if ('b' GHC.Classes.==) c
90 then
91 let _ = "resume"
92 in join
93 farInp
94 farExp
95 ( let _ = "resume.genCode"
96 in 'b'
97 )
98 cs
99 else
100 let _ = "checkToken.else"
101 in let failExp =
102 Data.Set.Internal.Bin
103 1
104 ( Symantic.Parser.Grammar.Combinators.SomeFailure
105 ( case inputToken of
106 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'b'
107 )
108 )
109 Data.Set.Internal.Tip
110 Data.Set.Internal.Tip
111 (#
112 farInp,
113 farExp
114 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp failInp of
115 GHC.Types.LT ->
116 (#
117 failInp,
118 failExp
119 #)
120 GHC.Types.EQ ->
121 (#
122 farInp,
123 failExp GHC.Base.<> farExp
124 #)
125 GHC.Types.GT ->
126 (#
127 farInp,
128 farExp
129 #)
130 in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp
131 else
132 let _ = "checkHorizon.else"
133 in let failExp =
134 Data.Set.Internal.Bin
135 1
136 ( Symantic.Parser.Grammar.Combinators.SomeFailure
137 ( case inputToken of
138 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 1
139 )
140 )
141 Data.Set.Internal.Tip
142 Data.Set.Internal.Tip
143 (#
144 farInp,
145 farExp
146 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp failInp of
147 GHC.Types.LT ->
148 (#
149 failInp,
150 failExp
151 #)
152 GHC.Types.EQ ->
153 (#
154 farInp,
155 failExp GHC.Base.<> farExp
156 #)
157 GHC.Types.GT ->
158 (#
159 farInp,
160 farExp
161 #)
162 in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp
163 else
164 let _ = "choicesBranch.else"
165 in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp
166 in let readFail = catchHandler
167 in if readMore init
168 then
169 let !(# c, cs #) = readNext init
170 in if ('a' GHC.Classes.==) c
171 then
172 let _ = "resume"
173 in join
174 init
175 Data.Set.Internal.empty
176 ( let _ = "resume.genCode"
177 in 'a'
178 )
179 cs
180 else
181 let _ = "checkToken.else"
182 in let failExp =
183 Data.Set.Internal.Bin
184 1
185 ( Symantic.Parser.Grammar.Combinators.SomeFailure
186 ( case inputToken of
187 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'a'
188 )
189 )
190 Data.Set.Internal.Tip
191 Data.Set.Internal.Tip
192 (#
193 farInp,
194 farExp
195 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init init of
196 GHC.Types.LT ->
197 (#
198 init,
199 failExp
200 #)
201 GHC.Types.EQ ->
202 (#
203 init,
204 failExp GHC.Base.<> Data.Set.Internal.empty
205 #)
206 GHC.Types.GT ->
207 (#
208 init,
209 Data.Set.Internal.empty
210 #)
211 in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure init farInp farExp
212 else
213 let _ = "checkHorizon.else"
214 in let failExp =
215 Data.Set.Internal.Bin
216 1
217 ( Symantic.Parser.Grammar.Combinators.SomeFailure
218 ( case inputToken of
219 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 1
220 )
221 )
222 Data.Set.Internal.Tip
223 Data.Set.Internal.Tip
224 (#
225 farInp,
226 farExp
227 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init init of
228 GHC.Types.LT ->
229 (#
230 init,
231 failExp
232 #)
233 GHC.Types.EQ ->
234 (#
235 init,
236 failExp GHC.Base.<> Data.Set.Internal.empty
237 #)
238 GHC.Types.GT ->
239 (#
240 init,
241 Data.Set.Internal.empty
242 #)
243 in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure init farInp farExp