Files
Saúl Ibarra Corretgé 5f2fb55994 Port Bellard's register-based regexp engine
Replace quickjs-ng's stack-based libregexp with Fabrice Bellard's
register-based backtracking engine, which
is faster and guarantees linear bytecode size growth. This also brings the
regexp implementation to full parity with upstream: v flag, regexp modifiers,
duplicate named capture groups, properties of strings, and Script=Unknown.

Includes the following upstream commits from bellard/quickjs:
  7ab2341  faster and simpler implementation of regexp backtracking
  a774007  removed buffer overflows introduced in regexp optimizations
  371c06e  ensure regexp bytecode size grows linearly with the input
  47aac8b  regexp: a set of registers instead of an auxiliary stack
  5907aa6  added missing lre_poll_timeout()
  f113949  removed alloca() in lre_exec(); \s/\S opcodes; optimized \b/\B
  7bd1ae2  \x{N} is a syntax error
  24379bf  added regexp duplicate named groups; fixed reset of captures
  f95b8ba  added regexp modifiers
  d7cdfdc  regexp: added v flag support; CR_OP_SUB + properties of strings
  fc524f7  added missing 'Unknown' unicode Script
2026-06-27 12:43:44 +02:00

54 lines
1.5 KiB
C

/* File generated automatically by the QuickJS-ng compiler. */
#include "quickjs-libc.h"
const uint32_t qjsc_hello_size = 108;
const uint8_t qjsc_hello[108] = {
0x1b, 0x9f, 0x9e, 0xb6, 0xf5, 0x04, 0x01, 0x22,
0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73,
0x2f, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x2e, 0x6a,
0x73, 0x01, 0x0e, 0x63, 0x6f, 0x6e, 0x73, 0x6f,
0x6c, 0x65, 0x01, 0x06, 0x6c, 0x6f, 0x67, 0x01,
0x16, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x57,
0x6f, 0x72, 0x6c, 0x64, 0x0d, 0xe4, 0x03, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0c, 0x20, 0x0a, 0x01,
0xa8, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00,
0x00, 0x19, 0x00, 0x08, 0xf0, 0x02, 0x29, 0x38,
0xf3, 0x00, 0x00, 0x00, 0x41, 0xf4, 0x00, 0x00,
0x00, 0x04, 0xf5, 0x00, 0x00, 0x00, 0x24, 0x01,
0x00, 0x0e, 0x06, 0x2f, 0xe4, 0x03, 0x01, 0x01,
0x02, 0x48, 0x0e, 0x00,
};
static JSContext *JS_NewCustomContext(JSRuntime *rt)
{
JSContext *ctx = JS_NewContext(rt);
if (!ctx)
return NULL;
return ctx;
}
int main(int argc, char **argv)
{
int r;
JSRuntime *rt;
JSContext *ctx;
r = 0;
rt = JS_NewRuntime();
js_std_set_worker_new_context_func(JS_NewCustomContext);
js_std_init_handlers(rt);
JS_SetModuleLoaderFunc2(rt, NULL, js_module_loader, js_module_check_attributes, NULL);
ctx = JS_NewCustomContext(rt);
js_std_add_helpers(ctx, argc, argv);
js_std_eval_binary(ctx, qjsc_hello, qjsc_hello_size, 0);
r = js_std_loop(ctx);
if (r) {
js_std_dump_error(ctx);
}
js_std_free_handlers(rt);
JS_FreeContext(ctx);
JS_FreeRuntime(rt);
return r;
}