ruby-changes:57894
From: Nobuyoshi <ko1@a...>
Date: Wed, 25 Sep 2019 13:56:08 +0900 (JST)
Subject: [ruby-changes:57894] 33c5ad3154 (master): Removed idNUMPARAM_0
https://git.ruby-lang.org/ruby.git/commit/?id=33c5ad3154 From 33c5ad3154099769cec7f77b6d95cbf4b8d52bb0 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Wed, 25 Sep 2019 13:51:49 +0900 Subject: Removed idNUMPARAM_0 diff --git a/defs/id.def b/defs/id.def index f0e1db9..a35b5d5 100644 --- a/defs/id.def +++ b/defs/id.def @@ -60,7 +60,6 @@ firstline, predefined = __LINE__+1, %[\ https://github.com/ruby/ruby/blob/trunk/defs/id.def#L60 _ UScore # MUST be successive - _0 NUMPARAM_0 _1 NUMPARAM_1 _2 NUMPARAM_2 _3 NUMPARAM_3 diff --git a/parse.y b/parse.y index 48dd44a..14568d9 100644 --- a/parse.y +++ b/parse.y @@ -173,9 +173,16 @@ enum { https://github.com/ruby/ruby/blob/trunk/parse.y#L173 NUMPARAM_MAX = 9, }; -#define NUMPARAM_ID_P(id) (is_local_id(id) && NUMPARAM_ID_TO_IDX(id) <= NUMPARAM_MAX) -#define NUMPARAM_ID_TO_IDX(id) (unsigned int)(((id) >> ID_SCOPE_SHIFT) - tNUMPARAM_0) -#define NUMPARAM_IDX_TO_ID(idx) TOKEN2LOCALID((tNUMPARAM_0 + (idx))) +#define NUMPARAM_ID_P(id) numparam_id_p(id) +#define NUMPARAM_ID_TO_IDX(id) (unsigned int)(((id) >> ID_SCOPE_SHIFT) - tNUMPARAM_1 + 1) +#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_TOPSCOPE NULL diff --git a/test/ripper/test_parser_events.rb b/test/ripper/test_parser_events.rb index 662ab3d..4cb56f6 100644 --- a/test/ripper/test_parser_events.rb +++ b/test/ripper/test_parser_events.rb @@ -60,7 +60,6 @@ class TestRipper::ParserEvents < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ripper/test_parser_events.rb#L60 assert_equal '[ref(true)]', parse('true') assert_equal '[vcall(_0)]', parse('_0') assert_equal '[vcall(_1)]', parse('_1') - assert_include parse('proc{_0}'), '[ref(_0)]' assert_include parse('proc{_1}'), '[ref(_1)]' end -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/