]> Git — Sourcephile - haskell/symantic-parser.git/blob - tests/Golden/Splice/G9.expected.txt
!fixup impl: move `liftTypedString` to `Language.Haskell.TH.Show`
[haskell/symantic-parser.git] / tests / Golden / Splice / G9.expected.txt
1 \(input :: inp) ->
2 let !(#
3 initBuffer,
4 initPos,
5 readMore,
6 readNext,
7 append
8 #) =
9 let next buf pos =
10 let !( Data.Text.Unsafe.Iter
11 c
12 d
13 ) = Symantic.Parser.Machine.Input.Text.Buffer.iter buf pos
14 in (# c, pos GHC.Num.+ d #)
15 more buf pos = pos GHC.Classes.< Symantic.Parser.Machine.Input.Text.Buffer.length buf
16 append = Symantic.Parser.Machine.Input.Text.Buffer.pappend
17 in (#
18 Symantic.Parser.Machine.Input.Text.Buffer.buffer input,
19 0,
20 more,
21 next,
22 append
23 #)
24 finalRet = \_farInp _farExp v _inp _buf _end -> Symantic.Parser.Machine.Generate.returnST GHC.Base.$ Symantic.Parser.Machine.Generate.ResultDone v
25 finalRaise :: Symantic.Parser.Machine.Generate.ForallOnException inp =
26 Symantic.Parser.Machine.Generate.ForallOnException GHC.Base.$
27 ( \(!exn) _failInp (!farInp) (!farExp) buf end ->
28 Symantic.Parser.Machine.Generate.returnST GHC.Base.$
29 Symantic.Parser.Machine.Generate.ResultError
30 Symantic.Parser.Machine.Generate.ParsingError
31 { Symantic.Parser.Machine.Generate.parsingErrorOffset = Symantic.Parser.Machine.Input.position farInp,
32 Symantic.Parser.Machine.Generate.parsingErrorException = exn,
33 Symantic.Parser.Machine.Generate.parsingErrorUnexpected =
34 if readMore buf farInp
35 then
36 GHC.Maybe.Just
37 ( let (#
38 c,
39 _
40 #) = readNext buf farInp
41 in c
42 )
43 else GHC.Maybe.Nothing,
44 Symantic.Parser.Machine.Generate.parsingErrorExpecting =
45 let ( minHoriz,
46 res
47 ) =
48 Data.Set.Internal.foldr
49 ( \f
50 ( minH,
51 acc
52 ) -> case Symantic.Parser.Grammar.Combinators.unSomeFailure f of
53 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)))
54 | GHC.Maybe.Just old <- minH ->
55 ( GHC.Maybe.Just (GHC.Classes.min old h),
56 acc
57 )
58 | GHC.Base.otherwise ->
59 ( GHC.Maybe.Just h,
60 acc
61 )
62 _ ->
63 ( minH,
64 f GHC.Types.: acc
65 )
66 )
67 ( GHC.Maybe.Nothing,
68 GHC.Types . []
69 )
70 farExp
71 in Data.Set.Internal.fromList GHC.Base.$
72 ( case minHoriz of
73 GHC.Maybe.Just h -> Symantic.Parser.Grammar.Combinators.SomeFailure (Symantic.Parser.Grammar.Combinators.FailureHorizon @(Symantic.Parser.Machine.Input.InputToken inp) h) GHC.Types.: res
74 GHC.Maybe.Nothing -> res
75 )
76 }
77 )
78 in let inputToken = Data.Proxy.Proxy :: Data.Proxy.Proxy (Symantic.Parser.Machine.Input.InputToken inp)
79 in let _ = "checkHorizon.noCheck"
80 in let
81 in let _ = "pushValue"
82 in let join = \farInp farExp v (!inp) buf end ->
83 let _ = "lift2Value checkedHorizon=0"
84 in let _ = "resume"
85 in finalRet
86 farInp
87 farExp
88 ( let _ = "resume.genCode"
89 in GHC.Show.show v
90 )
91 inp
92 buf
93 end
94 in let _ = "catch ExceptionFailure checkedHorizon=0"
95 in let onException =
96 let _ = "onException"
97 in \(!_exn) (!failInp) (!farInp) (!farExp) buf end ->
98 let _ = "comment: raiseAgainIfConsumed"
99 in let _ = "saveInput checkedHorizon=0"
100 in let _ = "lift2Value checkedHorizon=0"
101 in if (GHC.Classes.==) @GHC.Types.Int initPos failInp
102 then
103 let _ = "choicesBranch checkedHorizon=0"
104 in let _ = "comment: eof.fail"
105 in let failExp = Data.Set.Internal.Bin 1 (Symantic.Parser.Grammar.Combinators.SomeFailure Symantic.Parser.Grammar.Combinators.FailureEnd) Data.Set.Internal.Tip Data.Set.Internal.Tip
106 in let (#
107 farInp,
108 farExp
109 #) = case GHC.Classes.compare @GHC.Types.Int farInp failInp of
110 GHC.Types.LT ->
111 (#
112 failInp,
113 failExp
114 #)
115 GHC.Types.EQ ->
116 (#
117 farInp,
118 failExp GHC.Base.<> farExp
119 #)
120 GHC.Types.GT ->
121 (#
122 farInp,
123 farExp
124 #)
125 in Symantic.Parser.Machine.Generate.unForallOnException finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp buf end
126 else
127 let _ = "choicesBranch.else"
128 in Symantic.Parser.Machine.Generate.unForallOnException finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp buf end
129 in let _ = "comment: negLook"
130 in let _ = "catch ExceptionFailure checkedHorizon=0"
131 in let onException =
132 let _ = "onException"
133 in \(!_exn) (!failInp) (!farInp) (!farExp) buf end ->
134 let _ = "comment: negLook.reset"
135 in let _ = "loadInput checkedHorizon=0"
136 in let _ = "checkHorizon.noCheck"
137 in let _ = "pushValue"
138 in let _ = "commit"
139 in let _ = "resume"
140 in join
141 farInp
142 farExp
143 ( let _ = "resume.genCode"
144 in GHC.Tuple . ()
145 )
146 initPos
147 buf
148 end
149 in let _ = "comment: negLook.ahead"
150 in let _ = "saveInput checkedHorizon=0"
151 in let _ = "comment: satisfy (GHC.Base.const GHC.Types.True)"
152 in let partialCont buf =
153 let readFail = onException
154 in let _ = "checkHorizon.newCheck: checkedHorizon=0 minHoriz=1"
155 in if readMore buf initPos
156 then
157 let _ = "checkToken"
158 in let !(#
159 c,
160 cs
161 #) = readNext buf initPos
162 in let _ = "popValue"
163 in let _ = "commit"
164 in let _ = "loadInput checkedHorizon=0"
165 in let _ = "checkHorizon.noCheck"
166 in onException Symantic.Parser.Grammar.Combinators.ExceptionFailure initPos initPos Data.Set.Internal.empty buf GHC.Types.False
167 else
168 let _ = "checkHorizon.newCheck.fail"
169 in let noMoreInput =
170 let failExp =
171 Data.Set.Internal.Bin
172 1
173 ( Symantic.Parser.Grammar.Combinators.SomeFailure
174 ( case inputToken of
175 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 1
176 )
177 )
178 Data.Set.Internal.Tip
179 Data.Set.Internal.Tip
180 in let (#
181 farInp,
182 farExp
183 #) = case GHC.Classes.compare @GHC.Types.Int initPos initPos of
184 GHC.Types.LT ->
185 (#
186 initPos,
187 failExp
188 #)
189 GHC.Types.EQ ->
190 (#
191 initPos,
192 failExp GHC.Base.<> Data.Set.Internal.empty
193 #)
194 GHC.Types.GT ->
195 (#
196 initPos,
197 Data.Set.Internal.empty
198 #)
199 in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure initPos farInp farExp buf GHC.Types.True
200 in if GHC.Types.False
201 then noMoreInput
202 else
203 Symantic.Parser.Machine.Generate.returnST GHC.Base.$
204 ( Symantic.Parser.Machine.Generate.ResultPartial GHC.Base.$
205 ( \newInput ->
206 if Symantic.Parser.Machine.Input.nullInput newInput
207 then noMoreInput
208 else partialCont (append buf newInput)
209 )
210 )
211 in partialCont initBuffer