X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=pa_bitmatch.ml;h=d10ff6f952dc09709a239f7d78579a31afec9437;hb=18a624e4d05c8e6129cdd107d91222e2a2544a1e;hp=b5e975867810643531ace0b1807f83d4a9872bf7;hpb=d4f8287a45c85630560cc88c67c9dba47ae05f35;p=ocaml-bitstring.git diff --git a/pa_bitmatch.ml b/pa_bitmatch.ml index b5e9758..d10ff6f 100644 --- a/pa_bitmatch.ml +++ b/pa_bitmatch.ml @@ -15,7 +15,7 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * $Id: pa_bitmatch.ml,v 1.7 2008-04-25 10:44:00 rjones Exp $ + * $Id: pa_bitmatch.ml,v 1.8 2008-04-25 11:08:43 rjones Exp $ *) open Printf @@ -688,13 +688,15 @@ EXTEND Gram ]; match_case: [ - [ "_"; + [ "{"; "_"; "}"; bind = OPT [ "as"; name = LIDENT -> name ]; w = OPT [ "when"; e = expr -> e ]; "->"; code = expr -> (Bind bind, w, code) ] - | [ fields = LIST0 field SEP ";"; + | [ "{"; + fields = LIST0 field SEP ";"; + "}"; w = OPT [ "when"; e = expr -> e ]; "->"; code = expr -> (Fields fields, w, code) @@ -703,14 +705,16 @@ EXTEND Gram (* 'bitmatch' expressions. *) expr: LEVEL ";" [ - [ "bitmatch"; bs = expr; "with"; OPT "|"; + [ "bitmatch"; + bs = expr; "with"; OPT "|"; cases = LIST1 match_case SEP "|" -> output_bitmatch _loc bs cases ] (* Constructor. *) - | [ "BITSTRING"; - fields = LIST0 field SEP ";" -> + | [ "BITSTRING"; "{"; + fields = LIST0 field SEP ";"; + "}" -> output_constructor _loc fields ] ];