From ca34d7075a9aa3c8355b8f062d13cdad0ae8e652 Mon Sep 17 00:00:00 2001 From: k0kubun Date: Sat, 20 May 2017 14:55:33 +0000 Subject: 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 --- lib/erb.rb | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) (limited to 'lib') 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 -- cgit v1.2.3