2.3.2 • Published 7 months ago

@zk-email/zk-regex-compiler v2.3.2

Weekly downloads
-
License
MIT
Repository
-
Last release
7 months ago

zk-regex-compiler

A compiler CLI in zk-regex.

Installing zk-regex-compiler

You can install the project with npm. In the project directory, run:

$ npm install

This fully installs the project, including installing any dependencies and running the build.

Building zk-regex-compiler

If you have already installed the project and only want to run the build, run:

$ npm run build

Compiling zk-regex-compiler to wasm

For web usage

Install wasm-pack if not already installed

cargo install wasm-pack

Compile the web package

wasm-pack build --target nodejs

Pack the package (optional)

wasm-pack build --target nodejs
cd pkg
npm pkg set type='module'
wasm-pack pack

The output package file will be packages/compiler/pkg/zk-regex-compiler-1.1.1.tgz

For tests

wasm-pack test --node

CLI Usage

Please see "Compiler CLI" section in zk-regex.

Available Scripts

In the project directory, you can run:

npm install

Installs the project, including running npm run build.

npm build

Additional cargo build arguments may be passed to npm build and npm build-* commands. For example, to enable a cargo feature:

npm run build -- --feature=beetle

npm build-debug

Alias for npm build.

npm build-release

Same as npm build but, builds the module with the release profile. Release builds will compile slower, but run faster.

npm test

Runs the unit tests by calling wasm-pack test --node.

Project Layout

The directory structure of this project is:

zk-regex-compiler/
├── Cargo.toml
├── README.md
├── package.json
├── src/
|   └── lib.rs
└── target/

Cargo.toml

The Cargo manifest file, which informs the cargo command.

README.md

This file.

package.json

The npm manifest file, which informs the npm command.

src/

The directory tree containing the Rust source code for the project.

src/lib.rs

The Rust library's main module.

target/

Binary artifacts generated by the Rust build.

Regex Limitations

The regular expressions supported by our compiler have the following limitations:

  • Regular expressions where the results differ between greedy and lazy matching (e.g., .+, .+?) are not supported.
  • The beginning anchor ^ must either appear at the beginning of the regular expression or be in the format (|^). Additionally, the section containing this ^ must be non-public (is_public: false).
  • The end anchor $ must appear at the end of the regular expression.
  • Regular expressions that, when converted to DFA (Deterministic Finite Automaton), include transitions to the initial state are not supported (e.g., .*).
  • Regular expressions that, when converted to DFA, have multiple accepting states are not supported.
2.3.2

7 months ago

2.3.1

8 months ago

2.3.0

9 months ago

2.2.0

9 months ago

2.1.1

10 months ago

2.1.0

1 year ago

2.0.2

1 year ago

2.0.1

1 year ago

1.9.1

1 year ago

1.9.0

1 year ago

2.0.0

1 year ago

1.1.0

1 year ago

1.0.9

1 year ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago