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 E4F53BCAE for ; Mon, 27 Jun 2005 13:24:40 +0200 (CEST) Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.199]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j5RBOeSY013582 for ; Mon, 27 Jun 2005 13:24:40 +0200 Received: by zproxy.gmail.com with SMTP id s18so165129nze for ; Mon, 27 Jun 2005 04:24:39 -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:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=a+WPqHo1n7mVEsI46vyIwSPCeh1rse/NCKlOSHexB2KBdsj7d3GUjo3oVjCXaE/gi85WxbO0H8hzUm0fWjyaVbQYiEemNzC4hJOqrwFgDbbYklcJKzyX2luJ1pxEpeDcRUXM6RMtw9v1UbNpPtvA5qY4+/czvv0GkH604g6mdh4= Received: by 10.36.222.40 with SMTP id u40mr4418133nzg; Mon, 27 Jun 2005 04:24:39 -0700 (PDT) Received: by 10.36.79.1 with HTTP; Mon, 27 Jun 2005 04:24:39 -0700 (PDT) Message-ID: Date: Mon, 27 Jun 2005 13:24:39 +0200 From: Sen Horak Reply-To: Sen Horak To: virgile.prevosto@m4x.org Subject: Re: [Caml-list] Stream parser/make_lexer Cc: caml-list@yquem.inria.fr In-Reply-To: <27873377050626065224e12c67@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <27873377050626065224e12c67@mail.gmail.com> X-Miltered: at nez-perce with ID 42BFE1F8.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 parser:01 lexer:01 'string:01 'string:01 parser:01 stdin:01 char:01 lexer:01 foo:01 notation:01 genlex:01 token:01 genlex:01 caml-list:01 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: Hi, Thanks for this. Your answer fixed the problem. Additionally, i was wrongly using 'String instead of 'Ident. 'String it appears, is for quoted text - which of course is in the manual. My bad. SH On 6/26/05, Virgile Prevosto wrote: > Hello, > 2005/6/26, Sen Horak : > > let parse =3D parser > > [<'Kwd "name=3D";'String t>] -> wm#setname t > > | ... > > > > 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. >=20 > 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 > -- > E tutto per oggi, a la prossima volta > Virgile >=20 > _______________________________________________ > 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 >