]> Git — Sourcephile - haskell/symantic-parser.git/blob - test/Golden/Splice/G3.expected.txt
machine: normalOrderReduction at the last moment
[haskell/symantic-parser.git] / test / Golden / Splice / G3.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.Catcher
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 = farExp
54 }
55 in GHC.ST.runST
56 ( let inputToken = Data.Proxy.Proxy :: Data.Proxy.Proxy (Symantic.Parser.Machine.Input.InputToken inp)
57 in let
58 in do
59 let dupv = \x -> x
60 reg <- GHC.STRef.newSTRef dupv
61 let _ = "iter"
62 in let catchHandler loopInput (!_exn) (!failInp) (!farInp) (!farExp) =
63 if ( \( Data.Text.Internal.Text
64 _
65 i
66 _
67 )
68 ( Data.Text.Internal.Text
69 _
70 j
71 _
72 ) -> i GHC.Classes.== j
73 )
74 loopInput
75 failInp
76 then
77 let _ = "choicesBranch.then"
78 in do
79 sr <- GHC.STRef.readSTRef reg
80 let _ = "resume"
81 in finalRet
82 farInp
83 farExp
84 ( let _ = "resume.genCode"
85 in GHC.Show.show (sr GHC.Types . [])
86 )
87 failInp
88 else
89 let _ = "choicesBranch.else"
90 in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp
91 loop = \_callReturn callInput callCatchStackByLabel ->
92 let readFail = catchHandler callInput
93 in if readMore callInput
94 then
95 let !(#
96 c,
97 cs
98 #) = readNext callInput
99 in if (GHC.Classes.==) 'a' c
100 then do
101 sr <- GHC.STRef.readSTRef reg
102 do
103 let dupv = \x -> sr ((GHC.Types.:) 'a' x)
104 GHC.STRef.writeSTRef reg dupv
105 let _ = "jump"
106 in loop (GHC.Err.error "invalid return") cs (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure readFail Data.Map.Internal.Tip Data.Map.Internal.Tip)
107 else
108 let _ = "checkToken.else"
109 in let failExp =
110 Data.Set.Internal.Bin
111 1
112 ( Symantic.Parser.Grammar.Combinators.SomeFailure
113 ( case inputToken of
114 (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'a'
115 )
116 )
117 Data.Set.Internal.Tip
118 Data.Set.Internal.Tip
119 in let (#
120 farInp,
121 farExp
122 #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init callInput of
123 GHC.Types.LT ->
124 (#
125 callInput,
126 failExp
127 #)
128 GHC.Types.EQ ->
129 (#
130 init,
131 failExp GHC.Base.<> Data.Set.Internal.empty
132 #)
133 GHC.Types.GT ->
134 (#
135 init,
136 Data.Set.Internal.empty
137 #)
138 in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure callInput farInp farExp
139 else
140 let _ = "checkHorizon.else"
141 in 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 `Data.Function.on` Symantic.Parser.Machine.Input.offset) init callInput of
155 GHC.Types.LT ->
156 (#
157 callInput,
158 failExp
159 #)
160 GHC.Types.EQ ->
161 (#
162 init,
163 failExp GHC.Base.<> Data.Set.Internal.empty
164 #)
165 GHC.Types.GT ->
166 (#
167 init,
168 Data.Set.Internal.empty
169 #)
170 in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure callInput farInp farExp
171 in let _ = "jump"
172 in loop finalRet init Data.Map.Internal.Tip
173 )