This commit is contained in:
卜部昌平 2020-06-19 10:47:46 +09:00
Родитель ad6512f359
Коммит 08fc718e8c
1 изменённых файлов: 22 добавлений и 22 удалений

Просмотреть файл

@ -321,28 +321,28 @@ rb_enc_symname_type(const char *name, long len, rb_encoding *enc, unsigned int a
goto stophere; goto stophere;
id: id:
if (m >= e || (*m != '_' && !ISALPHA(*m) && ISASCII(*m))) { if (m >= e || (*m != '_' && !ISALPHA(*m) && ISASCII(*m))) {
if (len > 1 && *(e-1) == '=') { if (len > 1 && *(e-1) == '=') {
type = rb_enc_symname_type(name, len-1, enc, allowed_attrset); type = rb_enc_symname_type(name, len-1, enc, allowed_attrset);
if (type != ID_ATTRSET) return ID_ATTRSET; if (type != ID_ATTRSET) return ID_ATTRSET;
} }
return -1; return -1;
} }
while (m < e && is_identchar(m, e, enc)) m += rb_enc_mbclen(m, e, enc); while (m < e && is_identchar(m, e, enc)) m += rb_enc_mbclen(m, e, enc);
if (m >= e) goto stophere; if (m >= e) goto stophere;
switch (*m) { switch (*m) {
case '!': case '?': case '!': case '?':
if (type == ID_GLOBAL || type == ID_CLASS || type == ID_INSTANCE) return -1; if (type == ID_GLOBAL || type == ID_CLASS || type == ID_INSTANCE) return -1;
type = ID_JUNK; type = ID_JUNK;
++m; ++m;
if (m + 1 < e || *m != '=') break; if (m + 1 < e || *m != '=') break;
/* fall through */ /* fall through */
case '=': case '=':
if (!(allowed_attrset & (1U << type))) return -1; if (!(allowed_attrset & (1U << type))) return -1;
type = ID_ATTRSET; type = ID_ATTRSET;
++m; ++m;
break; break;
} }
stophere: stophere:
return m == e ? type : -1; return m == e ? type : -1;