ruby-changes:41044
From: hsbt <ko1@a...>
Date: Tue, 15 Dec 2015 12:20:45 +0900 (JST)
Subject: [ruby-changes:41044] hsbt:r53121 (trunk): * lib/erb.rb: Simplify regexp to optimize erb scanner.
hsbt 2015-12-15 12:20:36 +0900 (Tue, 15 Dec 2015) New Revision: 53121 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=53121 Log: * lib/erb.rb: Simplify regexp to optimize erb scanner. [fix GH-1144] Modified files: trunk/ChangeLog trunk/lib/erb.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 53120) +++ ChangeLog (revision 53121) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Tue Dec 15 12:20:30 2015 Takashi Kokubun <takashikkbn@g...> + + * lib/erb.rb: Simplify regexp to optimize erb scanner. + [fix GH-1144] + Tue Dec 15 11:56:24 2015 SHIBATA Hiroshi <hsbt@r...> * lib/uri/common.rb: make code block for rdoc. Index: lib/erb.rb =================================================================== --- lib/erb.rb (revision 53120) +++ lib/erb.rb (revision 53121) @@ -506,8 +506,8 @@ class ERB https://github.com/ruby/ruby/blob/trunk/lib/erb.rb#L506 require 'strscan' class SimpleScanner2 < Scanner # :nodoc: def scan - stag_reg = /(.*?)(<%%|<%=|<%#|<%|\z)/m - etag_reg = /(.*?)(%%>|%>|\z)/m + stag_reg = /(.*?)(<%[%=#]?|\z)/m + etag_reg = /(.*?)(%%?>|\z)/m scanner = StringScanner.new(@src) while ! scanner.eos? scanner.scan(@stag ? etag_reg : stag_reg) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/