This commit is contained in:
parent
aa2ff7b2f0
commit
2f3113f55d
11742 changed files with 1223940 additions and 0 deletions
|
|
@ -0,0 +1,14 @@
|
|||
(rule
|
||||
(package ppxlib)
|
||||
(alias runtest)
|
||||
(enabled_if
|
||||
(>= %{ocaml_version} "4.09.0"))
|
||||
(deps
|
||||
(:test test.ml)
|
||||
(package ppxlib))
|
||||
(action
|
||||
(chdir
|
||||
%{project_root}
|
||||
(progn
|
||||
(run expect-test %{test})
|
||||
(diff? %{test} %{test}.corrected)))))
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
open Stdppx
|
||||
open Ppxlib
|
||||
|
||||
let _ =
|
||||
let loc = Location.none in
|
||||
let extension =
|
||||
Extension.V3.declare_inline
|
||||
"include"
|
||||
Structure_item
|
||||
Ast_pattern.(pstr __)
|
||||
(fun ~ctxt:_ x -> x)
|
||||
in
|
||||
let rules = [ Context_free.Rule.extension extension ] in
|
||||
let enclose_impl _ _ = [%str [%%include let a = 1]], [%str [%%include let c = 3]] in
|
||||
Driver.V2.register_transformation ~rules ~enclose_impl "example"
|
||||
|
||||
[%%expect{|
|
||||
- : unit = ()
|
||||
|}]
|
||||
|
||||
let b = 2
|
||||
|
||||
[%%expect{|
|
||||
val a : int = 1
|
||||
val b : int = 2
|
||||
val c : int = 3
|
||||
|}]
|
||||
Loading…
Add table
Add a link
Reference in a new issue