Allow $10
and more in the Ripper DSL
This commit is contained in:
parent
7db719c516
commit
265b5382b2
@ -15,17 +15,14 @@ class DSL
|
|||||||
if options.include?("final")
|
if options.include?("final")
|
||||||
@final = "p->result"
|
@final = "p->result"
|
||||||
else
|
else
|
||||||
@final = (options.grep(/\A\$[$\d]\z/)[0] || "$$")
|
@final = (options.grep(/\A\$(?:\$|\d+)\z/)[0] || "$$")
|
||||||
end
|
end
|
||||||
@vars = 0
|
@vars = 0
|
||||||
|
|
||||||
# create $1 == "$1", $2 == "$2", ...
|
# create $1 == "$1", $2 == "$2", ...
|
||||||
re, s = "", ""
|
s = (1..20).map {|n| "$#{n}"}
|
||||||
1.upto(9) do |n|
|
re = Array.new(s.size, "([^\0]+)")
|
||||||
re << "(..)"
|
/#{re.join("\0")}/ =~ s.join("\0")
|
||||||
s << "$#{ n }"
|
|
||||||
end
|
|
||||||
/#{ re }/ =~ s
|
|
||||||
|
|
||||||
# struct parser_params *p
|
# struct parser_params *p
|
||||||
p = p = "p"
|
p = p = "p"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user