aboutsummaryrefslogtreecommitdiffstats
path: root/prism
diff options
context:
space:
mode:
authorKevin Newton <kddnewton@gmail.com>2024-06-04 12:36:43 -0400
committerKevin Newton <kddnewton@gmail.com>2024-06-05 14:40:03 -0400
commit41f27346440eab0d80b8c50be8741e3344af9ed5 (patch)
treee3793ca493dac64e3725cef1b24d366da517bc04 /prism
parent65746055b4d2c16b68e559cde327889f91f0d516 (diff)
downloadruby-41f27346440eab0d80b8c50be8741e3344af9ed5.tar.gz
[ruby/prism] Change pm_regexp_parse to not return boolean
https://github.com/ruby/prism/commit/b03afbe857
Diffstat (limited to 'prism')
-rw-r--r--prism/regexp.c8
-rw-r--r--prism/regexp.h3
2 files changed, 4 insertions, 7 deletions
diff --git a/prism/regexp.c b/prism/regexp.c
index 1eeccadb72..9d3379d522 100644
--- a/prism/regexp.c
+++ b/prism/regexp.c
@@ -636,9 +636,9 @@ pm_regexp_parse_pattern(pm_regexp_parser_t *parser) {
* Parse a regular expression and extract the names of all of the named capture
* groups.
*/
-PRISM_EXPORTED_FUNCTION bool
+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_parser_t regexp_parser = {
+ pm_regexp_parse_pattern(&(pm_regexp_parser_t) {
.parser = parser,
.start = source,
.cursor = source,
@@ -647,7 +647,5 @@ pm_regexp_parse(pm_parser_t *parser, const uint8_t *source, size_t size, pm_rege
.encoding = parser->encoding,
.name_callback = name_callback,
.name_data = name_data
- };
-
- return pm_regexp_parse_pattern(&regexp_parser);
+ });
}
diff --git a/prism/regexp.h b/prism/regexp.h
index d401d1e06a..f92952d54a 100644
--- a/prism/regexp.h
+++ b/prism/regexp.h
@@ -29,8 +29,7 @@ typedef void (*pm_regexp_name_callback_t)(const pm_string_t *name, void *data);
* @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.
- * @return Whether or not the parsing was successful.
*/
-PRISM_EXPORTED_FUNCTION bool 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);
#endif