1
0
Fork 0
forked from fun/fun

Added tons of AI generated docs and a lot of cleanups. No code changes. (0.41.5)

This commit is contained in:
Johannes Findeisen 2026-05-01 02:20:25 +02:00
commit 4e69a3ce63
151 changed files with 3897 additions and 427 deletions

View file

@ -5,8 +5,40 @@
* Copyright 2025 Johannes Findeisen <you@hanez.org>
* Licensed under the terms of the Apache-2.0 license.
* https://opensource.org/license/apache-2-0
*/
/**
* @file findall.c
* @brief Implements the OP_PCRE2_FINDALL opcode (conditional build).
*
* Added: 2025-11-25
* Finds all non-overlapping matches of a PCRE2 pattern in a subject string
* and returns an array of maps describing each match when FUN_WITH_PCRE2 is
* enabled. When PCRE2 support is disabled at build time, the opcode falls
* back to returning an empty array.
*/
/**
* OP_PCRE2_FINDALL: (pattern:any, text:any, flags:int|bool=0) -> array(map)
*
* Behavior when FUN_WITH_PCRE2 is enabled:
* - Pops three arguments from the VM stack: pattern, text, flags.
* - pattern and text are converted to strings using value_to_string_alloc().
* - flags bits map to PCRE2 options:
* - 1 = PCRE2_CASELESS (I)
* - 2 = PCRE2_MULTILINE (M)
* - 4 = PCRE2_DOTALL (S)
* - 8 = PCRE2_UTF (U)
* - 16 = PCRE2_EXTENDED (X)
* - Compiles the pattern and scans the subject for all non-overlapping
* matches. For each match, pushes into the result array a map with keys:
* - "full": matched substring (group 0)
* - "start": start index (int)
* - "end": end index (int, exclusive)
* - "groups": array of captured group strings (excluding group 0)
* - On compilation error or allocation failure, returns an empty array.
*
* Behavior when FUN_WITH_PCRE2 is disabled:
* - Pops three values and returns an empty array.
*/
/* PCRE2_FINDALL */