Fix indents in Onigmo files to use spaces instead of tabs (#14047) [no ci]

This commit is contained in:
Hiroya Fujinami 2025-07-31 13:08:54 +09:00 committed by GitHub
parent 064e74087c
commit 18f500e347
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 3746 additions and 3746 deletions

2224
regcomp.c

File diff suppressed because it is too large Load diff

View file

@ -89,7 +89,7 @@ onigenc_get_right_adjust_char_head(OnigEncoding enc, const UChar* start, const U
extern UChar* extern UChar*
onigenc_get_right_adjust_char_head_with_prev(OnigEncoding enc, onigenc_get_right_adjust_char_head_with_prev(OnigEncoding enc,
const UChar* start, const UChar* s, const UChar* end, const UChar** prev) const UChar* start, const UChar* s, const UChar* end, const UChar** prev)
{ {
UChar* p = ONIGENC_LEFT_ADJUST_CHAR_HEAD(enc, start, s, end); UChar* p = ONIGENC_LEFT_ADJUST_CHAR_HEAD(enc, start, s, end);
@ -425,8 +425,8 @@ const OnigPairCaseFoldCodes OnigAsciiLowerMap[] = {
extern int extern int
onigenc_ascii_apply_all_case_fold(OnigCaseFoldType flag ARG_UNUSED, onigenc_ascii_apply_all_case_fold(OnigCaseFoldType flag ARG_UNUSED,
OnigApplyAllCaseFoldFunc f, void* arg, OnigApplyAllCaseFoldFunc f, void* arg,
OnigEncoding enc ARG_UNUSED) OnigEncoding enc ARG_UNUSED)
{ {
OnigCodePoint code; OnigCodePoint code;
int i, r; int i, r;
@ -446,8 +446,8 @@ onigenc_ascii_apply_all_case_fold(OnigCaseFoldType flag ARG_UNUSED,
extern int extern int
onigenc_ascii_get_case_fold_codes_by_str(OnigCaseFoldType flag ARG_UNUSED, onigenc_ascii_get_case_fold_codes_by_str(OnigCaseFoldType flag ARG_UNUSED,
const OnigUChar* p, const OnigUChar* end ARG_UNUSED, const OnigUChar* p, const OnigUChar* end ARG_UNUSED,
OnigCaseFoldCodeItem items[], OnigEncoding enc ARG_UNUSED) OnigCaseFoldCodeItem items[], OnigEncoding enc ARG_UNUSED)
{ {
if (0x41 <= *p && *p <= 0x5a) { if (0x41 <= *p && *p <= 0x5a) {
items[0].byte_len = 1; items[0].byte_len = 1;
@ -467,7 +467,7 @@ onigenc_ascii_get_case_fold_codes_by_str(OnigCaseFoldType flag ARG_UNUSED,
static int static int
ss_apply_all_case_fold(OnigCaseFoldType flag ARG_UNUSED, ss_apply_all_case_fold(OnigCaseFoldType flag ARG_UNUSED,
OnigApplyAllCaseFoldFunc f, void* arg) OnigApplyAllCaseFoldFunc f, void* arg)
{ {
OnigCodePoint ss[] = { 0x73, 0x73 }; OnigCodePoint ss[] = { 0x73, 0x73 };
@ -513,7 +513,7 @@ onigenc_get_case_fold_codes_by_str_with_map(int map_size,
items[0].code_len = 1; items[0].code_len = 1;
items[0].code[0] = (OnigCodePoint )(*p + 0x20); items[0].code[0] = (OnigCodePoint )(*p + 0x20);
if (*p == 0x53 && ess_tsett_flag != 0 && end > p + 1 if (*p == 0x53 && ess_tsett_flag != 0 && end > p + 1
&& (*(p+1) == 0x53 || *(p+1) == 0x73)) { && (*(p+1) == 0x53 || *(p+1) == 0x73)) {
/* SS */ /* SS */
items[1].byte_len = 2; items[1].byte_len = 2;
items[1].code_len = 1; items[1].code_len = 1;
@ -528,7 +528,7 @@ onigenc_get_case_fold_codes_by_str_with_map(int map_size,
items[0].code_len = 1; items[0].code_len = 1;
items[0].code[0] = (OnigCodePoint )(*p - 0x20); items[0].code[0] = (OnigCodePoint )(*p - 0x20);
if (*p == 0x73 && ess_tsett_flag != 0 && end > p + 1 if (*p == 0x73 && ess_tsett_flag != 0 && end > p + 1
&& (*(p+1) == 0x73 || *(p+1) == 0x53)) { && (*(p+1) == 0x73 || *(p+1) == 0x53)) {
/* ss */ /* ss */
items[1].byte_len = 2; items[1].byte_len = 2;
items[1].code_len = 1; items[1].code_len = 1;
@ -566,16 +566,16 @@ onigenc_get_case_fold_codes_by_str_with_map(int map_size,
for (i = 0; i < map_size; i++) { for (i = 0; i < map_size; i++) {
if (*p == map[i].from) { if (*p == map[i].from) {
items[0].byte_len = 1; items[0].byte_len = 1;
items[0].code_len = 1; items[0].code_len = 1;
items[0].code[0] = map[i].to; items[0].code[0] = map[i].to;
return 1; return 1;
} }
else if (*p == map[i].to) { else if (*p == map[i].to) {
items[0].byte_len = 1; items[0].byte_len = 1;
items[0].code_len = 1; items[0].code_len = 1;
items[0].code[0] = map[i].from; items[0].code[0] = map[i].from;
return 1; return 1;
} }
} }
} }
@ -586,9 +586,9 @@ onigenc_get_case_fold_codes_by_str_with_map(int map_size,
extern int extern int
onigenc_not_support_get_ctype_code_range(OnigCtype ctype ARG_UNUSED, onigenc_not_support_get_ctype_code_range(OnigCtype ctype ARG_UNUSED,
OnigCodePoint* sb_out ARG_UNUSED, OnigCodePoint* sb_out ARG_UNUSED,
const OnigCodePoint* ranges[] ARG_UNUSED, const OnigCodePoint* ranges[] ARG_UNUSED,
OnigEncoding enc) OnigEncoding enc)
{ {
return ONIG_NO_SUPPORT_CONFIG; return ONIG_NO_SUPPORT_CONFIG;
} }
@ -605,7 +605,7 @@ onigenc_is_mbc_newline_0x0a(const UChar* p, const UChar* end, OnigEncoding enc A
/* for single byte encodings */ /* for single byte encodings */
extern int extern int
onigenc_ascii_mbc_case_fold(OnigCaseFoldType flag ARG_UNUSED, const UChar** p, onigenc_ascii_mbc_case_fold(OnigCaseFoldType flag ARG_UNUSED, const UChar** p,
const UChar* end, UChar* lower, OnigEncoding enc ARG_UNUSED) const UChar* end, UChar* lower, OnigEncoding enc ARG_UNUSED)
{ {
*lower = ONIGENC_ASCII_CODE_TO_LOWER_CASE(**p); *lower = ONIGENC_ASCII_CODE_TO_LOWER_CASE(**p);
@ -616,7 +616,7 @@ onigenc_ascii_mbc_case_fold(OnigCaseFoldType flag ARG_UNUSED, const UChar** p,
#if 0 #if 0
extern int extern int
onigenc_ascii_is_mbc_ambiguous(OnigCaseFoldType flag ARG_UNUSED, onigenc_ascii_is_mbc_ambiguous(OnigCaseFoldType flag ARG_UNUSED,
const UChar** pp, const UChar* end ARG_UNUSED) const UChar** pp, const UChar* end ARG_UNUSED)
{ {
const UChar* p = *pp; const UChar* p = *pp;
@ -627,14 +627,14 @@ onigenc_ascii_is_mbc_ambiguous(OnigCaseFoldType flag ARG_UNUSED,
extern int extern int
onigenc_single_byte_mbc_enc_len(const UChar* p ARG_UNUSED, const UChar* e ARG_UNUSED, onigenc_single_byte_mbc_enc_len(const UChar* p ARG_UNUSED, const UChar* e ARG_UNUSED,
OnigEncoding enc ARG_UNUSED) OnigEncoding enc ARG_UNUSED)
{ {
return 1; return 1;
} }
extern OnigCodePoint extern OnigCodePoint
onigenc_single_byte_mbc_to_code(const UChar* p, const UChar* end ARG_UNUSED, onigenc_single_byte_mbc_to_code(const UChar* p, const UChar* end ARG_UNUSED,
OnigEncoding enc ARG_UNUSED) OnigEncoding enc ARG_UNUSED)
{ {
return (OnigCodePoint )(*p); return (OnigCodePoint )(*p);
} }
@ -658,25 +658,25 @@ onigenc_single_byte_code_to_mbc(OnigCodePoint code, UChar *buf, OnigEncoding enc
extern UChar* extern UChar*
onigenc_single_byte_left_adjust_char_head(const UChar* start ARG_UNUSED, onigenc_single_byte_left_adjust_char_head(const UChar* start ARG_UNUSED,
const UChar* s, const UChar* s,
const UChar* end ARG_UNUSED, const UChar* end ARG_UNUSED,
OnigEncoding enc ARG_UNUSED) OnigEncoding enc ARG_UNUSED)
{ {
return (UChar* )s; return (UChar* )s;
} }
extern int extern int
onigenc_always_true_is_allowed_reverse_match(const UChar* s ARG_UNUSED, onigenc_always_true_is_allowed_reverse_match(const UChar* s ARG_UNUSED,
const UChar* end ARG_UNUSED, const UChar* end ARG_UNUSED,
OnigEncoding enc ARG_UNUSED) OnigEncoding enc ARG_UNUSED)
{ {
return TRUE; return TRUE;
} }
extern int extern int
onigenc_always_false_is_allowed_reverse_match(const UChar* s ARG_UNUSED, onigenc_always_false_is_allowed_reverse_match(const UChar* s ARG_UNUSED,
const UChar* end ARG_UNUSED, const UChar* end ARG_UNUSED,
OnigEncoding enc ARG_UNUSED) OnigEncoding enc ARG_UNUSED)
{ {
return FALSE; return FALSE;
} }
@ -712,7 +712,7 @@ onigenc_mbn_mbc_to_code(OnigEncoding enc, const UChar* p, const UChar* end)
extern int extern int
onigenc_mbn_mbc_case_fold(OnigEncoding enc, OnigCaseFoldType flag ARG_UNUSED, onigenc_mbn_mbc_case_fold(OnigEncoding enc, OnigCaseFoldType flag ARG_UNUSED,
const UChar** pp, const UChar* end ARG_UNUSED, const UChar** pp, const UChar* end ARG_UNUSED,
UChar* lower) UChar* lower)
{ {
int len; int len;
const UChar *p = *pp; const UChar *p = *pp;
@ -843,7 +843,7 @@ onigenc_minimum_property_name_to_ctype(OnigEncoding enc, const UChar* p, const U
extern int extern int
onigenc_mb2_is_code_ctype(OnigEncoding enc, OnigCodePoint code, onigenc_mb2_is_code_ctype(OnigEncoding enc, OnigCodePoint code,
unsigned int ctype) unsigned int ctype)
{ {
if (code < 128) if (code < 128)
return ONIGENC_IS_ASCII_CODE_CTYPE(code, ctype); return ONIGENC_IS_ASCII_CODE_CTYPE(code, ctype);
@ -858,7 +858,7 @@ onigenc_mb2_is_code_ctype(OnigEncoding enc, OnigCodePoint code,
extern int extern int
onigenc_mb4_is_code_ctype(OnigEncoding enc, OnigCodePoint code, onigenc_mb4_is_code_ctype(OnigEncoding enc, OnigCodePoint code,
unsigned int ctype) unsigned int ctype)
{ {
if (code < 128) if (code < 128)
return ONIGENC_IS_ASCII_CODE_CTYPE(code, ctype); return ONIGENC_IS_ASCII_CODE_CTYPE(code, ctype);
@ -961,14 +961,14 @@ onigenc_property_list_add_property(UChar* name, const OnigCodePoint* prop,
*pnum = *pnum + 1; *pnum = *pnum + 1;
onig_st_insert_strend(*table, name, name + strlen((char* )name), onig_st_insert_strend(*table, name, name + strlen((char* )name),
(hash_data_type )(*pnum + ONIGENC_MAX_STD_CTYPE)); (hash_data_type )(*pnum + ONIGENC_MAX_STD_CTYPE));
return 0; return 0;
} }
#endif #endif
extern int extern int
onigenc_ascii_only_case_map(OnigCaseFoldType* flagP, const OnigUChar** pp, const OnigUChar* end, onigenc_ascii_only_case_map(OnigCaseFoldType* flagP, const OnigUChar** pp, const OnigUChar* end,
OnigUChar* to, OnigUChar* to_end, const struct OnigEncodingTypeST* enc) OnigUChar* to, OnigUChar* to_end, const struct OnigEncodingTypeST* enc)
{ {
OnigCodePoint code; OnigCodePoint code;
OnigUChar *to_start = to; OnigUChar *to_start = to;
@ -987,7 +987,7 @@ onigenc_ascii_only_case_map(OnigCaseFoldType* flagP, const OnigUChar** pp, const
code += 'A' - 'a'; code += 'A' - 'a';
} }
else if (code >= 'A' && code <= 'Z' && else if (code >= 'A' && code <= 'Z' &&
(flags & (ONIGENC_CASE_DOWNCASE | ONIGENC_CASE_FOLD))) { (flags & (ONIGENC_CASE_DOWNCASE | ONIGENC_CASE_FOLD))) {
flags |= ONIGENC_CASE_MODIFIED; flags |= ONIGENC_CASE_MODIFIED;
code += 'a' - 'A'; code += 'a' - 'A';
} }
@ -1001,8 +1001,8 @@ onigenc_ascii_only_case_map(OnigCaseFoldType* flagP, const OnigUChar** pp, const
extern int extern int
onigenc_single_byte_ascii_only_case_map(OnigCaseFoldType* flagP, const OnigUChar** pp, onigenc_single_byte_ascii_only_case_map(OnigCaseFoldType* flagP, const OnigUChar** pp,
const OnigUChar* end, OnigUChar* to, OnigUChar* to_end, const OnigUChar* end, OnigUChar* to, OnigUChar* to_end,
const struct OnigEncodingTypeST* enc) const struct OnigEncodingTypeST* enc)
{ {
OnigCodePoint code; OnigCodePoint code;
OnigUChar *to_start = to; OnigUChar *to_start = to;
@ -1016,7 +1016,7 @@ onigenc_single_byte_ascii_only_case_map(OnigCaseFoldType* flagP, const OnigUChar
code += 'A' - 'a'; code += 'A' - 'a';
} }
else if (code >= 'A' && code <= 'Z' && else if (code >= 'A' && code <= 'Z' &&
(flags & (ONIGENC_CASE_DOWNCASE | ONIGENC_CASE_FOLD))) { (flags & (ONIGENC_CASE_DOWNCASE | ONIGENC_CASE_FOLD))) {
flags |= ONIGENC_CASE_MODIFIED; flags |= ONIGENC_CASE_MODIFIED;
code += 'a' - 'A'; code += 'a' - 'A';
} }

View file

@ -192,8 +192,8 @@ ONIG_EXTERN int onigenc_unicode_apply_all_case_fold(OnigCaseFoldType flag, OnigA
#define UTF16_IS_SURROGATE_SECOND(c) (((c) & 0xfc) == 0xdc) #define UTF16_IS_SURROGATE_SECOND(c) (((c) & 0xfc) == 0xdc)
#define UTF16_IS_SURROGATE(c) (((c) & 0xf8) == 0xd8) #define UTF16_IS_SURROGATE(c) (((c) & 0xf8) == 0xd8)
#define UNICODE_VALID_CODEPOINT_P(c) ( \ #define UNICODE_VALID_CODEPOINT_P(c) ( \
((c) <= 0x10ffff) && \ ((c) <= 0x10ffff) && \
!((c) < 0x10000 && UTF16_IS_SURROGATE((c) >> 8))) !((c) < 0x10000 && UTF16_IS_SURROGATE((c) >> 8)))
#define ONIGENC_ISO_8859_1_TO_LOWER_CASE(c) \ #define ONIGENC_ISO_8859_1_TO_LOWER_CASE(c) \
OnigEncISO_8859_1_ToLowerCaseTable[c] OnigEncISO_8859_1_ToLowerCaseTable[c]
@ -239,8 +239,8 @@ extern int ONIG_ENC_REGISTER(const char *, OnigEncoding);
# define OnigEncodingDefine(f,n) \ # define OnigEncodingDefine(f,n) \
OnigEncodingDeclare(n); \ OnigEncodingDeclare(n); \
void Init_##f(void) { \ void Init_##f(void) { \
ONIG_ENC_REGISTER(OnigEncodingName(n).name, \ ONIG_ENC_REGISTER(OnigEncodingName(n).name, \
&OnigEncodingName(n)); \ &OnigEncodingName(n)); \
} \ } \
OnigEncodingDeclare(n) OnigEncodingDeclare(n)
#else #else

View file

@ -194,7 +194,7 @@ static void sprint_byte_with_x(char* s, unsigned int v)
} }
static int to_ascii(OnigEncoding enc, UChar *s, UChar *end, static int to_ascii(OnigEncoding enc, UChar *s, UChar *end,
UChar buf[], int buf_size, int *is_over) UChar buf[], int buf_size, int *is_over)
{ {
int len; int len;
UChar *p; UChar *p;
@ -206,24 +206,24 @@ static int to_ascii(OnigEncoding enc, UChar *s, UChar *end,
while (p < end) { while (p < end) {
code = ONIGENC_MBC_TO_CODE(enc, p, end); code = ONIGENC_MBC_TO_CODE(enc, p, end);
if (code >= 0x80) { if (code >= 0x80) {
if (code > 0xffff && len + 10 <= buf_size) { if (code > 0xffff && len + 10 <= buf_size) {
sprint_byte_with_x((char*)(&(buf[len])), (unsigned int)(code >> 24)); sprint_byte_with_x((char*)(&(buf[len])), (unsigned int)(code >> 24));
sprint_byte((char*)(&(buf[len+4])), (unsigned int)(code >> 16)); sprint_byte((char*)(&(buf[len+4])), (unsigned int)(code >> 16));
sprint_byte((char*)(&(buf[len+6])), (unsigned int)(code >> 8)); sprint_byte((char*)(&(buf[len+6])), (unsigned int)(code >> 8));
sprint_byte((char*)(&(buf[len+8])), (unsigned int)code); sprint_byte((char*)(&(buf[len+8])), (unsigned int)code);
len += 10; len += 10;
} }
else if (len + 6 <= buf_size) { else if (len + 6 <= buf_size) {
sprint_byte_with_x((char*)(&(buf[len])), (unsigned int)(code >> 8)); sprint_byte_with_x((char*)(&(buf[len])), (unsigned int)(code >> 8));
sprint_byte((char*)(&(buf[len+4])), (unsigned int)code); sprint_byte((char*)(&(buf[len+4])), (unsigned int)code);
len += 6; len += 6;
} }
else { else {
break; break;
} }
} }
else { else {
buf[len++] = (UChar )code; buf[len++] = (UChar )code;
} }
p += enclen(enc, p, end); p += enclen(enc, p, end);
@ -267,27 +267,27 @@ onig_error_code_to_str(UChar* s, OnigPosition code, ...)
case ONIGERR_INVALID_CHAR_PROPERTY_NAME: case ONIGERR_INVALID_CHAR_PROPERTY_NAME:
einfo = va_arg(vargs, OnigErrorInfo*); einfo = va_arg(vargs, OnigErrorInfo*);
len = to_ascii(einfo->enc, einfo->par, einfo->par_end, len = to_ascii(einfo->enc, einfo->par, einfo->par_end,
parbuf, MAX_ERROR_PAR_LEN - 3, &is_over); parbuf, MAX_ERROR_PAR_LEN - 3, &is_over);
q = onig_error_code_to_format(code); q = onig_error_code_to_format(code);
p = s; p = s;
while (*q != '\0') { while (*q != '\0') {
if (*q == '%') { if (*q == '%') {
q++; q++;
if (*q == 'n') { /* '%n': name */ if (*q == 'n') { /* '%n': name */
xmemcpy(p, parbuf, len); xmemcpy(p, parbuf, len);
p += len; p += len;
if (is_over != 0) { if (is_over != 0) {
xmemcpy(p, "...", 3); xmemcpy(p, "...", 3);
p += 3; p += 3;
} }
q++; q++;
} }
else else
goto normal_char; goto normal_char;
} }
else { else {
normal_char: normal_char:
*p++ = *q++; *p++ = *q++;
} }
} }
*p = '\0'; *p = '\0';
@ -348,24 +348,24 @@ onig_vsnprintf_with_pattern(UChar buf[], int bufsize, OnigEncoding enc,
} }
} }
else if (*p == '\\') { else if (*p == '\\') {
*s++ = *p++; *s++ = *p++;
len = enclen(enc, p, pat_end); len = enclen(enc, p, pat_end);
while (len-- > 0) *s++ = *p++; while (len-- > 0) *s++ = *p++;
} }
else if (*p == '/') { else if (*p == '/') {
*s++ = (unsigned char )'\\'; *s++ = (unsigned char )'\\';
*s++ = *p++; *s++ = *p++;
} }
else if (!ONIGENC_IS_CODE_PRINT(enc, *p) && else if (!ONIGENC_IS_CODE_PRINT(enc, *p) &&
(!ONIGENC_IS_CODE_SPACE(enc, *p) || (!ONIGENC_IS_CODE_SPACE(enc, *p) ||
ONIGENC_IS_CODE_CNTRL(enc, *p))) { ONIGENC_IS_CODE_CNTRL(enc, *p))) {
sprint_byte_with_x((char* )bs, (unsigned int )(*p++)); sprint_byte_with_x((char* )bs, (unsigned int )(*p++));
len = onigenc_str_bytelen_null(ONIG_ENCODING_ASCII, bs); len = onigenc_str_bytelen_null(ONIG_ENCODING_ASCII, bs);
bp = bs; bp = bs;
while (len-- > 0) *s++ = *bp++; while (len-- > 0) *s++ = *bp++;
} }
else { else {
*s++ = *p++; *s++ = *p++;
} }
} }
@ -382,7 +382,7 @@ onig_snprintf_with_pattern(UChar buf[], int bufsize, OnigEncoding enc,
va_list args; va_list args;
va_start(args, fmt); va_start(args, fmt);
onig_vsnprintf_with_pattern(buf, bufsize, enc, onig_vsnprintf_with_pattern(buf, bufsize, enc,
pat, pat_end, fmt, args); pat, pat_end, fmt, args);
va_end(args); va_end(args);
} }
#endif #endif

2596
regexec.c

File diff suppressed because it is too large Load diff

2498
regparse.c

File diff suppressed because it is too large Load diff

View file

@ -69,8 +69,8 @@ RUBY_SYMBOL_EXPORT_BEGIN
#define NTYPE(node) ((node)->u.base.type) #define NTYPE(node) ((node)->u.base.type)
#define SET_NTYPE(node, ntype) \ #define SET_NTYPE(node, ntype) \
do { \ do { \
int value = ntype; \ int value = ntype; \
memcpy(&((node)->u.base.type), &value, sizeof(int)); \ memcpy(&((node)->u.base.type), &value, sizeof(int)); \
} while (0) } while (0)
#define NSTR(node) (&((node)->u.str)) #define NSTR(node) (&((node)->u.str))