From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.1 required=5.0 tests=AWL autolearn=disabled version=3.1.3 Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id E26B1BC69 for ; Thu, 2 Aug 2007 12:29:19 +0200 (CEST) Received: from mail-outfwd.lms.be (Kaiserslautern1.lms-gmbh.de [213.68.136.230]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l72ATH0T022950 for ; Thu, 2 Aug 2007 12:29:19 +0200 Received: from localhost (unknown [127.0.0.1]) by mail-outfwd.lms.be (Postfix) with ESMTP id D3D187F484; Thu, 2 Aug 2007 12:50:13 +0200 (CEST) Received: from mail-kl.lmsintl.com ([127.0.0.1]) by localhost (kl-ftp [127.0.0.1]) (amavisd-new, port 20024) with ESMTP id 02933-04; Thu, 2 Aug 2007 12:50:13 +0200 (CEST) Received: from KL-SRV57.lmsintl.com (unknown [10.2.100.57]) by mail-kl.lmsintl.com (Postfix) with ESMTP id C310CB6EC9; Thu, 2 Aug 2007 12:50:13 +0200 (CEST) X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: RE: [SPAM?][Caml-list] Handling include files using ocamllex Date: Thu, 2 Aug 2007 12:29:14 +0200 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [SPAM?][Caml-list] Handling include files using ocamllex Thread-Index: AcfU7VYbu5/F05ThT2CMXQ6XDlZM5QAAZH7g References: <20070802200933.3621fb1a.mle+ocaml@mega-nerd.com> From: "Christoph Bauer" To: "Erik de Castro Lopo" , X-Virus-Scanned: by IT Services X-Miltered: at discorde with ID 46B1B1FD.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ocamllex:01 ocamllex:01 ocamlyacc:01 ocamlyacc:01 lexbuf:01 lexing:01 buffer:01 stack:01 parsing:01 caml-list:01 christoph:04 christoph:04 style:93 scan:06 function:08 > Hi all, >=20 > I doing some simple parsing with ocamllex and ocamlyacc and I=20 > need to be able to handle C style include files. >=20 > I know how to do this in C with flex and bison, but I can't=20 > figure out how to do it with ocamllex and ocamlyacc. >=20 > Anyone know how to do this? A solution could be to create an lexbuf from a function with Lexing.from_function. This function has to manage a stack of open channels and positions. It has to=20 scan for "#include"-statements and copies instead of these statements the contents of the corresponding files into the buffer. Just an idea, I haven't done it yet. Christoph Bauer