Skip to content

Commit

Permalink
Merge pull request #468 from NathanReb/fix-map-top-down-api
Browse files Browse the repository at this point in the history
Make `Context_free.map_top_down`'s `embed_errors` arg optional
  • Loading branch information
NathanReb authored Feb 2, 2024
2 parents 7c46d34 + 9887aa4 commit 86165c6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
unreleased
-------------------

- Add an optional `embed_errors` argument to `Context_free.map_top_down` that
controls how to deal with exceptions thrown by context-free rules.
(#468, @NathanReb)

- Fix `Longident.parse` so it properly handles unparenthesized dotted operators
such as `+.` or `*.`. (#111, @rgrinberg, @NathanReb)

Expand Down
3 changes: 2 additions & 1 deletion src/context_free.ml
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,8 @@ module Expect_mismatch_handler = struct
end

class map_top_down ?(expect_mismatch_handler = Expect_mismatch_handler.nop)
?(generated_code_hook = Generated_code_hook.nop) rules ~embed_errors =
?(generated_code_hook = Generated_code_hook.nop) ?(embed_errors = false) rules
=
let hook = generated_code_hook in

let special_functions =
Expand Down
2 changes: 1 addition & 1 deletion src/context_free.mli
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ class map_top_down :
Expect_mismatch_handler.t (* default: Expect_mismatch_handler.nop *) ->
?generated_code_hook:
Generated_code_hook.t (* default: Generated_code_hook.nop *) ->
?embed_errors:bool ->
Rule.t list ->
embed_errors:bool ->
object
inherit Ast_traverse.map_with_expansion_context_and_errors
end

0 comments on commit 86165c6

Please sign in to comment.