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 D726DBC6C for ; Tue, 13 Sep 2005 00:31:29 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j8CMVS1t019217 for ; Tue, 13 Sep 2005 00:31:29 +0200 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id AAA07040 for ; Tue, 13 Sep 2005 00:31:27 +0200 (MET DST) Received: from mail.rsise.anu.edu.au (mail.rsise.anu.edu.au [150.203.208.4]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j8CMVNEo021998 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO) for ; Tue, 13 Sep 2005 00:31:26 +0200 Received: from localhost (localhost [127.0.0.1]) by mail.rsise.anu.edu.au (Postfix) with ESMTP id 9BEB6201D3; Tue, 13 Sep 2005 08:31:16 +1000 (EST) Received: from mail.rsise.anu.edu.au ([150.203.208.4]) by localhost (mail [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 24426-02; Tue, 13 Sep 2005 08:31:16 +1000 (EST) Received: from pulp.rsise.anu.edu.au (pulp.rsise.anu.edu.au [150.203.208.49]) by mail.rsise.anu.edu.au (Postfix) with ESMTP id 882591E521; Tue, 13 Sep 2005 08:31:11 +1000 (EST) Received: by pulp.rsise.anu.edu.au (Postfix, from userid 1560) id 7CB1B2962AC; Tue, 13 Sep 2005 08:31:09 +1000 (EST) Date: Tue, 13 Sep 2005 08:31:09 +1000 From: Pietro Abate To: caml-list@yquem.inria.fr, caml-list Subject: Re: [Caml-list] camlp4 char stream Message-ID: <20050912223109.GA11662@pulp.anu.edu.au> Mail-Followup-To: Pietro Abate , caml-list@yquem.inria.fr, caml-list References: <43249158.4070900@univ-savoie.fr> <43251497.1090905@univ-savoie.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <43251497.1090905@univ-savoie.fr> X-Operating-System: GNU/Linux X-Organization: Research School of Information Science and Engineering (Australian National University) User-Agent: Mutt/1.5.10i X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at mail.rsise.anu.edu.au X-Miltered: at nez-perce with ID 432601C1.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 432601BB.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; anu:01 caml-list:01 char:01 caml-list:01 strm:01 parser:01 christophe:01 raffalli:01 grammar:01 parser:01 strm:01 npeek:01 char:01 tews: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 If I understand you problem correctly, here there is a small example to parse string of the type TEST ------ END where ----- can be whatever you want. http://caml.inria.fr/pub/ml-archives/caml-list/2005/07/244afe98fd8ddfb6aff6f0bcda52d9ac.en.html read the thread further as you need to add Stream.junk strm to the function test. this way you can basically switch to an other parser (to parse "----" ) and get back to camlp4. hope it helps. :) p On Mon, Sep 12, 2005 at 07:39:35AM +0200, Christophe Raffalli wrote: > > OK, I found it (quote from your tutorial): > > let operator_rparen = > Grammar.Entry.of_parser gram "operator_rparen" > (fun strm -> > match Stream.npeek 2 strm with > | [("", s); ("", ")")] when is_operator s -> > begin > Stream.junk strm; > Stream.junk strm; > s > end > | _ -> raise Stream.Failure) > > OK, I read your tutorial, but did not get the point ... thks > > and what is the first member of the tuple ? > Why is the second member a string and not a char ? > > > > >See paragraph "Do it yourself" at > >http://wwwtcs.inf.tu-dresden.de/~tews/ocamlp4/camlp4-undoc.html#power > > > > > > > >Martin > > > >-- > >Martin Jambon, PhD > >http://martin.jambon.free.fr > > _______________________________________________ > 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 -- ++ Blog: http://blog.rsise.anu.edu.au/?q=pietro ++ ++ "All great truths begin as blasphemies." -George Bernard Shaw ++ Please avoid sending me Word or PowerPoint attachments. See http://www.fsf.org/philosophy/no-word-attachments.html