]> Git — Sourcephile - haskell/symantic-parser.git/blob - test/Golden/Splice/G11.expected.txt
doc: fix license and {def => shareable}
[haskell/symantic-parser.git] / test / Golden / Splice / G11.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 (GHC.Classes.==) 'a' 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.:) 'a' (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 1
112 ( Symantic.Parser.Grammar.Combinators.SomeFailure
113 ( case inputToken of
114 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'a'
115 )
116 )
117 Data.Set.Internal.Tip
118 Data.Set.Internal.Tip
119 in let (#
120 farInp,
121 farExp
122 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of
123 GHC.Types.LT ->
124 (#
125 inp,
126 failExp
127 #)
128 GHC.Types.EQ ->
129 (#
130 init,
131 failExp GHC.Base.<> Data.Set.Internal.empty
132 #)
133 GHC.Types.GT ->
134 (#
135 init,
136 Data.Set.Internal.empty
137 #)
138 in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp
139 else
140 let _ = "checkHorizon.else"
141 in let failExp =
142 Data.Set.Internal.Bin
143 1
144 ( Symantic.Parser.Grammar.Combinators.SomeFailure
145 ( case inputToken of
146 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 1
147 )
148 )
149 Data.Set.Internal.Tip
150 Data.Set.Internal.Tip
151 in let (#
152 farInp,
153 farExp
154 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of
155 GHC.Types.LT ->
156 (#
157 inp,
158 failExp
159 #)
160 GHC.Types.EQ ->
161 (#
162 init,
163 failExp GHC.Base.<> Data.Set.Internal.empty
164 #)
165 GHC.Types.GT ->
166 (#
167 init,
168 Data.Set.Internal.empty
169 #)
170 in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp
171 in name
172 ( let _ = "suspend"
173 in \farInp farExp v (!inp) ->
174 let readFail = finalRaise
175 in if readMore inp
176 then
177 let !(#
178 c,
179 cs
180 #) = readNext inp
181 in if (GHC.Classes.==) 'b' c
182 then
183 let _ = "resume"
184 in finalRet
185 farInp
186 farExp
187 ( let _ = "resume.genCode"
188 in GHC.Show.show (v GHC.Types . [])
189 )
190 cs
191 else
192 let _ = "checkToken.else"
193 in let failExp =
194 Data.Set.Internal.Bin
195 1
196 ( Symantic.Parser.Grammar.Combinators.SomeFailure
197 ( case inputToken of
198 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'b'
199 )
200 )
201 Data.Set.Internal.Tip
202 Data.Set.Internal.Tip
203 in let (#
204 farInp,
205 farExp
206 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp inp of
207 GHC.Types.LT ->
208 (#
209 inp,
210 failExp
211 #)
212 GHC.Types.EQ ->
213 (#
214 farInp,
215 failExp GHC.Base.<> farExp
216 #)
217 GHC.Types.GT ->
218 (#
219 farInp,
220 farExp
221 #)
222 in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp
223 else
224 let _ = "checkHorizon.else"
225 in let failExp =
226 Data.Set.Internal.Bin
227 1
228 ( Symantic.Parser.Grammar.Combinators.SomeFailure
229 ( case inputToken of
230 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 1
231 )
232 )
233 Data.Set.Internal.Tip
234 Data.Set.Internal.Tip
235 in let (#
236 farInp,
237 farExp
238 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp inp of
239 GHC.Types.LT ->
240 (#
241 inp,
242 failExp
243 #)
244 GHC.Types.EQ ->
245 (#
246 farInp,
247 failExp GHC.Base.<> farExp
248 #)
249 GHC.Types.GT ->
250 (#
251 farInp,
252 farExp
253 #)
254 in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp
255 )
256 init
257 Data.Map.Internal.Tip