From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: weis Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id QAA05131 for caml-redistribution; Wed, 2 Feb 2000 16:03:57 +0100 (MET) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id DAA30986 for ; Tue, 1 Feb 2000 03:17:19 +0100 (MET) Received: from www.nextsolution.co.jp (www.nextsolution.co.jp [202.33.212.2]) by nez-perce.inria.fr (8.8.7/8.8.7) with ESMTP id DAA23614 for ; Tue, 1 Feb 2000 03:17:13 +0100 (MET) Received: from sparc1.nextsolution.co.jp (sparc1 [202.235.80.1]) by www.nextsolution.co.jp (8.9.3/3.7W) with SMTP id LAA12694 for ; Tue, 1 Feb 2000 11:13:58 +0900 (JST) Received: from sparc1.nextsolution.co.jp by sparc1.nextsolution.co.jp (SMI-8.6/SMI-SVR4) id LAA03143; Tue, 1 Feb 2000 11:16:49 +0900 From: "Frank A. Christoph" To: "CAML List" Subject: Stream parsers, again Date: Tue, 1 Feb 2000 11:19:18 +0900 Message-ID: <000001bf6c5a$be528a00$0150ebca@nextsolution.co.jp> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook 8.5, Build 4.71.2173.0 Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600 Sender: weis Regarding my previous message, I just figured out that it is actually quite easy to get "midstream" counts. Define this: let count = parser bp [< >] -> bp and then you can insert it in critical places like the example I gave: parser [< e = p; i = count; e' = p' ? err i >] -> ... BTW, it is nice that the error expression is itself lazily evaluated. I think it is too restrictive that it needs to return a string rather than an arbitrary type, but fortunately you can just raise an exception from within the stream error exception itself: exception Err of int let err cnt = raise (Err cnt) --fac