]> Git — Sourcephile - haskell/symantic-parser.git/blob - tests/Golden/Splice/G3.expected.txt
build: cleanup Nix files
[haskell/symantic-parser.git] / tests / Golden / Splice / G3.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 _ = "checkHorizon.noCheck"
89 in let
90 in let _ = "pushValue"
91 in let _ = "pushValue"
92 in do
93 let dupv = \x -> x
94 reg <- GHC.STRef.newSTRef dupv
95 let _ = "iter"
96 in let onException loopInput =
97 let _ = "onException"
98 in \(!_exn) (!failInp) (!farInp) (!farExp) ->
99 let _ = "comment: raiseAgainIfConsumed"
100 in let _ = "saveInput checkedHorizon=0"
101 in let _ = "lift2Value checkedHorizon=0"
102 in if ( \( Data.Text.Internal.Text
103 _
104 i
105 _
106 )
107 ( Data.Text.Internal.Text
108 _
109 j
110 _
111 ) -> i GHC.Classes.== j
112 )
113 loopInput
114 failInp
115 then
116 let _ = "choicesBranch checkedHorizon=0"
117 in do
118 sr <- GHC.STRef.readSTRef reg
119 let _ = "pushValue"
120 in let _ = "lift2Value checkedHorizon=0"
121 in let _ = "lift2Value checkedHorizon=0"
122 in let _ = "resume"
123 in finalRet
124 farInp
125 farExp
126 ( let _ = "resume.genCode"
127 in GHC.Show.show (sr GHC.Types . [])
128 )
129 failInp
130 else
131 let _ = "choicesBranch.else"
132 in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp
133 loop = \_callerOnReturn callerInput callerOnExceptionStackByLabel ->
134 let _ = "pushValue"
135 in let _ = "comment: satisfy ((GHC.Classes.==) 'a')"
136 in let inp = callerInput
137 in let readFail = onException callerInput
138 in let _ = "checkHorizon.newCheck: checkedHorizon=0 minHoriz=1"
139 in if readMore inp
140 then
141 let _ = "checkToken"
142 in let !(#
143 c,
144 cs
145 #) = readNext inp
146 in if (GHC.Classes.==) 'a' c
147 then
148 let _ = "lift2Value checkedHorizon=1"
149 in let _ = "pushValue"
150 in let _ = "lift2Value checkedHorizon=1"
151 in do
152 sr <- GHC.STRef.readSTRef reg
153 let _ = "lift2Value checkedHorizon=1"
154 in do
155 let dupv = \x -> sr ((GHC.Types.:) 'a' x)
156 GHC.STRef.writeSTRef reg dupv
157 let _ = "jump"
158 in loop (GHC.Err.error "invalid onReturn") cs (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure readFail Data.Map.Internal.Tip Data.Map.Internal.Tip)
159 else
160 let _ = "checkToken.fail"
161 in let failExp =
162 Data.Set.Internal.Bin
163 1
164 ( Symantic.Parser.Grammar.Combinators.SomeFailure
165 ( case inputToken of
166 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'a'
167 )
168 )
169 Data.Set.Internal.Tip
170 Data.Set.Internal.Tip
171 in let (#
172 farInp,
173 farExp
174 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of
175 GHC.Types.LT ->
176 (#
177 inp,
178 failExp
179 #)
180 GHC.Types.EQ ->
181 (#
182 init,
183 failExp GHC.Base.<> Data.Set.Internal.empty
184 #)
185 GHC.Types.GT ->
186 (#
187 init,
188 Data.Set.Internal.empty
189 #)
190 in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp
191 else
192 let _ = "checkHorizon.newCheck.fail"
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.FailureHorizon @tok' 1
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) init inp of
207 GHC.Types.LT ->
208 (#
209 inp,
210 failExp
211 #)
212 GHC.Types.EQ ->
213 (#
214 init,
215 failExp GHC.Base.<> Data.Set.Internal.empty
216 #)
217 GHC.Types.GT ->
218 (#
219 init,
220 Data.Set.Internal.empty
221 #)
222 in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp
223 in let _ = "jump"
224 in loop finalRet init Data.Map.Internal.Tip
225 )