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 3.10: <:ctyp< ( $list:tys$ )
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-05-01 (12:16)
From: Joel Reymont <joelr1@g...>
Subject: camlp4 3.10: <:ctyp< ( $list:tys$ )
This is the old code:

     | <:ctyp< ( $list:tys$ ) >> -> tupl _loc (List.map aux tys)

I figure it tries to match something like "int * int".

Following Nicolas's suggestion I thought I would see what this  
expands to:

camlp4of -str '<:ctyp< ( int * int ) >>'
Ast.TyTup (_loc,
   Ast.TySta (_loc, Ast.TyId (_loc, Ast.IdLid (_loc, "int")),
     Ast.TyId (_loc, Ast.IdLid (_loc, "int"))))

How do I work back from this to the right expression within parens in  
the original pattern above? I tried

     | <:ctyp< ( $tup:tys$ ) >> -> tupl _loc (List.map aux tys)

but this produces ctyp instead of ctyp list so it's not suitable for  
the tupl.

	Thanks, Joel