From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id SAA12765; Mon, 22 Oct 2001 18:47:36 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 SAA12452 for ; Mon, 22 Oct 2001 18:47:35 +0200 (MET DST) Received: from localhost.localdomain (jimbo68.zip.com.au [202.7.67.68]) by nez-perce.inria.fr (8.11.1/8.10.0) with ESMTP id f9MGlVH22963 for ; Mon, 22 Oct 2001 18:47:33 +0200 (MET DST) Received: from maxtal.com.au (IDENT:root@localhost [127.0.0.1]) by localhost.localdomain (8.9.3/8.8.7) with ESMTP id CAA01116; Tue, 23 Oct 2001 02:47:02 +1000 Message-ID: <3BD44D86.A9529062@maxtal.com.au> Date: Tue, 23 Oct 2001 02:47:02 +1000 From: John Max Skaller X-Mailer: Mozilla 4.7 [en] (X11; I; Linux 2.2.12-20 i686) X-Accept-Language: en MIME-Version: 1.0 To: Christian Lindig CC: Vesa Karvonen , caml-list@inria.fr Subject: Re: [Caml-list] On ocamlyacc and ocamllex References: <000b01c143aa$d5218690$422aa8c0@housemarque.fi> <20010922211013.A580@eecs.harvard.edu> <001501c1444c$a7b0a720$422aa8c0@housemarque.fi> <20010923134425.A28129@lakeland.eecs.harvard.edu> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Christian Lindig wrote: > You can pass the map to the lexer such that it does not has to be > global: > > rule token = parse > eof { fun map -> P.EOF } > | ws+ { fun map -> token lexbuf map } > | tab { fun map -> tab lexbuf map; token lexbuf map } > | nl { fun map -> nl lexbuf map ; token lexbuf map } > | nl '#' { fun map -> line lexbuf map 0; token lexbuf map } > .... I use this technique, works fine. Pass an (OO style) object. A bit boring writing 'fun map ->' in front of everything, but it works. -- John (Max) Skaller, mailto:skaller@maxtal.com.au 10/1 Toxteth Rd Glebe NSW 2037 Australia voice: 61-2-9660-0850 New generation programming language Felix http://felix.sourceforge.net Literate Programming tool Interscript http://Interscript.sourceforge.net ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr