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.0 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 2CEB5BC37 for ; Wed, 1 Jul 2009 17:44:00 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AngBAJghS0qLEwExkWdsb2JhbACZCAEBAQEJCwoHEwWle5BzBYQQ X-IronPort-AV: E=Sophos;i="4.42,324,1243807200"; d="scan'208";a="29103321" Received: from hera.mpi-sb.mpg.de ([139.19.1.49]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/AES256-SHA; 01 Jul 2009 17:43:41 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mpi-sb.mpg.de; s=mail200803; h=Message-ID:Date:From: MIME-Version:To:CC:Subject:References:In-Reply-To:Content-Type: Content-Transfer-Encoding; bh=B2APp21wi0j5QAkJvdNixpC/tfnToL54dN KGUsl72l4=; b=jYRI8zE7ERPfbJ1XFpSdW/ezNVYgTAhoy7lr1mTlAk3l8cW1Of 6+Z91Wob25doEXqeXTRz6tybPefDgAWoGtPp7/FK5qdY0JfPNHyHROCSu6seaJIa NxSwmesYxqInBqEffOdCXjTw9nBD/QE44Hcdc03nR1YpsW0W+jQ3jM7YU= Received: from infao0710.mpi-sb.mpg.de ([139.19.1.28]:41196 helo=newzak.mpi-sb.mpg.de) by hera.mpi-sb.mpg.de (envelope-from ) with esmtp (Exim 4.69) id 1MM1yB-0001jy-68; Wed, 01 Jul 2009 17:43:39 +0200 Received: from swsao0703.ds.mpi-sws.mpg.de ([139.19.131.41]:50372) by newzak.mpi-sb.mpg.de with esmtpsa (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.63) (envelope-from ) id 1MM1yA-0000DG-O3; Wed, 01 Jul 2009 17:43:34 +0200 Message-ID: <4A4B8426.9050407@mpi-sws.org> Date: Wed, 01 Jul 2009 17:43:34 +0200 From: Andreas Rossberg User-Agent: Mozilla-Thunderbird 2.0.0.17 (X11/20081019) MIME-Version: 1.0 To: Martin Jambon Cc: Sylvain Le Gall , caml-list@inria.fr Subject: Re: [Caml-list] Re: ocamllex and python-style indentation References: <7d8707de0906110557n6a1511a2k9f4f00827f954cb6@mail.gmail.com> <4A310A5B.9010404@ens-lyon.org> <7d8707de0906120120x10cc8fe0p54adbd189003f3da@mail.gmail.com> <1750DDE9-4FC6-4657-9687-58240F520A70@mpi-sws.org> <2a1a1a0c0906301913t1dce3eebie91c7cc94f015481@mail.gmail.com> <2a1a1a0c0907010702u19ad7ba6kd831a71fa1b7f2a5@mail.gmail.com> <4A4B700D.3060701@mpi-sws.org> <4A4B7E7F.3040908@ens-lyon.org> In-Reply-To: <4A4B7E7F.3040908@ens-lyon.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; rossberg:01 rossberg:01 ocamllex:01 lexbuf:01 lexbuf:01 ocamllex:01 wrote:01 wrote:01 andreas:01 andreas:01 caml-list:01 jambon:01 lex:01 lex:01 parse:02 Martin Jambon wrote: > You can even get rid of global variables completely: > > > rule lex x = parse > eof { () } > | "(*" { x.start <- pos lexbuf; lexNestComment x lexbuf; lex x lexbuf } > > and lexNestComment x = parse > eof { error (loc x 2) "unterminated comment" } > | "(*" { lexNestComment x lexbuf } > | "*)" { () } > | _ { lexNestComment x lexbuf } > Nicer indeed. To my defense I have to say that I wrote the code long before rule arguments were introduced into ocamllex - I said it was really old... :-) - Andreas