diff --git a/.gitignore b/.gitignore index 3236373..d252b85 100644 --- a/.gitignore +++ b/.gitignore @@ -10,4 +10,6 @@ !go.sum !*.md !*.go -!*.py \ No newline at end of file +!*.py +!*.lock +!*.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..897df41 --- /dev/null +++ b/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1701680307, + "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1703438236, + "narHash": "sha256-aqVBq1u09yFhL7bj1/xyUeJjzr92fXVvQSSEx6AdB1M=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "5f64a12a728902226210bf01d25ec6cbb9d9265b", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..1063b87 --- /dev/null +++ b/flake.nix @@ -0,0 +1,22 @@ +{ + description = "A flake that sets up the devShell"; + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + let supportedSystems = [ "aarch64-linux" "i686-linux" "x86_64-linux" ]; + in flake-utils.lib.eachSystem supportedSystems (system: + let + pkgs = import nixpkgs { + inherit system; + overlays = [ ]; + }; + pp = ps: with ps; [ regex ]; + in { + devShell = pkgs.mkShell { + buildInputs = with pkgs; [ go (python312.withPackages pp) ]; + }; + }); +} diff --git a/testdata/gendata.py b/testdata/gendata.py index 1f07482..7059f24 100644 --- a/testdata/gendata.py +++ b/testdata/gendata.py @@ -1,6 +1,7 @@ # This script generates testdata for particular version of unicode. # Used Python 3.8.7 && regex==2020.2.20 to generate cases for unicode 12.1.0. # Used Python 3.9.1 && regex>2020.2.20 to generate cases for unicode 13.0.0. +# Used Python 3.12.1 && regex==2023.8.8 to generate cases for unicode 15.0.0. import unicodedata import regex @@ -10,7 +11,7 @@ def gendata(category): f = gzip.open(f'{category}{unicodedata.unidata_version}.txt.gz', 'wb') for r in range(sys.maxunicode+1): - matched = bool(regex.match(f'\p{{{category}}}', chr(r))) + matched = bool(regex.match(f'\\p{{{category}}}', chr(r))) if matched: f.write(b'T') else: diff --git a/testdata/xid_continue15.0.0.txt.gz b/testdata/xid_continue15.0.0.txt.gz new file mode 100644 index 0000000..c353c23 Binary files /dev/null and b/testdata/xid_continue15.0.0.txt.gz differ diff --git a/testdata/xid_start15.0.0.txt.gz b/testdata/xid_start15.0.0.txt.gz new file mode 100644 index 0000000..b23f3d8 Binary files /dev/null and b/testdata/xid_start15.0.0.txt.gz differ diff --git a/unicodeTestVersion_114.go b/unicodeTestVersion_114.go index b28670f..1060aeb 100644 --- a/unicodeTestVersion_114.go +++ b/unicodeTestVersion_114.go @@ -1,3 +1,4 @@ +//go:build go1.14 && !go1.16 // +build go1.14,!go1.16 package xid diff --git a/unicodeTestVersion_116.go b/unicodeTestVersion_116.go index 7372553..fc77c35 100644 --- a/unicodeTestVersion_116.go +++ b/unicodeTestVersion_116.go @@ -1,4 +1,5 @@ -// +build go1.16 +//go:build go1.16 && !go1.21 +// +build go1.16,!go1.21 package xid diff --git a/unicodeTestVersion_121.go b/unicodeTestVersion_121.go new file mode 100644 index 0000000..bbe777f --- /dev/null +++ b/unicodeTestVersion_121.go @@ -0,0 +1,6 @@ +//go:build go1.21 +// +build go1.21 + +package xid + +const unicodeTestVersion = "15.0.0"