Version française
Home     About     Download     Resources     Contact us    
Browse thread
New Camlp4 questions
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Dmitry Bely <dmitry.bely@g...>
Subject: New Camlp4 questions
Still trying to convert IoXML to the new Camlp4 syntax. What is an
equivalent for

Pcaml.warning.val loc "Warning: IoXML not implemented for this type";

and

value type_declaration : Grammar.Entry.e 'a =
  Obj.magic (Grammar.Entry.find Pcaml.str_item "type_declaration")
;

DELETE_RULE Pcaml.str_item: "type"; LIST1 type_declaration SEP "and" END;
DELETE_RULE Pcaml.sig_item: "type"; LIST1 type_declaration SEP "and" END;

EXTEND
  Pcaml.str_item:
    [ [ "type"; LIDENT "nogen"; tdl = LIST1 type_declaration SEP "and" ->
          <:str_item< type $list:tdl$ >>
      | "type"; tdl = LIST1 type_declaration SEP "and" ->
          let sil = gen_ioxml_impl loc tdl in
          let sil =
            if notyp.val then sil
            else [<:str_item< type $list:tdl$ >> :: sil]
          in
          <:str_item< declare $list:sil$ end >> ] ]
  ;
[...]
END;

How to write value type_declaration? I cannot use Gram.Entry.find as
it is now commented out together with the whole Gram.Find module. Why?

- Dmitry Bely