]> Git — Sourcephile - haskell/symantic-parser.git/blob - test/Golden/Splice/G1.expected.txt
tests: accept
[haskell/symantic-parser.git] / test / Golden / Splice / G1.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 inp = init
89 in let readFail = finalRaise
90 in let _ = "checkHorizon.newCheck: checkedHorizon=0 minHoriz=1"
91 in if readMore inp
92 then
93 let
94 in let _ = "pushValue"
95 in let _ = "comment: satisfy ((GHC.Classes.==) 'a')"
96 in let _ = "checkHorizon.oldCheck: checkedHorizon=1"
97 in let _ = "checkToken"
98 in let !(#
99 c,
100 cs
101 #) = readNext inp
102 in if (GHC.Classes.==) 'a' c
103 then
104 let _ = "lift2Value checkedHorizon=0"
105 in let _ = "resume"
106 in finalRet
107 init
108 Data.Set.Internal.empty
109 ( let _ = "resume.genCode"
110 in GHC.Show.show 'a'
111 )
112 cs
113 else
114 let _ = "checkToken.fail"
115 in let failExp =
116 Data.Set.Internal.Bin
117 1
118 ( Symantic.Parser.Grammar.Combinators.SomeFailure
119 ( case inputToken of
120 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'a'
121 )
122 )
123 Data.Set.Internal.Tip
124 Data.Set.Internal.Tip
125 in let (#
126 farInp,
127 farExp
128 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of
129 GHC.Types.LT ->
130 (#
131 inp,
132 failExp
133 #)
134 GHC.Types.EQ ->
135 (#
136 init,
137 failExp GHC.Base.<> Data.Set.Internal.empty
138 #)
139 GHC.Types.GT ->
140 (#
141 init,
142 Data.Set.Internal.empty
143 #)
144 in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp
145 else
146 let _ = "checkHorizon.newCheck.fail"
147 in let failExp =
148 Data.Set.Internal.Bin
149 1
150 ( Symantic.Parser.Grammar.Combinators.SomeFailure
151 ( case inputToken of
152 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 1
153 )
154 )
155 Data.Set.Internal.Tip
156 Data.Set.Internal.Tip
157 in let (#
158 farInp,
159 farExp
160 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of
161 GHC.Types.LT ->
162 (#
163 inp,
164 failExp
165 #)
166 GHC.Types.EQ ->
167 (#
168 init,
169 failExp GHC.Base.<> Data.Set.Internal.empty
170 #)
171 GHC.Types.GT ->
172 (#
173 init,
174 Data.Set.Internal.empty
175 #)
176 in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp
177 )