Ruby: prism/regexp.h Source File

Ruby 3.4.8p72 (2025-12-17 revision 995b59f66677d44767ce9faac6957e5543617ff9)

regexp.h
Go to the documentation of this file.
1
6#ifndef PRISM_REGEXP_H
7#define PRISM_REGEXP_H
8
9#include "prism/defines.h"
10#include "prism/parser.h"
11#include "prism/encoding.h"
12#include "prism/util/pm_memchr.h"
13#include "prism/util/pm_string.h"
14
15#include <stdbool.h>
16#include <stddef.h>
17#include <string.h>
18
22 typedef void (*pm_regexp_name_callback_t)(const pm_string_t *name, void *data);
23
27 typedef void (*pm_regexp_error_callback_t)(const uint8_t *start, const uint8_t *end, const char *message, void *data);
28
41 PRISM_EXPORTED_FUNCTION void pm_regexp_parse(pm_parser_t *parser, const uint8_t *source, size_t size, bool extended_mode, pm_regexp_name_callback_t name_callback, void *name_data, pm_regexp_error_callback_t error_callback, void *error_data);
42
43#endif
parser.h
The parser used to parse Ruby source.
pm_memchr.h
A custom memchr implementation.
pm_string.h
A generic string type that can have various ownership semantics.
defines.h
Macro definitions used throughout the prism library.
PRISM_EXPORTED_FUNCTION
#define PRISM_EXPORTED_FUNCTION
By default, we compile with -fvisibility=hidden.
Definition defines.h:53
encoding.h
The encoding interface and implementations used by the parser.
pm_regexp_error_callback_t
void(* pm_regexp_error_callback_t)(const uint8_t *start, const uint8_t *end, const char *message, void *data)
This callback is called by pm_regexp_parse() when a parse error is found.
Definition regexp.h:27
pm_regexp_parse
PRISM_EXPORTED_FUNCTION void pm_regexp_parse(pm_parser_t *parser, const uint8_t *source, size_t size, bool extended_mode, pm_regexp_name_callback_t name_callback, void *name_data, pm_regexp_error_callback_t error_callback, void *error_data)
Parse a regular expression.
Definition regexp.c:776
pm_regexp_name_callback_t
void(* pm_regexp_name_callback_t)(const pm_string_t *name, void *data)
This callback is called by pm_regexp_parse() when a named capture group is found.
Definition regexp.h:22
stdbool.h
C99 shim for <stdbool.h>
pm_parser
This struct represents the overall parser.
Definition parser.h:640
pm_string_t
A generic string type that can have various ownership semantics.
Definition pm_string.h:33