File: raiser.ml

package info (click to toggle)
ppxlib 0.37.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,804 kB
  • sloc: ml: 66,587; sh: 103; makefile: 40; python: 36
file content (13 lines) | stat: -rw-r--r-- 340 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
open Ppxlib

let rule =
  let expand ~loc ~path:_ =
    Location.raise_errorf ~loc "Raising inside the rewriter"
  in
  Extension.declare "raise" Extension.Context.expression
    Ast_pattern.(pstr nil)
    expand
  |> Context_free.Rule.extension

let () = Driver.register_transformation ~rules:[ rule ] "test"
let () = Driver.standalone ()