зеркало из https://github.com/github/ruby.git
* ext/ripper/lib/ripper/tokenizer.rb: new file.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6934 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
b1e943f465
Коммит
d781183f42
|
@ -1,3 +1,7 @@
|
|||
Mon Sep 20 15:17:47 2004 Minero Aoki <aamine@loveruby.net>
|
||||
|
||||
* ext/ripper/lib/ripper/tokenizer.rb: new file.
|
||||
|
||||
Mon Sep 20 15:13:52 2004 Minero Aoki <aamine@loveruby.net>
|
||||
|
||||
* test/ripper/test_scanner_events.rb: test #lineno and #column.
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
#
|
||||
# ripper/tokenizer.rb
|
||||
#
|
||||
# Copyright (C) 2004 Minero Aoki
|
||||
#
|
||||
# This program is free software.
|
||||
# You can distribute and/or modify this program under the Ruby License.
|
||||
# For details of Ruby License, see ruby/COPYING.
|
||||
#
|
||||
|
||||
require 'ripper'
|
||||
|
||||
class Ripper
|
||||
|
||||
def Ripper.tokenize(str)
|
||||
Tokenizer.tokenize(str)
|
||||
end
|
||||
|
||||
class Tokenizer < ::Ripper
|
||||
def Tokenizer.tokenize(str)
|
||||
new(str).tokenize
|
||||
end
|
||||
|
||||
def tokenize
|
||||
@tokens = []
|
||||
parse
|
||||
@tokens
|
||||
end
|
||||
|
||||
def on__scan(type, tok)
|
||||
@tokens.push tok
|
||||
end
|
||||
end
|
||||
|
||||
end
|
Загрузка…
Ссылка в новой задаче