summaryrefslogtreecommitdiff
path: root/ext/ripper/lib
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-28 06:56:23 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-28 06:56:23 +0000
commitef44c0ad2fc9c91e90b69a1cfa88f923ac169256 (patch)
tree0418e3ba0a73c11bb0f2bc3197a8f6b3c5e83ea3 /ext/ripper/lib
parentcf2b422fc58bd34332a123896253b12c627d8b21 (diff)
ripper/lexer.rb: dispatch alias
* ext/ripper/lib/ripper/lexer.rb: alias same methods instead of eval for each events. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52776 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/ripper/lib')
-rw-r--r--ext/ripper/lib/ripper/lexer.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/ext/ripper/lib/ripper/lexer.rb b/ext/ripper/lib/ripper/lexer.rb
index c0a64d1..586d080 100644
--- a/ext/ripper/lib/ripper/lexer.rb
+++ b/ext/ripper/lib/ripper/lexer.rb
@@ -60,12 +60,12 @@ class Ripper
private
+ def _push_token(tok)
+ @buf.push [[lineno(), column()], __callee__, tok]
+ end
+
SCANNER_EVENTS.each do |event|
- module_eval(<<-End, __FILE__+'/module_eval', __LINE__ + 1)
- def on_#{event}(tok)
- @buf.push [[lineno(), column()], :on_#{event}, tok]
- end
- End
+ alias_method "on_#{event}", :_push_token
end
end