mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
indent [ci skip]
This commit is contained in:
parent
ad6512f359
commit
08fc718e8c
Notes:
git
2020-06-29 11:06:43 +09:00
1 changed files with 22 additions and 22 deletions
44
symbol.c
44
symbol.c
|
@ -321,28 +321,28 @@ rb_enc_symname_type(const char *name, long len, rb_encoding *enc, unsigned int a
|
|||
goto stophere;
|
||||
|
||||
id:
|
||||
if (m >= e || (*m != '_' && !ISALPHA(*m) && ISASCII(*m))) {
|
||||
if (len > 1 && *(e-1) == '=') {
|
||||
type = rb_enc_symname_type(name, len-1, enc, allowed_attrset);
|
||||
if (type != ID_ATTRSET) return ID_ATTRSET;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
while (m < e && is_identchar(m, e, enc)) m += rb_enc_mbclen(m, e, enc);
|
||||
if (m >= e) goto stophere;
|
||||
switch (*m) {
|
||||
case '!': case '?':
|
||||
if (type == ID_GLOBAL || type == ID_CLASS || type == ID_INSTANCE) return -1;
|
||||
type = ID_JUNK;
|
||||
++m;
|
||||
if (m + 1 < e || *m != '=') break;
|
||||
/* fall through */
|
||||
case '=':
|
||||
if (!(allowed_attrset & (1U << type))) return -1;
|
||||
type = ID_ATTRSET;
|
||||
++m;
|
||||
break;
|
||||
}
|
||||
if (m >= e || (*m != '_' && !ISALPHA(*m) && ISASCII(*m))) {
|
||||
if (len > 1 && *(e-1) == '=') {
|
||||
type = rb_enc_symname_type(name, len-1, enc, allowed_attrset);
|
||||
if (type != ID_ATTRSET) return ID_ATTRSET;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
while (m < e && is_identchar(m, e, enc)) m += rb_enc_mbclen(m, e, enc);
|
||||
if (m >= e) goto stophere;
|
||||
switch (*m) {
|
||||
case '!': case '?':
|
||||
if (type == ID_GLOBAL || type == ID_CLASS || type == ID_INSTANCE) return -1;
|
||||
type = ID_JUNK;
|
||||
++m;
|
||||
if (m + 1 < e || *m != '=') break;
|
||||
/* fall through */
|
||||
case '=':
|
||||
if (!(allowed_attrset & (1U << type))) return -1;
|
||||
type = ID_ATTRSET;
|
||||
++m;
|
||||
break;
|
||||
}
|
||||
|
||||
stophere:
|
||||
return m == e ? type : -1;
|
||||
|
|
Loading…
Reference in a new issue