File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed
Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -2134,7 +2134,7 @@ def read_directive allowed
21342134 if :on_nl == tk [ :kind ] or ( :on_kw == tk [ :kind ] && 'def' == tk [ :text ] ) then
21352135 return
21362136 elsif :on_comment == tk [ :kind ] or :on_embdoc == tk [ :kind ] then
2137- return unless tk [ :text ] =~ /\s *:? ([\w -]+):\s *(.*)/
2137+ return unless tk [ :text ] =~ /:? \b ([\w -]+):\s *(.*)/
21382138
21392139 directive = $1. downcase
21402140
Original file line number Diff line number Diff line change @@ -3350,6 +3350,13 @@ def test_read_directive_one_liner
33503350 assert_equal :on_const , parser . get_tk [ :kind ]
33513351 end
33523352
3353+ def test_read_directive_linear_performance
3354+ pre = -> ( i ) { util_parser '# ' + '0' *i + '=000:' }
3355+ assert_linear_performance ( ( 1 ..5 ) . map { |i |10 **i } , pre : pre ) do |parser |
3356+ assert_nil parser . read_directive [ ]
3357+ end
3358+ end
3359+
33533360 def test_read_documentation_modifiers
33543361 c = RDoc ::Context . new
33553362
You can’t perform that action at this time.
0 commit comments