package quickjs

  1. Overview
  2. Docs
Bindings for QuickJS (a Javascript Engine to be embedded https://bellard.org/quickjs)

Install

dune-project
 Dependency

Authors

Maintainers

Sources

quickjs-0.4.1.tbz
sha256=146725bf2d0ef5ef95d7cf72a524c6f72697c7c619627be5fb2451f9daf6d28e
sha512=190962b9044f7b044bb36d8c8eb42223fbc7a31160429917725cf931e2c608c5ee0f669bcbca1a9fe731c62759c427c6e832fccad3f35a282ca517ad75631d25

doc/src/quickjs.c/libregexp.ml.html

Source file libregexp.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
(** Low-level bindings to QuickJS's libregexp - Regular Expression Engine

    ES2023-compliant regex engine with Unicode support. These are raw C
    bindings; for a higher-level API, use [Quickjs.RegExp]. *)

(** Compile a regular expression pattern into bytecode. Returns pointer to
    bytecode buffer, or NULL on error with message in error_msg. *)
let compile plen error_msg error_msg_size buf buf_len flags opaque =
  Bindings.C.Functions.lre_compile plen error_msg error_msg_size buf buf_len
    flags opaque

(** Execute a compiled regex against input string. Returns: 1 = match, 0 = no
    match, -1 = error *)
let exec capture bc_buf cbuf cindex clen cbuf_type opaque =
  Bindings.C.Functions.lre_exec capture bc_buf cbuf cindex clen cbuf_type opaque

(** Get number of capture groups (including group 0 for full match) *)
let get_capture_count bc_buf = Bindings.C.Functions.lre_get_capture_count bc_buf

(** Get pointer to null-terminated group names *)
let get_groupnames bc_buf = Bindings.C.Functions.lre_get_groupnames bc_buf

(** Get flags from compiled bytecode *)
let get_flags bc_buf = Bindings.C.Functions.lre_get_flags bc_buf