Skip to content

Commit

Permalink
Allow $10 and more in the Ripper DSL
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu committed Nov 26, 2019
1 parent 7db719c commit 265b538
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions ext/ripper/tools/dsl.rb
Expand Up @@ -15,17 +15,14 @@ def initialize(code, options)
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"
Expand Down

0 comments on commit 265b538

Please sign in to comment.