Version française
Home     About     Download     Resources     Contact us    
Browse thread
camlp4 3.10: What should this look like?
[ 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 3.10: What should this look like?
On 5/21/07, Joel Reymont <joelr1@gmail.com> wrote:
> What should this look like in the new camlp4 syntax?

Something like (not tested):

open Camlp4.PreCast;;
open Syntax;;
EXTEND Gram
   expr: LEVEL "top" [
     [ "PGSQL"; "("; dbh = expr; ")"; extras = LIST1 STRING ->
         let query, flags =
           match List.rev extras with
           | [] -> assert false
           | query :: flags -> query, flags in
         pgsql_expand ~flags loc dbh (Camlp4.Struct.Token.Eval.string query)
     ]
   ];
END

-- 
Nicolas Pouillard