ruby-changes:58919
From: Nobuyoshi <ko1@a...>
Date: Tue, 26 Nov 2019 23:09:31 +0900 (JST)
Subject: [ruby-changes:58919] 265b5382b2 (master): Allow `$10` and more in the Ripper DSL
https://git.ruby-lang.org/ruby.git/commit/?id=265b5382b2 From 265b5382b21db28e52d0314ef47025f881dcbf0f Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Tue, 26 Nov 2019 14:00:08 +0900 Subject: Allow `$10` and more in the Ripper DSL diff --git a/ext/ripper/tools/dsl.rb b/ext/ripper/tools/dsl.rb index 27ba87f..d2b9715 100644 --- a/ext/ripper/tools/dsl.rb +++ b/ext/ripper/tools/dsl.rb @@ -15,17 +15,14 @@ class DSL https://github.com/ruby/ruby/blob/trunk/ext/ripper/tools/dsl.rb#L15 if options.include?("final") @final = "p->result" else - @final = (options.grep(/\A\$[$\d]\z/)[0] || "$$") + @final = (options.grep(/\A\$(?:\$|\d+)\z/)[0] || "$$") end @vars = 0 # create $1 == "$1", $2 == "$2", ... - re, s = "", "" - 1.upto(9) do |n| - re << "(..)" - s << "$#{ n }" - end - /#{ re }/ =~ s + s = (1..20).map {|n| "$#{n}"} + re = Array.new(s.size, "([^\0]+)") + /#{re.join("\0")}/ =~ s.join("\0") # struct parser_params *p p = p = "p" -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/