summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-15 03:20:36 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-15 03:20:36 +0000
commit1178a6fdba491548089c1765c2099bd9ce538bcc (patch)
treee80b1c838cad35bfb5be440ad22b94a7a13c275e
parentd09d1ced1a728ac676f35d9d80156a54b71a958a (diff)
* lib/erb.rb: Simplify regexp to optimize erb scanner.
[fix GH-1144] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53121 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--lib/erb.rb4
2 files changed, 7 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 5264327..e50863a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Tue Dec 15 12:20:30 2015 Takashi Kokubun <takashikkbn@gmail.com>
+
+ * lib/erb.rb: Simplify regexp to optimize erb scanner.
+ [fix GH-1144]
+
Tue Dec 15 11:56:24 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
* lib/uri/common.rb: make code block for rdoc.
diff --git a/lib/erb.rb b/lib/erb.rb
index 25654d6..b099c82 100644
--- a/lib/erb.rb
+++ b/lib/erb.rb
@@ -506,8 +506,8 @@ class ERB
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)