caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* camlp4 3.10: What should this look like?
@ 2007-05-21  8:43 Joel Reymont
  2007-05-21  9:26 ` [Caml-list] " Nicolas Pouillard
  0 siblings, 1 reply; 4+ messages in thread
From: Joel Reymont @ 2007-05-21  8:43 UTC (permalink / raw)
  To: OCaml List

What should this look like in the new camlp4 syntax?

EXTEND
   Pcaml.expr: LEVEL "expr1" [
     [ "PGSQL"; "("; dbh = Pcaml.expr; ")"; extras = LIST1 STRING ->
         let query, flags =
           match List.rev extras with
           | [] -> assert false
           | query :: flags -> query, flags in
         pgsql_expand ~flags loc dbh (Token.eval_string loc query)
     ]
   ];
END

	Thanks, Joel

--
http://wagerlabs.com/






^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Caml-list] camlp4 3.10: What should this look like?
  2007-05-21  8:43 camlp4 3.10: What should this look like? Joel Reymont
@ 2007-05-21  9:26 ` Nicolas Pouillard
  2007-05-21  9:56   ` Joel Reymont
  0 siblings, 1 reply; 4+ messages in thread
From: Nicolas Pouillard @ 2007-05-21  9:26 UTC (permalink / raw)
  To: Joel Reymont; +Cc: OCaml List

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Caml-list] camlp4 3.10: What should this look like?
  2007-05-21  9:26 ` [Caml-list] " Nicolas Pouillard
@ 2007-05-21  9:56   ` Joel Reymont
  2007-05-21 10:44     ` Nicolas Pouillard
  0 siblings, 1 reply; 4+ messages in thread
From: Joel Reymont @ 2007-05-21  9:56 UTC (permalink / raw)
  To: Nicolas Pouillard; +Cc: OCaml List


On May 21, 2007, at 10:26 AM, Nicolas Pouillard wrote:

>     [ "PGSQL"; "("; dbh = expr; ")"; extras = LIST1 STRING ->

It appears to want the following, please let me know if it's wrong.

     [ "PGSQL"; "("; dbh = expr; ")"; extras = LIST1 [ x = STRING ->  
x ] ->

A follow up question... What has become of Stdpp.raise_with_loc, as  
in the following?

         Stdpp.raise_with_loc loc (
           Failure ("Unknown flag: " ^ str)
         )

	Thanks, Joel

--
http://wagerlabs.com/






^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Caml-list] camlp4 3.10: What should this look like?
  2007-05-21  9:56   ` Joel Reymont
@ 2007-05-21 10:44     ` Nicolas Pouillard
  0 siblings, 0 replies; 4+ messages in thread
From: Nicolas Pouillard @ 2007-05-21 10:44 UTC (permalink / raw)
  To: Joel Reymont; +Cc: OCaml List

On 5/21/07, Joel Reymont <joelr1@gmail.com> wrote:
>
> On May 21, 2007, at 10:26 AM, Nicolas Pouillard wrote:
>
> >     [ "PGSQL"; "("; dbh = expr; ")"; extras = LIST1 STRING ->
>
> It appears to want the following, please let me know if it's wrong.
>
>      [ "PGSQL"; "("; dbh = expr; ")"; extras = LIST1 [ x = STRING ->
> x ] ->
>

You're right.

> A follow up question... What has become of Stdpp.raise_with_loc, as
> in the following?
>
>          Stdpp.raise_with_loc loc (
>            Failure ("Unknown flag: " ^ str)
>          )
>

Loc.raise

-- 
Nicolas Pouillard


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-05-21 10:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-21  8:43 camlp4 3.10: What should this look like? Joel Reymont
2007-05-21  9:26 ` [Caml-list] " Nicolas Pouillard
2007-05-21  9:56   ` Joel Reymont
2007-05-21 10:44     ` Nicolas Pouillard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).