[ruby/rdoc] Fix polynominal backtracking
Fix https://github.com/ruby/rdoc/pull/995 https://github.com/ruby/rdoc/commit/adfa7db5b9
This commit is contained in:
parent
d239643603
commit
85a9fd1902
@ -2134,7 +2134,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
||||
if :on_nl == tk[:kind] or (:on_kw == tk[:kind] && 'def' == tk[:text]) then
|
||||
return
|
||||
elsif :on_comment == tk[:kind] or :on_embdoc == tk[:kind] then
|
||||
return unless tk[:text] =~ /\s*:?([\w-]+):\s*(.*)/
|
||||
return unless tk[:text] =~ /:?\b([\w-]+):\s*(.*)/
|
||||
|
||||
directive = $1.downcase
|
||||
|
||||
|
@ -3350,6 +3350,13 @@ end
|
||||
assert_equal :on_const, parser.get_tk[:kind]
|
||||
end
|
||||
|
||||
def test_read_directive_linear_performance
|
||||
pre = ->(i) {util_parser '# ' + '0'*i + '=000:'}
|
||||
assert_linear_performance((1..5).map{|i|10**i}, pre: pre) do |parser|
|
||||
assert_nil parser.read_directive []
|
||||
end
|
||||
end
|
||||
|
||||
def test_read_documentation_modifiers
|
||||
c = RDoc::Context.new
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user