mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Allow $10
and more in the Ripper DSL
This commit is contained in:
parent
7db719c516
commit
265b5382b2
1 changed files with 4 additions and 7 deletions
|
@ -15,17 +15,14 @@ class DSL
|
|||
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"
|
||||
|
|
Loading…
Add table
Reference in a new issue