File tree Expand file tree Collapse file tree 1 file changed +2
-7
lines changed Expand file tree Collapse file tree 1 file changed +2
-7
lines changed Original file line number Diff line number Diff line change @@ -157,13 +157,8 @@ module ParserMonad =
157
157
StateT <| fun st -> Error ( mkOtherParseError st genMessage)
158
158
159
159
/// Run the parser, if it fails swap the error message.
160
- let inline ( <??> ) ( parser : ParserMonad < 'a >) ( genMessage : Pos -> string ) : ParserMonad < 'a > =
161
- StateT <| fun st ->
162
- match apply1 parser st with
163
- | Ok result -> Ok result
164
- | Error e ->
165
- logf " oops <??>: e:%A " e
166
- Error( mkOtherParseError st genMessage)
160
+ let inline ( <??> ) ( parser : ParserMonad < 'a >) ( genMessage : Pos -> string ) : ParserMonad < 'a > =
161
+ parser </ catch/> fun ( ParseError ( pos , _ )) -> throw <| ParseError ( pos, Other ( genMessage pos))
167
162
168
163
///
169
164
let fmap ( f : 'a -> 'b ) ( p : ParserMonad < 'a >) : ParserMonad < 'b > = map f p
You can’t perform that action at this time.
0 commit comments