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=none autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 92A1CBC69 for ; Fri, 13 Apr 2007 10:27:42 +0200 (CEST) Received: from out4.smtp.messagingengine.com (out4.smtp.messagingengine.com [66.111.4.28]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l3D8RfqO000959 for ; Fri, 13 Apr 2007 10:27:42 +0200 Received: from compute1.internal (compute1.internal [10.202.2.41]) by out1.messagingengine.com (Postfix) with ESMTP id 0759021542A for ; Fri, 13 Apr 2007 04:27:47 -0400 (EDT) Received: from heartbeat2.messagingengine.com ([10.202.2.161]) by compute1.internal (MEProxy); Fri, 13 Apr 2007 04:27:40 -0400 X-Sasl-enc: eiSEkZ96DxbP1Xwivob1Cfm381tCGrZfKNzkXX+3pGH9 1176452859 Received: from adsl-75-42-174-22.dsl.sndg02.sbcglobal.net (adsl-75-42-174-22.dsl.sndg02.sbcglobal.net [75.42.174.22]) by mail.messagingengine.com (Postfix) with ESMTP id 8465610843 for ; Fri, 13 Apr 2007 04:27:39 -0400 (EDT) Date: Fri, 13 Apr 2007 01:27:24 -0700 (PDT) From: Martin Jambon X-X-Sender: martin@droopy To: caml-list@inria.fr Subject: New Camlp4 behavior (problem with rules starting with OPT) Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Miltered: at concorde with ID 461F3EFE.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ens-lyon:01 camlp:01 camlp:01 syntax:01 ocamlc:01 -pp:01 syntax:01 mut:01 mutable:01 lident:01 cmo:01 cmo:01 lident:01 mut:01 mutable:01 With camlp4 3.10.0+beta, the following syntax extension does not work, but it used to work in the "old" camlp4. File pa_toto.ml: ---------------- (* ocamlc -c -I +camlp4 -pp camlp4orf pa_toto.ml *) open Camlp4.PreCast open Syntax EXTEND Gram GLOBAL: str_item; str_item: LEVEL "top" [ [ "TEST"; "{"; l = item_list; "}" -> <:str_item< >> ] ]; item_list: [ [ x = item; ";"; l = SELF -> x :: l | x = item; ";" -> [x] | x = item -> [x] ] ]; item: [ [ mut = OPT "mutable"; name = LIDENT -> () ] ]; END File toto.ml: ------------- (* camlp4o -parser pa_toto.cmo -printer o toto.ml *) TEST { a; b; } camlp4o -parser pa_toto.cmo -printer o toto.ml File "toto.ml", line 3, characters 11-12: Parse error: LIDENT _ expected (in [item]) This points to the second ";". One possible fix consists in getting rid of the leading OPT. It's how it's done in Camlp4OCamlParser.ml (label_declaration): Before: ------- item: [ [ mut = OPT "mutable"; name = LIDENT -> () ] ]; After: ------ item: [ [ "mutable"; name = LIDENT -> () | name = LIDENT -> () ] ]; I don't know if it's a bug or a new "feature", but this is definitely annoying. Could the old behavior be restored? Thanks Martin -- Martin Jambon http://martin.jambon.free.fr