Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
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