]> Git — Sourcephile - haskell/symantic-parser.git/blob - tests/Golden/Splice/G9.expected.txt
impl: add attoparsec's Text.Buffer
[haskell/symantic-parser.git] / tests / Golden / Splice / G9.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 join = \farInp farExp v (!inp) ->
92 let _ = "lift2Value checkedHorizon=0"
93 in let _ = "resume"
94 in finalRet
95 farInp
96 farExp
97 ( let _ = "resume.genCode"
98 in GHC.Show.show v
99 )
100 inp
101 in let _ = "catch ExceptionFailure checkedHorizon=0"
102 in let onException =
103 let _ = "onException"
104 in \(!_exn) (!failInp) (!farInp) (!farExp) ->
105 let _ = "comment: raiseAgainIfConsumed"
106 in let _ = "saveInput checkedHorizon=0"
107 in let _ = "lift2Value checkedHorizon=0"
108 in if ( \( Data.Text.Internal.Text
109 _
110 i
111 _
112 )
113 ( Data.Text.Internal.Text
114 _
115 j
116 _
117 ) -> i GHC.Classes.== j
118 )
119 init
120 failInp
121 then
122 let _ = "choicesBranch checkedHorizon=0"
123 in let _ = "comment: eof.fail"
124 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
125 in let (#
126 farInp,
127 farExp
128 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp failInp of
129 GHC.Types.LT ->
130 (#
131 failInp,
132 failExp
133 #)
134 GHC.Types.EQ ->
135 (#
136 farInp,
137 failExp GHC.Base.<> farExp
138 #)
139 GHC.Types.GT ->
140 (#
141 farInp,
142 farExp
143 #)
144 in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp
145 else
146 let _ = "choicesBranch.else"
147 in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp
148 in let _ = "comment: negLook"
149 in let _ = "catch ExceptionFailure checkedHorizon=0"
150 in let onException =
151 let _ = "onException"
152 in \(!_exn) (!failInp) (!farInp) (!farExp) ->
153 let _ = "comment: negLook.reset"
154 in let _ = "loadInput checkedHorizon=0"
155 in let _ = "checkHorizon.noCheck"
156 in let _ = "pushValue"
157 in let _ = "commit"
158 in let _ = "resume"
159 in join
160 farInp
161 farExp
162 ( let _ = "resume.genCode"
163 in GHC.Tuple . ()
164 )
165 init
166 in let _ = "comment: negLook.ahead"
167 in let _ = "saveInput checkedHorizon=0"
168 in let _ = "comment: satisfy ((\\x_0 -> \\x_1 -> x_0) GHC.Types.True)"
169 in let inp = init
170 in let readFail = onException
171 in let _ = "checkHorizon.newCheck: checkedHorizon=0 minHoriz=1"
172 in if readMore inp
173 then
174 let _ = "checkToken"
175 in let !(#
176 c,
177 cs
178 #) = readNext inp
179 in let _ = "popValue"
180 in let _ = "commit"
181 in let _ = "loadInput checkedHorizon=0"
182 in let _ = "checkHorizon.noCheck"
183 in onException Symantic.Parser.Grammar.Combinators.ExceptionFailure init init Data.Set.Internal.empty
184 else
185 let _ = "checkHorizon.newCheck.fail"
186 in let failExp =
187 Data.Set.Internal.Bin
188 1
189 ( Symantic.Parser.Grammar.Combinators.SomeFailure
190 ( case inputToken of
191 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 1
192 )
193 )
194 Data.Set.Internal.Tip
195 Data.Set.Internal.Tip
196 in let (#
197 farInp,
198 farExp
199 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of
200 GHC.Types.LT ->
201 (#
202 inp,
203 failExp
204 #)
205 GHC.Types.EQ ->
206 (#
207 init,
208 failExp GHC.Base.<> Data.Set.Internal.empty
209 #)
210 GHC.Types.GT ->
211 (#
212 init,
213 Data.Set.Internal.empty
214 #)
215 in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp
216 )