From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 03AA6D55E for ; Thu, 28 Jul 2005 03:27:34 +0200 (CEST) Received: from smtpout.mac.com (smtpout.mac.com [17.250.248.84]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j6S1RW5s013635 for ; Thu, 28 Jul 2005 03:27:33 +0200 Received: from mac.com (smtpin08-en2 [10.13.10.153]) by smtpout.mac.com (Xserve/8.12.11/smtpout08/MantshX 4.0) with ESMTP id j6S1RUNk029780; Wed, 27 Jul 2005 18:27:30 -0700 (PDT) Received: from [192.168.0.100] (dsl092-032-215.lax1.dsl.speakeasy.net [66.92.32.215]) (authenticated bits=0) by mac.com (Xserve/smtpin08/MantshX 4.0) with ESMTP id j6S1RStd022041 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NO); Wed, 27 Jul 2005 18:27:30 -0700 (PDT) In-Reply-To: <2787337705072700045a275ce6@mail.gmail.com> References: <3FA9259E-584B-45D7-BACD-A648222E5A0B@mac.com> <42E58F35.8070204@crans.org> <0C774C67-0FD2-49F3-9293-B81BB3A0991E@mac.com> <2787337705072700045a275ce6@mail.gmail.com> Mime-Version: 1.0 (Apple Message framework v733) Content-Type: text/plain; charset=ISO-8859-1; delsp=yes; format=flowed Message-Id: <5A709F2F-1728-4904-BAC2-C2E9CC5A3AA9@mac.com> Cc: caml-list@yquem.inria.fr Content-Transfer-Encoding: quoted-printable From: Paul Snively Subject: Re: [Caml-list] Question re: camlp4 parser Date: Wed, 27 Jul 2005 18:27:11 -0700 To: virgile.prevosto@m4x.org X-Pgp-Agent: GPGMail 1.1.1 (Tiger) X-Gpgmail-State: signed X-Mailer: Apple Mail (2.733) X-Miltered: at nez-perce with ID 42E83485.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 parser:01 hash:01 'when':01 buf:01 buffer:01 rec:01 parser:01 buffer:01 char:01 buf:01 char:01 bool:01 caml-list:01 beginner's:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Jul 27, 2005, at 12:04 AM, Virgile Prevosto wrote: > As any other pattern, stream patterns can be refined with a 'when' =20 > condition: > > let printable s =3D > let buf =3D Buffer.create 100 in > let rec aux =3D parser > | [< '' '..'~' as c when c <> '=3D' && c <> '['; > x =3D (Buffer.add_char buf c; aux) >] -> x > | [< >] -> Buffer.contents buf > in aux s ;; > > should do the trick. It might not be that convenient for a more > complex set of excluded characters, but it is possible to write a char > -> bool test outside of the stream parser. > Of course: it's all becoming quite clear now. Thanks for the =20 excellent suggestion and your patience with my na=EFvete. :-) > --=20 > E tutto per oggi, a la prossima volta > Virgile > > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs Best regards, Paul Snively -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (Darwin) iEYEARECAAYFAkLoNH8ACgkQO3fYpochAqI94gCfXosjSfFZAbtanYQstgCjYLfY HqUAoIWd4QpsWhynHyj8A6WJDqWOP61B =3DBKDa -----END PGP SIGNATURE-----