Created
March 5, 2016 15:14
-
-
Save xvw/7a2397cde4c73bccc65c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open Printf | |
open Parsetree | |
open Asttypes | |
open Ast_helper | |
let create_loc ?(loc = !default_loc) value = { | |
txt = value | |
; loc = loc | |
} | |
let structure_item mapper item = | |
match item.pstr_desc with | |
| Pstr_type declarations -> | |
printf "found type\n"; | |
Str.attribute (create_loc "test", PStr []) | |
| _ -> Ast_mapper.(default_mapper.structure_item mapper item) | |
let structure mapper strct = | |
List.map (fun x -> x) strct | |
let item_mapper = | |
Ast_mapper.{ | |
default_mapper with | |
structure_item = structure_item; | |
structure = structure | |
} | |
let () = | |
Ast_mapper.run_main (fun argv -> item_mapper) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment