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.6 required=5.0 tests=HTML_00_10,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 mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 13B1BBBC1 for ; Thu, 24 Apr 2008 14:47:30 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AiMFACQeEEjRVciudGdsb2JhbACCMjiOagEMAwQGBw8Flh+FIA X-IronPort-AV: E=Sophos;i="4.25,704,1199660400"; d="scan'208";a="25440498" Received: from wf-out-1314.google.com ([209.85.200.174]) by mail4-smtp-sop.national.inria.fr with ESMTP; 24 Apr 2008 14:47:29 +0200 Received: by wf-out-1314.google.com with SMTP id 25so2562718wfa.15 for ; Thu, 24 Apr 2008 05:47:27 -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=CDRogz11Kghpz7XyoK6IpKoR5WJhDwCFq8stYq7QFSc=; b=Ltzvs9wlEN3PpmJhxqEtMweKVnp9f9U5Lt7n6Tt7RJ/7VYNIHhvx27S8M2Jhyj9SNm5b+0M8sW2bPJv6ykWeGrPAMdp9paqk7UB45iNoivP8c9NjdgxX4Z0Dp8bdS4CK94WAiOrbazU+Om+g1Kk5X8HciAMXmZcQDRLCOXXR/cY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type; b=SgmNytQnEsE+BoRiwCVfMvOK5ptmr/mvbDnPN6EjFV6TFxJ49duk9zUQdC1oz/JFSVH6OdA6v6NWc0/mp28qcn/YJHw8ph40rkjnI+qquqSrwMgENkRp+EUYoQetT77Ly5cuU1OeJF/jqrcsfU4MjTQLvUidDmcUKL1g25TB0eA= Received: by 10.142.102.5 with SMTP id z5mr469930wfb.85.1209041247293; Thu, 24 Apr 2008 05:47:27 -0700 (PDT) Received: by 10.143.18.10 with HTTP; Thu, 24 Apr 2008 05:47:26 -0700 (PDT) Message-ID: <7c835afc0804240547o2bae6f31wc53afde417a52636@mail.gmail.com> Date: Thu, 24 Apr 2008 14:47:26 +0200 From: "Sham K" To: caml-list@yquem.inria.fr Subject: Error location in Camlp4 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_495_3903755.1209041247276" X-Spam: no; 0.00; camlp:01 parser:01 camlp:01 lexer:01 lexer:01 parser:01 syntax:01 syntax:01 plexer:01 plexer:01 token:01 token:01 abstract:01 abstract:01 complains:01 ------=_Part_495_3903755.1209041247276 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hello Everyone, I have written a tokenizer (using parser constructs in camlp4) which tokenizes a character stream of a string. I use this to define a lexer (using Token.lexer_func_of_parser) as shown in turorials and manuals on camlp4. Then I make use of EXTEND statements to interpret token stream to according to some syntax to build some Abstract syntax tree. All this works fine. However, whenever there is error I just get "Stdpp.Exc_located" with no indications of the location of error. (It is just (_,_) ) The camlp4 manual says that in the action part of rules, a variable loc is always defined which can be used to raise errors. But the complier complains that loc is not defined when I try to use loc in try ... with statements. Can someone explain how I can print error locations. It works with standard lexer plexer, but not with my lexer. I do not quite see what else I should include in my lexer to enable error location reporting. Thanks for your time. Sham ------=_Part_495_3903755.1209041247276 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hello Everyone,

I have written a tokenizer (using parser constructs in camlp4) which tokenizes a character stream of a string. I use this to define a lexer (using Token.lexer_func_of_parser) as shown in turorials and manuals on camlp4. Then I make use of EXTEND statements to interpret token stream to
according to  some syntax to build some Abstract syntax tree.

All this works fine. However, whenever there is error I just get "Stdpp.Exc_located" with no indications of the location of error. (It is just (_,_) )

The camlp4 manual says that in the action part of rules, a variable loc is always defined which can be used to raise errors.
But the complier complains that loc is not defined when I try to use loc in try ... with statements.

Can someone explain how I can print error locations. It works with standard lexer plexer, but not with my lexer. I do not quite
see what else I should include in my lexer to enable error location reporting.

Thanks for your time.
Sham

------=_Part_495_3903755.1209041247276--