pdarragh/camlrack

`match%spat` generates incorrect cases for variable repeat patterns

pdarragh opened this issue · 0 comments

S-Expression pattern matches such as the following:

match%spat se with
| "{INTEGER ...}" -> ...

are meant to expand as follows:

match se with
| SExp [] -> ...
| SExp [Integer _] -> ...
| SExp [Integer _; Integer _] -> ...
| SExp subgroup1
  when List.for_all (sexp_match INTEGER) subgroup1 -> ...

but instead they are expanded as:

match se with
| SExp [] -> ...
| SExp [Integer _] -> ...
| SExp [Integer _; Integer _] -> ...
| SExp [SExp subgroup1]
  when List.for_all (sexp_match INTEGER) subgroup1 -> ...