Skip to content

Commit c5e763f

Browse files
committed
Merge remote-tracking branch 'origin/master' into ocaml-4.02
2 parents 3a0a6fd + 458dd88 commit c5e763f

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,8 @@ condition.
5454

5555
The syntax extension will always warn if no catch-all case is provided. No
5656
exhaustiveness check is attempted. Doing it right would require
57-
reimplementing full regular expression parsing, and an algorithm which would
58-
presumably produce a counter-example as expands the branches of the regular
59-
expression.
57+
reimplementing full regular expression parsing and an algorithm which would
58+
ideally produce a counter-example.
6059

6160
## Bug Reports
6261

ppx_regexp.ml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,20 +108,21 @@ let transform_cases ~loc e cases =
108108
if case.pc_guard <> None then
109109
error ~loc "Guards are not implemented for match%pcre." else
110110
(match case.pc_lhs with
111-
| {ppat_desc = Ppat_constant (Const_string (re_src,_)); ppat_loc = loc} ->
111+
| { ppat_desc = Ppat_constant (Const_string (re_src,_));
112+
ppat_loc = loc; _} ->
112113
let re_str, bs, nG = extract_bindings ~loc re_src in
113114
(try ignore (Re_pcre.regexp re_str) with
114115
| Re_perl.Not_supported -> error ~loc "Unsupported regular expression."
115116
| Re_perl.Parse_error -> error ~loc "Invalid regular expression.");
116117
(Exp.constant (Const_string (re_str, None)), nG, bs, case.pc_rhs)
117-
| {ppat_desc = Ppat_any} ->
118+
| {ppat_desc = Ppat_any; _} ->
118119
error ~loc "Universal wildcard must be the last pattern."
119-
| {ppat_loc = loc} ->
120+
| {ppat_loc = loc; _} ->
120121
error ~loc "Regular expression pattern should be a string.")
121122
in
122123
let cases, default_rhs =
123124
(match List.rev cases with
124-
| {pc_lhs = {ppat_desc = Ppat_any}; pc_rhs} :: cases ->
125+
| {pc_lhs = {ppat_desc = Ppat_any; _}; pc_rhs; _} :: cases ->
125126
(cases, pc_rhs)
126127
| cases ->
127128
let open Lexing in
@@ -175,7 +176,8 @@ let transform_cases ~loc e cases =
175176

176177
let rewrite_expr mapper e_ext =
177178
(match e_ext.pexp_desc with
178-
| Pexp_extension ({txt = "pcre"}, PStr [{pstr_desc = Pstr_eval (e, _)}]) ->
179+
| Pexp_extension ({txt = "pcre"; _},
180+
PStr [{pstr_desc = Pstr_eval (e, _); _}]) ->
179181
let loc = e.pexp_loc in
180182
(match e.pexp_desc with
181183
| Pexp_match (e, cases) ->
@@ -186,7 +188,7 @@ let rewrite_expr mapper e_ext =
186188
error ~loc "[%pcre] only applies to match an function.")
187189
| _ -> default_mapper.expr mapper e_ext)
188190

189-
let rewrite_structure mapper sis =
191+
let rewrite_structure _mapper sis =
190192
let sis' =
191193
default_mapper.structure {default_mapper with expr = rewrite_expr} sis
192194
in

0 commit comments

Comments
 (0)