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 CAA12853 for caml-redistribution; Sat, 1 Jan 2000 02:32:10 +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 UAA08284 for ; Thu, 30 Dec 1999 20:08:20 +0100 (MET) Received: from ruby (itchy39.zip.com.au [61.8.12.39]) by nez-perce.inria.fr (8.8.7/8.8.7) with ESMTP id UAA00819 for ; Thu, 30 Dec 1999 20:08:14 +0100 (MET) Received: from maxtal.com.au (IDENT:root@localhost [127.0.0.1]) by ruby (8.9.3/8.9.3) with ESMTP id GAA07874; Fri, 31 Dec 1999 06:09:39 +1100 Sender: weis Message-ID: <386BADF3.80F07395@maxtal.com.au> Date: Fri, 31 Dec 1999 06:09:39 +1100 From: skaller Organization: Maxtal X-Mailer: Mozilla 4.51 [en] (X11; I; Linux 2.2.12 i586) X-Accept-Language: en MIME-Version: 1.0 To: frouaix@liquidmarket.com CC: caml-list@inria.fr Subject: Re: ocamlyacc/lex reentrancy References: <199912301830.KAA12278@fiji01.liquidmarket.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Francois Rouaix wrote: > > I don't use ocamlyacc, but I do have lots of ocamllex lexers that need > to be reentrant. I don't remember if I've posted that trick to the list > already, but this is what you can do: > > In your opening section of the lexer: > > { > type t = > > let create_data () = .... (* unit -> t *) > > } > > and then for all rules, use > > rule somerule = parse > | somepattern { (fun lexdata -> action) } > > And, when invoking a lexer function or entry point, you need to pass the > additionnal argument, a in > somerule lexbuf lexdata Ahhhh! Thank you. I see how this works. -- John Skaller, mailto:skaller@maxtal.com.au 10/1 Toxteth Rd Glebe NSW 2037 Australia homepage: http://www.maxtal.com.au/~skaller voice: 61-2-9660-0850