From 1a98528cb7afc8f8de5af50e5d51c83b251ea860 Mon Sep 17 00:00:00 2001 From: nobu Date: Sun, 25 Oct 2015 01:12:07 +0000 Subject: [PATCH] symbol.c: dotq in ripper * symbol.c (op_tbl): add DOTQ for ripper. [Feature #11537] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52276 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 4 ++++ ext/ripper/eventids2.c | 1 + symbol.c | 2 ++ test/ripper/test_scanner_events.rb | 2 ++ 4 files changed, 9 insertions(+) diff --git a/ChangeLog b/ChangeLog index f9d6f90edb..877d0fdcca 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Sun Oct 25 10:12:05 2015 Nobuyoshi Nakada + + * symbol.c (op_tbl): add DOTQ for ripper. [Feature #11537] + Sat Oct 24 22:51:18 2015 SHIBATA Hiroshi * configure.in: fixed build failure of Haiku. diff --git a/ext/ripper/eventids2.c b/ext/ripper/eventids2.c index abbe584454..5b624c2865 100644 --- a/ext/ripper/eventids2.c +++ b/ext/ripper/eventids2.c @@ -257,6 +257,7 @@ static const struct token_assoc { {tRSHFT, O(op)}, {tSTAR, O(op)}, {tDSTAR, O(op)}, + {tDOTQ, O(op)}, {tSTRING_BEG, O(tstring_beg)}, {tSTRING_CONTENT, O(tstring_content)}, {tSTRING_DBEG, O(embexpr_beg)}, diff --git a/symbol.c b/symbol.c index 9917795190..f0ba5e7f02 100644 --- a/symbol.c +++ b/symbol.c @@ -50,6 +50,7 @@ static ID register_static_symid_str(ID, VALUE); #define tCOLON2 RUBY_TOKEN(COLON2) #define tANDOP RUBY_TOKEN(ANDOP) #define tOROP RUBY_TOKEN(OROP) +#define tDOTQ RUBY_TOKEN(DOTQ) static const struct { unsigned short token; @@ -75,6 +76,7 @@ static const struct { {tCOLON2, "::"}, {tANDOP, "&&"}, {tOROP, "||"}, + {tDOTQ, ".?"}, }; #define op_tbl_count numberof(op_tbl) diff --git a/test/ripper/test_scanner_events.rb b/test/ripper/test_scanner_events.rb index e57300ed0f..56ba646485 100644 --- a/test/ripper/test_scanner_events.rb +++ b/test/ripper/test_scanner_events.rb @@ -535,6 +535,8 @@ class TestRipper::ScannerEvents < Test::Unit::TestCase scan('op', ':[]') assert_equal ['[]='], scan('op', ':[]=') + assert_equal ['.?'], + scan('op', 'a.?f') assert_equal [], scan('op', %q[`make all`]) end