]> Git — Sourcephile - haskell/symantic-parser.git/blob - tests/Golden/Splice/G17.expected.txt
build: move all Nix config to `flake.nix`
[haskell/symantic-parser.git] / tests / Golden / Splice / G17.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 ((\\x_0 -> \\x_1 -> x_0) GHC.Types.True)"
96 in let _ = "checkHorizon.oldCheck: checkedHorizon=1"
97 in let _ = "checkToken"
98 in let !(#
99 c,
100 cs
101 #) = readNext inp
102 in do
103 let dupv = c
104 reg <- GHC.STRef.newSTRef dupv
105 let _ = "pushValue"
106 in do
107 sr <- GHC.STRef.readSTRef reg
108 let _ = "lift2Value checkedHorizon=0"
109 in do
110 sr <- GHC.STRef.readSTRef reg
111 let _ = "lift2Value checkedHorizon=0"
112 in let _ = "lift2Value checkedHorizon=0"
113 in let _ = "resume"
114 in finalRet
115 init
116 Data.Set.Internal.empty
117 ( let _ = "resume.genCode"
118 in GHC.Show.show (GHC.Tuple . (,) sr sr)
119 )
120 cs
121 else
122 let _ = "checkHorizon.newCheck.fail"
123 in let failExp =
124 Data.Set.Internal.Bin
125 1
126 ( Symantic.Parser.Grammar.Combinators.SomeFailure
127 ( case inputToken of
128 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 1
129 )
130 )
131 Data.Set.Internal.Tip
132 Data.Set.Internal.Tip
133 in let (#
134 farInp,
135 farExp
136 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of
137 GHC.Types.LT ->
138 (#
139 inp,
140 failExp
141 #)
142 GHC.Types.EQ ->
143 (#
144 init,
145 failExp GHC.Base.<> Data.Set.Internal.empty
146 #)
147 GHC.Types.GT ->
148 (#
149 init,
150 Data.Set.Internal.empty
151 #)
152 in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp
153 )