From 967ef0a35a001f0241917b3864b662c0ba85560d Mon Sep 17 00:00:00 2001 From: frami Date: Thu, 14 Dec 2023 23:19:15 -0300 Subject: [PATCH 1/2] feat: update regex to 1.9 --- .github/workflows/pull_request.yml | 1 + .github/workflows/release.yml | 1 + Cargo.lock | 18 +++++++++++++++--- Cargo.toml | 4 ++-- package.json | 5 +++++ 5 files changed, 24 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 29634e0..e56fc56 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -4,6 +4,7 @@ on: pull_request: branches: - master + - 1.8.x - 1.7.x - 1.6.x - 1.5.x diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bf2ec49..97cffc1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,6 +4,7 @@ on: push: branches: - master + - 1.8.x - 1.7.x - 1.6.x - 1.5.x diff --git a/Cargo.lock b/Cargo.lock index f93df13..8aa7111 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -98,9 +98,21 @@ dependencies = [ [[package]] name = "regex" -version = "1.8.4" +version = "1.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0ab3ca65655bb1e41f2a8c8cd662eb4fb035e67c3f78da1d61dffe89d07300f" +checksum = "ebee201405406dbf528b8b672104ae6d6d63e6d118cb10e4d51abbc7b58044ff" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59b23e92ee4318893fa3fe3e6fb365258efbfe6ac6ab30f090cdcbb7aa37efa9" dependencies = [ "aho-corasick", "memchr", @@ -115,7 +127,7 @@ checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" [[package]] name = "rregex" -version = "1.8.0" +version = "1.9.0" dependencies = [ "console_error_panic_hook", "js-sys", diff --git a/Cargo.toml b/Cargo.toml index 956313a..6b93734 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "rregex" description = "Rust Regex binding for Javascript" license = "MIT" -version = "1.8.0" +version = "1.9.0" authors = [ "Fede Ramirez " ] publish = false readme = "README.md" @@ -11,7 +11,7 @@ homepage = "http://rregex.dev" repository = "https://github.com/2fd/rregex" [dependencies] -regex = "~1.8" +regex = "~1.9" regex-syntax = "0.7" js-sys = "0.3" wasm-bindgen = "0.2" diff --git a/package.json b/package.json index e5436bf..2bc8613 100644 --- a/package.json +++ b/package.json @@ -76,6 +76,11 @@ "range": "1.7.x", "channel": "1.7.x" }, + { + "name": "1.8.x", + "range": "1.8.x", + "channel": "1.8.x" + }, { "name": "master" } From 93620a6ee9b0734e9feeebcf1b72b55d0a41b8eb Mon Sep 17 00:00:00 2001 From: frami Date: Thu, 14 Dec 2023 23:25:58 -0300 Subject: [PATCH 2/2] test: support for empty character class --- test/rregex.test.ts | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/test/rregex.test.ts b/test/rregex.test.ts index fb3e8bf..005d9d3 100644 --- a/test/rregex.test.ts +++ b/test/rregex.test.ts @@ -114,8 +114,8 @@ describe(`RRegex`, () => { const re4 = new RRegex("(?.(?.))(.)(?:.)(?.)") expect(re4.capturesLength()).toEqual(5) - // const re5 = new RRegex("[a&&b]") - // expect(re5.capturesLength()).toEqual(1) + const re5 = new RRegex("[a&&b]") + expect(re5.capturesLength()).toEqual(1) }) test(`captureNames`, () => { @@ -1005,6 +1005,34 @@ describe(`RRegex`, () => { } }) }) + + + test('Empty character class', () => { + const regex = new RRegex('[a&&b]') + expect(regex.syntax()).toEqual({ + "@name": "regex_syntax::hir::Hir", + "@type": "struct", + "kind": { + "@name": "regex_syntax::hir::HirKind", + "@type": "enum", + "@variant": "Class", + "@values": [ + { + "@name": "regex_syntax::hir::Class", + "@type": "enum", + "@variant": "Bytes", + "@values": [ + { + "@name": "regex_syntax::hir::ClassBytes", + "@type": "struct", + "ranges": [] + } + ] + } + ], + } + }) + }) }) })