mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/ripper/lib/ripper/lexer.rb: last Lexer fix was incomplete; test all green.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7881 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
6a24d7ed9b
commit
889ca023e3
2 changed files with 13 additions and 4 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Fri Feb 4 18:44:35 2005 Minero Aoki <aamine@loveruby.net>
|
||||||
|
|
||||||
|
* ext/ripper/lib/ripper/lexer.rb: last Lexer fix was incomplete;
|
||||||
|
test all green.
|
||||||
|
|
||||||
Fri Feb 4 14:33:25 2005 Minero Aoki <aamine@loveruby.net>
|
Fri Feb 4 14:33:25 2005 Minero Aoki <aamine@loveruby.net>
|
||||||
|
|
||||||
* ext/ripper/lib/ripper/filter.rb: ripper/tokenizer ->
|
* ext/ripper/lib/ripper/filter.rb: ripper/tokenizer ->
|
||||||
|
|
|
@ -41,19 +41,23 @@ class Ripper
|
||||||
|
|
||||||
class Lexer < ::Ripper #:nodoc: internal use only
|
class Lexer < ::Ripper #:nodoc: internal use only
|
||||||
def tokenize
|
def tokenize
|
||||||
parse().map {|pos, event, tok| tok }
|
lex().map {|pos, event, tok| tok }
|
||||||
end
|
end
|
||||||
|
|
||||||
def lex
|
def lex
|
||||||
|
parse().sort_by {|pos, event, tok| pos }
|
||||||
|
end
|
||||||
|
|
||||||
|
def parse
|
||||||
@buf = []
|
@buf = []
|
||||||
parse
|
super
|
||||||
@buf.sort_by {|pos, event, tok| pos }
|
@buf
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
SCANNER_EVENTS.each do |event|
|
SCANNER_EVENTS.each do |event|
|
||||||
module_eval(<<-End)
|
module_eval(<<-End, __FILE__+'/module_eval', __LINE__ + 1)
|
||||||
def on_#{event}(tok)
|
def on_#{event}(tok)
|
||||||
@buf.push [[lineno(), column()], :on_#{event}, tok]
|
@buf.push [[lineno(), column()], :on_#{event}, tok]
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue