From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 F3436BCAE for ; Sun, 26 Jun 2005 15:52:53 +0200 (CEST) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.194]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j5QDqrPL021854 for ; Sun, 26 Jun 2005 15:52:53 +0200 Received: by wproxy.gmail.com with SMTP id i21so214527wra for ; Sun, 26 Jun 2005 06:52:52 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=BzYYxX4XmPyydbUBJ0yxMjsc7wxSDLf9NKiRb3/zJr98ZTqRbQ8d/CHGbjp/X3j4nWd5MlEReywHIop/2aPZd/QTlGn0XBY2dAbsshCWfo/M4TBBX19xNnqA3xlz9vlXKvU7frGKBhVlcY5dwCZsyQ+qtx3L1TekwajdFGM6w8U= Received: by 10.54.15.15 with SMTP id 15mr569618wro; Sun, 26 Jun 2005 06:52:52 -0700 (PDT) Received: by 10.54.143.17 with HTTP; Sun, 26 Jun 2005 06:52:52 -0700 (PDT) Message-ID: <27873377050626065224e12c67@mail.gmail.com> Date: Sun, 26 Jun 2005 15:52:52 +0200 From: Virgile Prevosto Reply-To: virgile.prevosto@m4x.org To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Stream parser/make_lexer In-Reply-To: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: X-Miltered: at nez-perce with ID 42BEB335.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 parser:01 lexer:01 parser:01 'string:01 stdin:01 char:01 lexer:01 foo:01 notation:01 genlex:01 token:01 genlex:01 'string:01 26,:98 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_BY_IP autolearn=disabled version=3.0.2 X-Spam-Level: Hello, 2005/6/26, Sen Horak : > let parse =3D parser > [<'Kwd "name=3D";'String t>] -> wm#setname t > | ... >=20 > let istream =3D of_channel stdin > The program exits with a Stream.Failure exception. The "stream > builders" documentation clearly says that we are not to mix the of_* > functions to build streams with <> streams - so I guess this is > expected. Although I've come across some examples that use of_string > to build the char stream and use the lexer on it. >=20 I can be wrong, but I think that the documentation prohibits stuff like let s =3D Stream.of_string "foo" in [< s; s >], that is building a stream with both the of_* functions and the [< >] notation. This is not the case here, since [< >] is used only for pattern matching. Concerning your original problem, I think that the main issue is that "name=3D" is not a valid keyword for lexer. Try to split it in "name" and "=3D" (cf documentation of Genlex.token), i.e. do something like let lexer =3D Genlex.make_lexer ["name"; "=3D"; ...] let parse =3D parser [< 'Kwd "name"; 'Kwd "=3D"; 'String t >] -> ...=20 --=20 E tutto per oggi, a la prossima volta Virgile