summaryrefslogtreecommitdiff
path: root/ext/ripper/lib
diff options
context:
space:
mode:
authoraamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-02-04 09:46:18 +0000
committeraamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-02-04 09:46:18 +0000
commit889ca023e33ae35c259d02912187ac31be4f5362 (patch)
treea0d1617946ade2fc79e5075709d3895b4de31db0 /ext/ripper/lib
parent6a24d7ed9b5cbe0d7caa74869aa83cd8a412394d (diff)
* 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
Diffstat (limited to 'ext/ripper/lib')
-rw-r--r--ext/ripper/lib/ripper/lexer.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/ext/ripper/lib/ripper/lexer.rb b/ext/ripper/lib/ripper/lexer.rb
index 35074ac..20436f6 100644
--- a/ext/ripper/lib/ripper/lexer.rb
+++ b/ext/ripper/lib/ripper/lexer.rb
@@ -41,19 +41,23 @@ class Ripper
class Lexer < ::Ripper #:nodoc: internal use only
def tokenize
- parse().map {|pos, event, tok| tok }
+ lex().map {|pos, event, tok| tok }
end
def lex
+ parse().sort_by {|pos, event, tok| pos }
+ end
+
+ def parse
@buf = []
- parse
- @buf.sort_by {|pos, event, tok| pos }
+ super
+ @buf
end
private
SCANNER_EVENTS.each do |event|
- module_eval(<<-End)
+ module_eval(<<-End, __FILE__+'/module_eval', __LINE__ + 1)
def on_#{event}(tok)
@buf.push [[lineno(), column()], :on_#{event}, tok]
end