diff --git a/README.md b/README.md new file mode 100644 index 0000000..20f3884 --- /dev/null +++ b/README.md @@ -0,0 +1,18 @@ +# ppx\_unicode + +this is an opinionated unicode PPX for ocaml + +features +- all bare string literals are enforced UTF-8, and normalized using NFC. this is similar to + , however this PPX aims for a modern implementation + based on `ppxlib` and defaults to enforced and normalized UTF-8 on all strings +- `Uchar.t` literals: +```ocaml +# "å"[@uchar] +- : Uchar.t = +``` +- `bytes` literals +```ocaml +# "å"[@bytes] +- : bytes = Bytes.of_string "\195\165" +``` diff --git a/dune-project b/dune-project index d607736..cea189a 100644 --- a/dune-project +++ b/dune-project @@ -1,26 +1,21 @@ (lang dune 3.15) (name ppx_unicode) +(version 0.0.1) (generate_opam_files true) -(source - (github username/reponame)) - -(authors "Author Name") - -(maintainers "Maintainer Name") - -(license LICENSE) - -(documentation https://url/to/documentation) - (package (name ppx_unicode) - (synopsis "A short synopsis") - (description "A longer description") - (depends ocaml dune) - (tags - (topics "to describe" your project))) - -; See the complete stanza docs at https://dune.readthedocs.io/en/stable/dune-files.html#dune-project + (synopsis "opinionated ppx for string literals") + (description "ppx providing enforced and NFC normalized utf-8 on string literals, uchar literals, and bytes literals") + (license "CC-BY-NC-SA-4.0") + (homepage "https://git.lain.faith/haskal/ppx_unicode") + (bug_reports "https://git.lain.faith/haskal/ppx_unicode") + (authors "xenia ") + (maintainers "xenia ") + (source + (uri "https://git.lain.faith/haskal/ppx_unicode.git")) + (depends ocaml dune + (ppxlib (>= 0.32)) + (uunf (>= 15.1)))) diff --git a/package.nix b/package.nix new file mode 100644 index 0000000..c74f8af --- /dev/null +++ b/package.nix @@ -0,0 +1,38 @@ +{ + lib, + mkShell, + + buildDunePackage, + ppxlib, + uunf, + + ocaml, + dune_3, + odoc, + utop, + + enableShell ? false +}: + +let + sourceRoot = ./.; + fs = lib.fileset; + sourceFiles = fs.difference + (fs.gitTracked sourceRoot) + (fs.fileFilter (file: file.hasExt "nix") sourceRoot); + sourceSet = fs.toSource { root = sourceRoot; fileset = sourceFiles; }; +in buildDunePackage rec { + pname = "ppx_unicode"; + version = "0.0.1"; + src = sourceSet; + + minimalOCamlVersion = "5.1"; + dontStrip = true; + + buildInputs = [ ppxlib uunf ]; + propagatedBuildInputs = [ ]; + + nativeBuildInputs = lib.optionals enableShell [ + ocaml dune_3 odoc utop + ]; +} diff --git a/ppx/dune b/ppx/dune index fe17f3f..d8553d3 100644 --- a/ppx/dune +++ b/ppx/dune @@ -5,4 +5,4 @@ (preprocess (pps ppxlib.metaquot)) (libraries ppxlib uunf) - (kind ppx_deriver)) + (kind ppx_rewriter)) diff --git a/ppx_unicode.opam b/ppx_unicode.opam index d500377..ae2cf7d 100644 --- a/ppx_unicode.opam +++ b/ppx_unicode.opam @@ -1,17 +1,19 @@ # This file is generated by dune, edit dune-project instead opam-version: "2.0" -synopsis: "A short synopsis" -description: "A longer description" -maintainer: ["Maintainer Name"] -authors: ["Author Name"] -license: "LICENSE" -tags: ["topics" "to describe" "your" "project"] -homepage: "https://github.com/username/reponame" -doc: "https://url/to/documentation" -bug-reports: "https://github.com/username/reponame/issues" +version: "0.0.1" +synopsis: "opinionated ppx for string literals" +description: + "ppx providing enforced and NFC normalized utf-8 on string literals, uchar literals, and bytes literals" +maintainer: ["xenia "] +authors: ["xenia "] +license: "LGPL-2.0-or-later" +homepage: "https://git.lain.faith/haskal/ppx_unicode" +bug-reports: "https://git.lain.faith/haskal/ppx_unicode" depends: [ "ocaml" "dune" {>= "3.15"} + "ppxlib" {>= "0.32"} + "uunf" {>= "15.1"} "odoc" {with-doc} ] build: [ @@ -28,4 +30,4 @@ build: [ "@doc" {with-doc} ] ] -dev-repo: "git+https://github.com/username/reponame.git" +dev-repo: "https://git.lain.faith/haskal/ppx_unicode.git"