From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 4A1B0BB88 for ; Wed, 20 Jul 2005 09:37:51 +0200 (CEST) Received: from mail.tcs.inf.tu-dresden.de (tcs01.inf.tu-dresden.de [141.76.75.1]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j6K7boZ5023042 for ; Wed, 20 Jul 2005 09:37:51 +0200 Received: from conversion-daemon.mail.tcs.inf.tu-dresden.de by mail.tcs.inf.tu-dresden.de (Sun Java System Messaging Server 6.1 HotFix 0.06 (built Nov 11 2004)) id <0IJX00G0110I9S00@mail.tcs.inf.tu-dresden.de> (original mail from tews@tcs.inf.tu-dresden.de) for caml-list@yquem.inria.fr; Wed, 20 Jul 2005 09:37:50 +0200 (MEST) Received: from ithif59.inf.tu-dresden.de (ithif59.inf.tu-dresden.de [141.76.75.59]) by mail.tcs.inf.tu-dresden.de (Sun Java System Messaging Server 6.1 HotFix 0.06 (built Nov 11 2004)) with ESMTPS id <0IJX0081Z172AD10@mail.tcs.inf.tu-dresden.de> for caml-list@yquem.inria.fr; Wed, 20 Jul 2005 09:37:50 +0200 (MEST) Received: from tews by ithif59.inf.tu-dresden.de with local (Exim 4.50) id 1Dv99K-00025Y-J2 for caml-list@yquem.inria.fr; Wed, 20 Jul 2005 09:37:50 +0200 Date: Wed, 20 Jul 2005 09:37:50 +0200 From: Hendrik Tews Subject: Re: [Caml-list] camlp4 help In-reply-to: <20050719052321.GA23096@pulp.anu.edu.au> To: caml-list@yquem.inria.fr Message-id: MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT References: <20050715083901.GA24763@pulp.anu.edu.au> <20050719052321.GA23096@pulp.anu.edu.au> User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 X-Miltered: at nez-perce with ID 42DDFF4E.002 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; hendrik:01 tews:01 tews:01 caml-list:01 anu:01 recognizes:01 grammar:01 parser:01 grammar:01 parsing:01 parsing:01 tokens:01 strm:01 strm:01 prerr: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 Pietro Abate writes: However, for some reasons, it doesn't work as expected. The function test correctly recognizes the string "-----" but then I get a Stream.Error from nowhere ( guess from Grammar.Entry.of_parser ) and the parsin fails... Your test function is _not_ an oracle that guards an camlp4 grammar rule. Instead test is kind of a parsing function itself. Consequently, if parsing succeeds you have to discard some tokens: let test rex strm = match Stream.peek strm with | Some(_,s) when s =~ rex -> prerr_endline "!!!!" ; Stream.junk strm | _ -> raise Stream.Failure ;; #ocamlfind ocamlc -package str -c -pp "camlp4o -I . pa_extend.cmo q_MLast.cmo " -I /usr/lib/ocaml/3.08.3/camlp4 te.ml I've never used ocamlfind, but why not ocamlfind ocamlc -package str -c -pp "camlp4o pa_extend.cmo q_MLast.cmo " \ -I +camlp4 te.ml (deleted "-I ." and use "-I +camlp4") ? Bye, Hendrik