mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
This commit is contained in:
parent
f1e10bd279
commit
ca34d7075a
1 changed files with 5 additions and 15 deletions
20
lib/erb.rb
20
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
|
||||
|
|
Loading…
Reference in a new issue