English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
Camlp4: How to reset a Camlp4Syntax into pristine state?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2008-04-08 (12:32)
From: Nicolas Pouillard <nicolas.pouillard@g...>
Subject: Re: [Caml-list] Camlp4: How to reset a Camlp4Syntax into pristine state?
Excerpts from Hendrik Tews's message of Mon Apr 07 23:05:38 +0200 2008:
> Hi,
> I want to reuse a Camlp4Syntax module (obtained from
> Camlp4.OCamlInitSyntax.Make) for parsing different files with
> possibly different parsers or extensions loaded. How do I reset a
> Camlp4Syntax module into its initial state such that it is ready
> to get applied to the next set of syntax extensions for the next
> file to parse?

You  have  to  make  a  functor  that  clears  all entries of the grammar. All
entries  for  the OCaml likes grammars are in camlp4/Camlp4/OCamlInitSyntax.ml
and you can clear them with Gram.Entry.clear.

Nicolas Pouillard aka Ertai