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=HTML_MESSAGE 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 91416BB84 for ; Mon, 30 Jun 2008 19:46:59 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApwEAC65aEjAXQIn/2dsb2JhbACCc49Dmm6EPQ X-IronPort-AV: E=Sophos;i="4.27,728,1204498800"; d="scan'208";a="12682561" Received: from concorde.inria.fr ([192.93.2.39]) by mail2-smtp-roc.national.inria.fr with ESMTP; 30 Jun 2008 19:46:58 +0200 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id m5UHkwGD021020 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Mon, 30 Jun 2008 19:46:58 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AmoAAC65aEjY7zq5f2dsb2JhbACCc49DQwEBCwUCBgcRmXmEPQ X-IronPort-AV: E=Sophos;i="4.27,728,1204498800"; d="scan'208";a="14596285" Received: from gv-out-0910.google.com ([216.239.58.185]) by mail1-smtp-roc.national.inria.fr with ESMTP; 30 Jun 2008 19:46:58 +0200 Received: by gv-out-0910.google.com with SMTP id s4so163677gve.28 for ; Mon, 30 Jun 2008 10:46:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:mime-version:content-type; bh=clK4yPEJ5x0Nagh4V+hmQ35rjI12ZR4vETfUHP1Eryw=; b=rAmiruElFde9bki3JvjmjLYqE3Jb8L52nAW4diuARkRVlu5MjU6MwihIWUMYFqr+lB neGWhEcqRUgfJLi0Jj3Ct+pcCmkAtP8mDjzXB6NB2mgXJYdApIp7twRod/fHOmAojhn8 0Q3hXUx3DL/3b63jRhmKvAw+cdENrQyoUNF/w= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type; b=jJPRIqJpXP6ErF1azjrloLcidF3mh0x86HhPXUoFfu6xB8i5WWkmrIhLyqrrhgfzL4 QYHwW/Sdj4UvmvV7eIRvTWE2O95vHtA88l7QI2ELUPsZWiTjPPTzYEGsXCf3pXWgOt9e m+mYGDIPSksjS+CysYXu8yyRzB6cliM6rZUA0= Received: by 10.125.164.7 with SMTP id r7mr1148086mko.161.1214848017528; Mon, 30 Jun 2008 10:46:57 -0700 (PDT) Received: by 10.125.166.9 with HTTP; Mon, 30 Jun 2008 10:46:57 -0700 (PDT) Message-ID: <982cea130806301046p48b54dd5l23e81c703cb26b68@mail.gmail.com> Date: Mon, 30 Jun 2008 20:46:57 +0300 From: "dream.designer" To: caml-list@inria.fr Subject: CamlP4 lexer problem MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_15813_17287485.1214848017519" X-Miltered: at concorde with ID 48691C12.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; camlp:01 lexer:01 syntax:01 tokens:01 syntax:01 reproduces:01 camlp:01 expr:01 expr:01 tokens:01 reproduces:01 token:01 token:01 int:01 int:01 ------=_Part_15813_17287485.1214848017519 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hello everyone. I'm trying to write a syntax extension that introduces two new tokens "[%" and "%]". But I'm getting a syntax error if token ")" follows token "%]". Could anybody help me please? Here's the minimal syntax extension code that reproduces the issue: =================================================================== open Camlp4.PreCast open Syntax EXTEND Gram expr: [ [ "[%"; e = expr LEVEL "simple"; "%]" -> e ] ] ; END ;; =================================================================== Usage sample: =================================================================== # [% 5 %] ;; - : int = 5 # ([% 5 %]) ;; Characters 6-9: ([% 5 %]);; ^^^ Parse error: [expr level simple] expected after "[%" (in [expr]) =================================================================== Thanks in advance. -- vadim.shender@gmail.com ------=_Part_15813_17287485.1214848017519 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hello everyone.

I'm trying to write a syntax extension that introduces two new tokens "[%" and "%]". But I'm getting a syntax error if token ")" follows token "%]". Could anybody help me please?

Here's the minimal syntax extension code that reproduces the issue:
===================================================================
open Camlp4.PreCast
open Syntax

EXTEND Gram
  expr:
    [ [ "[%"; e = expr LEVEL "simple"; "%]" -> e ] ] ;
END ;;
===================================================================

Usage sample:
===================================================================
# [% 5 %] ;;
- : int = 5

# ([% 5 %]) ;;
Characters 6-9:
  ([% 5 %]);;
        ^^^
Parse error: [expr level simple] expected after "[%" (in [expr])

===================================================================

Thanks in advance.

--
vadim.shender@gmail.com
------=_Part_15813_17287485.1214848017519--