-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add sexp_of cenum attribute, use sexplib0
The sexp_of_* functions now return Sexplib0.Sexp.t instead of Sexplib.Sexp.t. The cenum attribute [@@sexp_of] is like [@@sexp] except it only produces the sexp_of* function. This allows for generating sexp_of converters without depending on the full sexplib library.
- Loading branch information
Showing
3 changed files
with
32 additions
and
9 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
(executable | ||
(name ppx_cstruct_and_sexp_of) | ||
(preprocess | ||
(pps ppx_cstruct ppx_sexp_conv -- -no-check)) | ||
(libraries cstruct sexplib0 cstruct-sexp)) | ||
|
||
(rule | ||
(alias runtest) | ||
(package ppx_cstruct) | ||
(action | ||
(run ./ppx_cstruct_and_sexp_of.exe))) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
(* inspect output with [dune describe pp ppx_test/with-sexp-of/ppx_cstruct_and_sexp_of.ml] *) | ||
[%%cenum | ||
type enum = | ||
| One [@id 1] | ||
| Three [@id 3] | ||
[@@uint8_t][@@sexp_of]] |