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

--
http://wagerlabs.com/