1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Removed idNUMPARAM_0

This commit is contained in:
Nobuyoshi Nakada 2019-09-25 13:51:49 +09:00
parent 55e1e22b2d
commit 33c5ad3154
No known key found for this signature in database
GPG key ID: 4BC7D6DF58D8DF60
3 changed files with 10 additions and 5 deletions

View file

@ -60,7 +60,6 @@ firstline, predefined = __LINE__+1, %[\
_ UScore _ UScore
# MUST be successive # MUST be successive
_0 NUMPARAM_0
_1 NUMPARAM_1 _1 NUMPARAM_1
_2 NUMPARAM_2 _2 NUMPARAM_2
_3 NUMPARAM_3 _3 NUMPARAM_3

13
parse.y
View file

@ -173,9 +173,16 @@ enum {
NUMPARAM_MAX = 9, NUMPARAM_MAX = 9,
}; };
#define NUMPARAM_ID_P(id) (is_local_id(id) && NUMPARAM_ID_TO_IDX(id) <= NUMPARAM_MAX) #define NUMPARAM_ID_P(id) numparam_id_p(id)
#define NUMPARAM_ID_TO_IDX(id) (unsigned int)(((id) >> ID_SCOPE_SHIFT) - tNUMPARAM_0) #define NUMPARAM_ID_TO_IDX(id) (unsigned int)(((id) >> ID_SCOPE_SHIFT) - tNUMPARAM_1 + 1)
#define NUMPARAM_IDX_TO_ID(idx) TOKEN2LOCALID((tNUMPARAM_0 + (idx))) #define NUMPARAM_IDX_TO_ID(idx) TOKEN2LOCALID((tNUMPARAM_1 + (idx) - 1))
static int
numparam_id_p(ID id)
{
if (!is_local_id(id)) return 0;
unsigned int idx = NUMPARAM_ID_TO_IDX(id);
return idx > 0 && idx <= NUMPARAM_MAX;
}
#define DVARS_INHERIT ((void*)1) #define DVARS_INHERIT ((void*)1)
#define DVARS_TOPSCOPE NULL #define DVARS_TOPSCOPE NULL

View file

@ -60,7 +60,6 @@ class TestRipper::ParserEvents < Test::Unit::TestCase
assert_equal '[ref(true)]', parse('true') assert_equal '[ref(true)]', parse('true')
assert_equal '[vcall(_0)]', parse('_0') assert_equal '[vcall(_0)]', parse('_0')
assert_equal '[vcall(_1)]', parse('_1') assert_equal '[vcall(_1)]', parse('_1')
assert_include parse('proc{_0}'), '[ref(_0)]'
assert_include parse('proc{_1}'), '[ref(_1)]' assert_include parse('proc{_1}'), '[ref(_1)]'
end end