]> Git — Sourcephile - haskell/symantic-parser.git/blob - tests/Golden/Splice/G1.expected.txt
iface: remove `satisfyOrFail`
[haskell/symantic-parser.git] / tests / Golden / Splice / G1.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 partialCont buf =
80 let readFail = Symantic.Parser.Machine.Generate.unForallOnException finalRaise
81 in let _ = "checkHorizon.newCheck: checkedHorizon=0 minHoriz=1"
82 in if readMore buf initPos
83 then
84 let
85 in let _ = "pushValue"
86 in let _ = "comment: satisfy ((GHC.Classes.==) 'a')"
87 in let _ = "checkHorizon.oldCheck: checkedHorizon=1"
88 in let _ = "checkToken"
89 in let !(#
90 c,
91 cs
92 #) = readNext buf initPos
93 in if (GHC.Classes.==) 'a' c
94 then
95 let _ = "lift2Value checkedHorizon=0"
96 in let _ = "resume"
97 in finalRet
98 initPos
99 Data.Set.Internal.empty
100 ( let _ = "resume.genCode"
101 in GHC.Show.show 'a'
102 )
103 cs
104 buf
105 GHC.Types.False
106 else
107 let _ = "checkToken.fail"
108 in let failExp =
109 Data.Set.Internal.Bin
110 1
111 ( Symantic.Parser.Grammar.Combinators.SomeFailure
112 ( case inputToken of
113 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'a'
114 )
115 )
116 Data.Set.Internal.Tip
117 Data.Set.Internal.Tip
118 in let (#
119 farInp,
120 farExp
121 #) = case GHC.Classes.compare @GHC.Types.Int initPos initPos of
122 GHC.Types.LT ->
123 (#
124 initPos,
125 failExp
126 #)
127 GHC.Types.EQ ->
128 (#
129 initPos,
130 failExp GHC.Base.<> Data.Set.Internal.empty
131 #)
132 GHC.Types.GT ->
133 (#
134 initPos,
135 Data.Set.Internal.empty
136 #)
137 in Symantic.Parser.Machine.Generate.unForallOnException finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure initPos farInp farExp buf GHC.Types.False
138 else
139 let _ = "checkHorizon.newCheck.fail"
140 in let noMoreInput =
141 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 @GHC.Types.Int initPos initPos of
155 GHC.Types.LT ->
156 (#
157 initPos,
158 failExp
159 #)
160 GHC.Types.EQ ->
161 (#
162 initPos,
163 failExp GHC.Base.<> Data.Set.Internal.empty
164 #)
165 GHC.Types.GT ->
166 (#
167 initPos,
168 Data.Set.Internal.empty
169 #)
170 in Symantic.Parser.Machine.Generate.unForallOnException finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure initPos farInp farExp buf GHC.Types.True
171 in if GHC.Types.False
172 then noMoreInput
173 else
174 Symantic.Parser.Machine.Generate.returnST GHC.Base.$
175 ( Symantic.Parser.Machine.Generate.ResultPartial GHC.Base.$
176 ( \newInput ->
177 if Symantic.Parser.Machine.Input.nullInput newInput
178 then noMoreInput
179 else partialCont (append buf newInput)
180 )
181 )
182 in partialCont initBuffer