summaryrefslogtreecommitdiff
path: root/lib/erb.rb
diff options
context:
space:
mode:
authork0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-05-20 14:55:33 +0000
committerk0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-05-20 14:55:33 +0000
commitca34d7075a9aa3c8355b8f062d13cdad0ae8e652 (patch)
treec1d3b3c2cc0bc70f3d70915a2c666d0f180bd6c6 /lib/erb.rb
parentf1e10bd2798a3af59d8fd8b3c7197ce69598d275 (diff)
erb.rb: Drop unused scanner implementation
Original `SimpleScanner` was used only in tests. Since `SimpleScanner` and `SimpleScanner2` work in the same way, I want to drop the one which can't be used in a normal situation. The only difference was `SimpleScanner` can be loaded without strscan dependency but I think there's no situation that strscan is unavailable because it's a standard library. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58819 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/erb.rb')
-rw-r--r--lib/erb.rb20
1 files changed, 5 insertions, 15 deletions
diff --git a/lib/erb.rb b/lib/erb.rb
index ae2bfd0091..3ff64cbb3d 100644
--- a/lib/erb.rb
+++ b/lib/erb.rb
@@ -499,22 +499,9 @@ class ERB
Scanner.default_scanner = TrimScanner
- class SimpleScanner < Scanner # :nodoc:
- def scan
- @src.scan(/(.*?)(#{(stags + etags).join('|')}|\n|\z)/m) do |tokens|
- tokens.each do |token|
- next if token.empty?
- yield(token)
- end
- end
- end
- end
-
- Scanner.regist_scanner(SimpleScanner, nil, false)
-
begin
require 'strscan'
- class SimpleScanner2 < Scanner # :nodoc:
+ class SimpleScanner < Scanner # :nodoc:
def scan
stag_reg = /(.*?)(#{stags.join('|')}|\z)/m
etag_reg = /(.*?)(#{etags.join('|')}|\z)/m
@@ -526,7 +513,10 @@ class ERB
end
end
end
- Scanner.regist_scanner(SimpleScanner2, nil, false)
+ Scanner.regist_scanner(SimpleScanner, nil, false)
+
+ # Deprecated. Kept for backward compatibility.
+ SimpleScanner2 = SimpleScanner # :nodoc:
class ExplicitScanner < Scanner # :nodoc:
def scan