MIRROR: javascript for 馃悳's, a tiny runtime with big ambitions
1#ifndef REGEX_H
2#define REGEX_H
3
4#include "types.h"
5
6typedef struct {
7 const char *pattern_ptr;
8 ant_offset_t pattern_len;
9
10 const char *str_ptr;
11 ant_offset_t str_len;
12
13 bool global;
14 bool ignore_case;
15 bool multiline;
16} regex_match_args_t;
17
18void init_regex_module(void);
19void cleanup_regex_module(void);
20void gc_sweep_regex_cache(void);
21
22size_t js_to_pcre2_pattern(
23 const char *src, size_t src_len,
24 char *dst, size_t dst_size, bool v_flag
25);
26
27ant_value_t is_regexp_like(ant_t *js, ant_value_t value);
28ant_value_t do_regex_match_pcre2(ant_t *js, regex_match_args_t args);
29ant_value_t reject_regexp_arg(ant_t *js, ant_value_t value, const char *method_name);
30
31bool regexp_exec_truthy_try_fast(
32 ant_t *js,
33 ant_value_t call_func,
34 ant_value_t regexp,
35 ant_value_t arg,
36 ant_value_t *out_result
37);
38
39#endif