mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
parent
b4a85e402f
commit
e2bbbacc23
6 changed files with 12 additions and 7 deletions
|
@ -11954,6 +11954,7 @@ prism/node.$(OBJEXT): $(top_srcdir)/prism/util/pm_newline_list.h
|
|||
prism/node.$(OBJEXT): $(top_srcdir)/prism/util/pm_state_stack.h
|
||||
prism/node.$(OBJEXT): $(top_srcdir)/prism/util/pm_string.h
|
||||
prism/node.$(OBJEXT): $(top_srcdir)/prism/util/pm_string_list.h
|
||||
prism/node.$(OBJEXT): $(top_srcdir)/prism/util/pm_strncasecmp.h
|
||||
prism/node.$(OBJEXT): $(top_srcdir)/prism/util/pm_strpbrk.h
|
||||
prism/node.$(OBJEXT): {$(VPATH)}config.h
|
||||
prism/node.$(OBJEXT): {$(VPATH)}prism/ast.h
|
||||
|
@ -11976,6 +11977,7 @@ prism/prettyprint.$(OBJEXT): $(top_srcdir)/prism/util/pm_list.h
|
|||
prism/prettyprint.$(OBJEXT): $(top_srcdir)/prism/util/pm_newline_list.h
|
||||
prism/prettyprint.$(OBJEXT): $(top_srcdir)/prism/util/pm_state_stack.h
|
||||
prism/prettyprint.$(OBJEXT): $(top_srcdir)/prism/util/pm_string.h
|
||||
prism/prettyprint.$(OBJEXT): $(top_srcdir)/prism/util/pm_strncasecmp.h
|
||||
prism/prettyprint.$(OBJEXT): {$(VPATH)}config.h
|
||||
prism/prettyprint.$(OBJEXT): {$(VPATH)}prism/ast.h
|
||||
prism/prettyprint.$(OBJEXT): {$(VPATH)}prism/prettyprint.c
|
||||
|
@ -12017,6 +12019,7 @@ prism/regexp.$(OBJEXT): $(top_srcdir)/prism/util/pm_newline_list.h
|
|||
prism/regexp.$(OBJEXT): $(top_srcdir)/prism/util/pm_state_stack.h
|
||||
prism/regexp.$(OBJEXT): $(top_srcdir)/prism/util/pm_string.h
|
||||
prism/regexp.$(OBJEXT): $(top_srcdir)/prism/util/pm_string_list.h
|
||||
prism/regexp.$(OBJEXT): $(top_srcdir)/prism/util/pm_strncasecmp.h
|
||||
prism/regexp.$(OBJEXT): {$(VPATH)}config.h
|
||||
prism/regexp.$(OBJEXT): {$(VPATH)}prism/ast.h
|
||||
prism/serialize.$(OBJEXT): $(top_srcdir)/prism/defines.h
|
||||
|
@ -12077,6 +12080,7 @@ prism/util/pm_memchr.$(OBJEXT): $(top_srcdir)/prism/util/pm_memchr.h
|
|||
prism/util/pm_memchr.$(OBJEXT): $(top_srcdir)/prism/util/pm_newline_list.h
|
||||
prism/util/pm_memchr.$(OBJEXT): $(top_srcdir)/prism/util/pm_state_stack.h
|
||||
prism/util/pm_memchr.$(OBJEXT): $(top_srcdir)/prism/util/pm_string.h
|
||||
prism/util/pm_memchr.$(OBJEXT): $(top_srcdir)/prism/util/pm_strncasecmp.h
|
||||
prism/util/pm_memchr.$(OBJEXT): {$(VPATH)}config.h
|
||||
prism/util/pm_memchr.$(OBJEXT): {$(VPATH)}prism/ast.h
|
||||
prism/util/pm_newline_list.$(OBJEXT): $(top_srcdir)/prism/defines.h
|
||||
|
@ -12107,6 +12111,7 @@ prism/util/pm_strpbrk.$(OBJEXT): $(top_srcdir)/prism/util/pm_list.h
|
|||
prism/util/pm_strpbrk.$(OBJEXT): $(top_srcdir)/prism/util/pm_newline_list.h
|
||||
prism/util/pm_strpbrk.$(OBJEXT): $(top_srcdir)/prism/util/pm_state_stack.h
|
||||
prism/util/pm_strpbrk.$(OBJEXT): $(top_srcdir)/prism/util/pm_string.h
|
||||
prism/util/pm_strpbrk.$(OBJEXT): $(top_srcdir)/prism/util/pm_strncasecmp.h
|
||||
prism/util/pm_strpbrk.$(OBJEXT): $(top_srcdir)/prism/util/pm_strpbrk.c
|
||||
prism/util/pm_strpbrk.$(OBJEXT): $(top_srcdir)/prism/util/pm_strpbrk.h
|
||||
prism/util/pm_strpbrk.$(OBJEXT): {$(VPATH)}config.h
|
||||
|
|
|
@ -814,7 +814,7 @@ static VALUE
|
|||
named_captures(VALUE self, VALUE source) {
|
||||
pm_string_list_t string_list = { 0 };
|
||||
|
||||
if (!pm_regexp_named_capture_group_names((const uint8_t *) RSTRING_PTR(source), RSTRING_LEN(source), &string_list, false, &pm_encoding_utf_8)) {
|
||||
if (!pm_regexp_named_capture_group_names((const uint8_t *) RSTRING_PTR(source), RSTRING_LEN(source), &string_list, false, pm_encoding_utf_8)) {
|
||||
pm_string_list_free(&string_list);
|
||||
return Qnil;
|
||||
}
|
||||
|
|
|
@ -20,14 +20,14 @@ typedef struct {
|
|||
bool encoding_changed;
|
||||
|
||||
/** The encoding of the source. */
|
||||
pm_encoding_t *encoding;
|
||||
const pm_encoding_t *encoding;
|
||||
} pm_regexp_parser_t;
|
||||
|
||||
/**
|
||||
* This initializes a new parser with the given source.
|
||||
*/
|
||||
static void
|
||||
pm_regexp_parser_init(pm_regexp_parser_t *parser, const uint8_t *start, const uint8_t *end, pm_string_list_t *named_captures, bool encoding_changed, pm_encoding_t *encoding) {
|
||||
pm_regexp_parser_init(pm_regexp_parser_t *parser, const uint8_t *start, const uint8_t *end, pm_string_list_t *named_captures, bool encoding_changed, const pm_encoding_t *encoding) {
|
||||
*parser = (pm_regexp_parser_t) {
|
||||
.start = start,
|
||||
.cursor = start,
|
||||
|
@ -631,7 +631,7 @@ pm_regexp_parse_pattern(pm_regexp_parser_t *parser) {
|
|||
* groups.
|
||||
*/
|
||||
PRISM_EXPORTED_FUNCTION bool
|
||||
pm_regexp_named_capture_group_names(const uint8_t *source, size_t size, pm_string_list_t *named_captures, bool encoding_changed, pm_encoding_t *encoding) {
|
||||
pm_regexp_named_capture_group_names(const uint8_t *source, size_t size, pm_string_list_t *named_captures, bool encoding_changed, const pm_encoding_t *encoding) {
|
||||
pm_regexp_parser_t parser;
|
||||
pm_regexp_parser_init(&parser, source, source + size, named_captures, encoding_changed, encoding);
|
||||
return pm_regexp_parse_pattern(&parser);
|
||||
|
|
|
@ -28,6 +28,6 @@
|
|||
* @param encoding The encoding of the source code.
|
||||
* @return Whether or not the parsing was successful.
|
||||
*/
|
||||
PRISM_EXPORTED_FUNCTION bool pm_regexp_named_capture_group_names(const uint8_t *source, size_t size, pm_string_list_t *named_captures, bool encoding_changed, pm_encoding_t *encoding);
|
||||
PRISM_EXPORTED_FUNCTION bool pm_regexp_named_capture_group_names(const uint8_t *source, size_t size, pm_string_list_t *named_captures, bool encoding_changed, const pm_encoding_t *encoding);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
* of a multibyte character.
|
||||
*/
|
||||
void *
|
||||
pm_memchr(const void *memory, int character, size_t number, bool encoding_changed, pm_encoding_t *encoding) {
|
||||
pm_memchr(const void *memory, int character, size_t number, bool encoding_changed, const pm_encoding_t *encoding) {
|
||||
if (encoding_changed && encoding->multibyte && character >= PRISM_MEMCHR_TRAILING_BYTE_MINIMUM) {
|
||||
const uint8_t *source = (const uint8_t *) memory;
|
||||
size_t index = 0;
|
||||
|
|
|
@ -24,6 +24,6 @@
|
|||
* @return A pointer to the first occurrence of the character in the source
|
||||
* string, or NULL if no such character exists.
|
||||
*/
|
||||
void * pm_memchr(const void *source, int character, size_t number, bool encoding_changed, pm_encoding_t *encoding);
|
||||
void * pm_memchr(const void *source, int character, size_t number, bool encoding_changed, const pm_encoding_t *encoding);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue