diff options
author | Kevin Newton <[email protected]> | 2024-06-05 10:50:18 -0400 |
---|---|---|
committer | Kevin Newton <[email protected]> | 2024-06-05 14:40:03 -0400 |
commit | c3747d5a2e029afb9aabc0b2f122ab701e68f71f (patch) | |
tree | 6b3172106773f9f468249b5d65d505202360b337 /prism/regexp.h | |
parent | 41f27346440eab0d80b8c50be8741e3344af9ed5 (diff) |
[ruby/prism] Report onigmo errors for depth
https://github.com/ruby/prism/commit/e0e8bba8be
Diffstat (limited to 'prism/regexp.h')
-rw-r--r-- | prism/regexp.h | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/prism/regexp.h b/prism/regexp.h index f92952d54a..42bc504107 100644 --- a/prism/regexp.h +++ b/prism/regexp.h @@ -22,14 +22,21 @@ typedef void (*pm_regexp_name_callback_t)(const pm_string_t *name, void *data); /** + * This callback is called when a parse error is found. + */ +typedef void (*pm_regexp_error_callback_t)(const uint8_t *start, const uint8_t *end, const char *message, void *data); + +/** * Parse a regular expression. * * @param parser The parser that is currently being used. * @param source The source code to parse. * @param size The size of the source code. - * @param name_callback The callback to call when a named capture group is found. - * @param name_data The data to pass to the name callback. + * @param name_callback The optional callback to call when a named capture group is found. + * @param name_data The optional data to pass to the name callback. + * @param error_callback The callback to call when a parse error is found. + * @param error_data The data to pass to the error callback. */ -PRISM_EXPORTED_FUNCTION void pm_regexp_parse(pm_parser_t *parser, const uint8_t *source, size_t size, pm_regexp_name_callback_t name_callback, void *name_data); +PRISM_EXPORTED_FUNCTION void pm_regexp_parse(pm_parser_t *parser, const uint8_t *source, size_t size, pm_regexp_name_callback_t name_callback, void *name_data, pm_regexp_error_callback_t error_callback, void *error_data); #endif |