]> Git — Sourcephile - haskell/symantic-parser.git/blob - test/Golden/Splice/G11.expected.txt
machine: normalOrderReduction at the last moment
[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 -> Symantic.Parser.Machine.Generate.returnST GHC.Base.$ Data.Either.Right v
31 finalRaise ::
32 forall st b.
33 Symantic.Parser.Machine.Generate.Catcher
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 = farExp
54 }
55 in GHC.ST.runST
56 ( let inputToken = Data.Proxy.Proxy :: Data.Proxy.Proxy (Symantic.Parser.Machine.Input.InputToken inp)
57 in let
58 in do
59 let dupv = \x -> x
60 reg <- GHC.STRef.newSTRef dupv
61 let _ = "iter"
62 in let catchHandler loopInput (!_exn) (!failInp) (!farInp) (!farExp) =
63 if ( \( Data.Text.Internal.Text
64 _
65 i
66 _
67 )
68 ( Data.Text.Internal.Text
69 _
70 j
71 _
72 ) -> i GHC.Classes.== j
73 )
74 loopInput
75 failInp
76 then
77 let _ = "choicesBranch.then"
78 in do
79 sr <- GHC.STRef.readSTRef reg
80 let readFail = finalRaise
81 in if readMore failInp
82 then
83 let !(#
84 c,
85 cs
86 #) = readNext failInp
87 in if (GHC.Classes.==) 'b' c
88 then
89 let _ = "resume"
90 in finalRet
91 farInp
92 farExp
93 ( let _ = "resume.genCode"
94 in GHC.Show.show (sr GHC.Types . [])
95 )
96 cs
97 else
98 let _ = "checkToken.else"
99 in let failExp =
100 Data.Set.Internal.Bin
101 1
102 ( Symantic.Parser.Grammar.Combinators.SomeFailure
103 ( case inputToken of
104 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'b'
105 )
106 )
107 Data.Set.Internal.Tip
108 Data.Set.Internal.Tip
109 in let (#
110 farInp,
111 farExp
112 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp failInp of
113 GHC.Types.LT ->
114 (#
115 failInp,
116 failExp
117 #)
118 GHC.Types.EQ ->
119 (#
120 farInp,
121 failExp GHC.Base.<> farExp
122 #)
123 GHC.Types.GT ->
124 (#
125 farInp,
126 farExp
127 #)
128 in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp
129 else
130 let _ = "checkHorizon.else"
131 in let failExp =
132 Data.Set.Internal.Bin
133 1
134 ( Symantic.Parser.Grammar.Combinators.SomeFailure
135 ( case inputToken of
136 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 1
137 )
138 )
139 Data.Set.Internal.Tip
140 Data.Set.Internal.Tip
141 in let (#
142 farInp,
143 farExp
144 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp failInp of
145 GHC.Types.LT ->
146 (#
147 failInp,
148 failExp
149 #)
150 GHC.Types.EQ ->
151 (#
152 farInp,
153 failExp GHC.Base.<> farExp
154 #)
155 GHC.Types.GT ->
156 (#
157 farInp,
158 farExp
159 #)
160 in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp
161 else
162 let _ = "choicesBranch.else"
163 in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp
164 loop = \_callReturn callInput callCatchStackByLabel ->
165 let readFail = catchHandler callInput
166 in if readMore callInput
167 then
168 let !(#
169 c,
170 cs
171 #) = readNext callInput
172 in if (GHC.Classes.==) 'a' c
173 then do
174 sr <- GHC.STRef.readSTRef reg
175 do
176 let dupv = \x -> sr ((GHC.Types.:) 'a' x)
177 GHC.STRef.writeSTRef reg dupv
178 let _ = "jump"
179 in loop (GHC.Err.error "invalid return") cs (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure readFail Data.Map.Internal.Tip Data.Map.Internal.Tip)
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 in let (#
193 farInp,
194 farExp
195 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init callInput of
196 GHC.Types.LT ->
197 (#
198 callInput,
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 callInput 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 in let (#
225 farInp,
226 farExp
227 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init callInput of
228 GHC.Types.LT ->
229 (#
230 callInput,
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 callInput farInp farExp
244 in let _ = "jump"
245 in loop finalRet init Data.Map.Internal.Tip
246 )