Version française
Home     About     Download     Resources     Contact us    
Browse thread
How to achieve this camlp4 syntax extension
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Christophe TROESTLER <Christophe.Troestler+ocaml@u...>
Subject: Re: [Caml-list] Re: How to achieve this camlp4 syntax extension
> On 4/2/2009 1:42 PM, Conglun Yao wrote:
>>
>> Different kinds of error happened, when trying to use it.
>>
>> Even the ordinary expression:  List.length [1; 2;3 ],  failed.  'List'
>> is parsed as module_longident, try to match the rule I defined.

Not sure whether you are still looking for a solution to this but, as
it was not possible to use theses constructions together with pa_do
(same grammar rule to modify), I added hooks so you can provide your
own functions for them.  E.g.,

val module_square_brackets : (module_longident -> Loc.t -> expr -> expr) ref

allows you to replace [M.[ e ]] by [!module_square_brackets m _loc e]
where [m] is the internal representation of [M] and [_loc] is the
location of the whole expression [M.[ e ]].

This is available in the last version of delimited overloading
(downloadable at http://pa-do.forge.ocamlcore.org/ ).

Hope it helps,
ChriS