Ruby  3.4.0dev (2024-12-06 revision 892c46283a5ea4179500d951c9d4866c0051f27b)
Typedefs | Functions
regexp.h File Reference

(892c46283a5ea4179500d951c9d4866c0051f27b)

A regular expression parser. More...

#include "prism/defines.h"
#include "prism/parser.h"
#include "prism/encoding.h"
#include "prism/util/pm_memchr.h"
#include "prism/util/pm_string.h"
#include <stdbool.h>
#include <stddef.h>
#include <string.h>
Include dependency graph for regexp.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef void(* pm_regexp_name_callback_t) (const pm_string_t *name, void *data)
 This callback is called when a named capture group is found. More...
 
typedef void(* pm_regexp_error_callback_t) (const uint8_t *start, const uint8_t *end, const char *message, void *data)
 This callback is called when a parse error is found. More...
 

Functions

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. More...
 

Detailed Description

A regular expression parser.

Definition in file regexp.h.

Typedef Documentation

◆ pm_regexp_error_callback_t

typedef void(* pm_regexp_error_callback_t) (const uint8_t *start, const uint8_t *end, const char *message, void *data)

This callback is called when a parse error is found.

Definition at line 27 of file regexp.h.

◆ pm_regexp_name_callback_t

typedef void(* pm_regexp_name_callback_t) (const pm_string_t *name, void *data)

This callback is called when a named capture group is found.

Definition at line 22 of file regexp.h.

Function Documentation

◆ 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.

Parameters
parserThe parser that is currently being used.
sourceThe source code to parse.
sizeThe size of the source code.
extended_modeWhether to parse the regular expression in extended mode.
name_callbackThe optional callback to call when a named capture group is found.
name_dataThe optional data to pass to the name callback.
error_callbackThe callback to call when a parse error is found.
error_dataThe data to pass to the error callback.

Parse a regular expression.

Definition at line 777 of file regexp.c.