mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
d09d1ced1a
commit
1178a6fdba
2 changed files with 7 additions and 2 deletions
|
@ -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>
|
Tue Dec 15 11:56:24 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
|
||||||
|
|
||||||
* lib/uri/common.rb: make code block for rdoc.
|
* lib/uri/common.rb: make code block for rdoc.
|
||||||
|
|
|
@ -506,8 +506,8 @@ class ERB
|
||||||
require 'strscan'
|
require 'strscan'
|
||||||
class SimpleScanner2 < Scanner # :nodoc:
|
class SimpleScanner2 < Scanner # :nodoc:
|
||||||
def scan
|
def scan
|
||||||
stag_reg = /(.*?)(<%%|<%=|<%#|<%|\z)/m
|
stag_reg = /(.*?)(<%[%=#]?|\z)/m
|
||||||
etag_reg = /(.*?)(%%>|%>|\z)/m
|
etag_reg = /(.*?)(%%?>|\z)/m
|
||||||
scanner = StringScanner.new(@src)
|
scanner = StringScanner.new(@src)
|
||||||
while ! scanner.eos?
|
while ! scanner.eos?
|
||||||
scanner.scan(@stag ? etag_reg : stag_reg)
|
scanner.scan(@stag ? etag_reg : stag_reg)
|
||||||
|
|
Loading…
Reference in a new issue