Skip to content

Commit b03afbe

Browse files
committed
Change pm_regexp_parse to not return boolean
1 parent c19b0fa commit b03afbe

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

include/prism/regexp.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ typedef void (*pm_regexp_name_callback_t)(const pm_string_t *name, void *data);
2929
* @param size The size of the source code.
3030
* @param name_callback The callback to call when a named capture group is found.
3131
* @param name_data The data to pass to the name callback.
32-
* @return Whether or not the parsing was successful.
3332
*/
34-
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);
33+
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);
3534

3635
#endif

src/regexp.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -636,9 +636,9 @@ pm_regexp_parse_pattern(pm_regexp_parser_t *parser) {
636636
* Parse a regular expression and extract the names of all of the named capture
637637
* groups.
638638
*/
639-
PRISM_EXPORTED_FUNCTION bool
639+
PRISM_EXPORTED_FUNCTION void
640640
pm_regexp_parse(pm_parser_t *parser, const uint8_t *source, size_t size, pm_regexp_name_callback_t name_callback, void *name_data) {
641-
pm_regexp_parser_t regexp_parser = {
641+
pm_regexp_parse_pattern(&(pm_regexp_parser_t) {
642642
.parser = parser,
643643
.start = source,
644644
.cursor = source,
@@ -647,7 +647,5 @@ pm_regexp_parse(pm_parser_t *parser, const uint8_t *source, size_t size, pm_rege
647647
.encoding = parser->encoding,
648648
.name_callback = name_callback,
649649
.name_data = name_data
650-
};
651-
652-
return pm_regexp_parse_pattern(&regexp_parser);
650+
});
653651
}

0 commit comments

Comments
 (0)