diff options
author | zzak <zzak@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-09-12 23:04:41 +0000 |
---|---|---|
committer | zzak <zzak@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-09-12 23:04:41 +0000 |
commit | 8f0d172f581351e89497ce5f9893b4be0f887b6d (patch) | |
tree | 677c73a013d2f023b5f926952f738cc39753e963 /ext/ripper/lib/ripper/filter.rb | |
parent | 857ec7118f69b140f5fd09b16fac9e28b90508f8 (diff) |
* ext/ripper/lib/ripper.rb: Documentation for Ripper.
* ext/ripper/lib/ripper/lexer.rb: ditto.
* ext/ripper/lib/ripper/sexp.rb: ditto.
* ext/ripper/lib/ripper/filter.rb: ditto.
* ext/ripper/lib/ripper/core.rb: ditto.
[Bug #6929] [ruby-core:47309]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36954 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/ripper/lib/ripper/filter.rb')
-rw-r--r-- | ext/ripper/lib/ripper/filter.rb | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/ext/ripper/lib/ripper/filter.rb b/ext/ripper/lib/ripper/filter.rb index 898501b23c..239f9f00e1 100644 --- a/ext/ripper/lib/ripper/filter.rb +++ b/ext/ripper/lib/ripper/filter.rb @@ -13,9 +13,13 @@ require 'ripper/lexer' class Ripper # This class handles only scanner events, - # and they are dispatched in the `right' order (same with input). + # which are dispatched in the 'right' order (same with input). class Filter + # Creates a new Ripper::Filter instance, passes parameters +src+, + # +filename+, and +lineno+ to Ripper::Lexer.new + # + # The lexer is for internal use only. def initialize(src, filename = '-', lineno = 1) @__lexer = Lexer.new(src, filename, lineno) @__line = nil @@ -41,8 +45,9 @@ class Ripper @__col end - # Starts parsing. _init_ is a data accumulator. - # It is passed to the next event handler (as of Enumerable#inject). + # Starts the parser. + # +init+ is a data accumulator and is passed to the next event handler (as + # of Enumerable#inject). def parse(init = nil) data = init @__lexer.lex.each do |pos, event, tok| @@ -57,10 +62,12 @@ class Ripper private - # This method is called when some event handler have not defined. - # _event_ is :on_XXX, _token_ is scanned token, _data_ is a data - # accumulator. The return value of this method is passed to the - # next event handler (as of Enumerable#inject). + # This method is called when some event handler is undefined. + # +event+ is :on_XXX, +token+ is the scanned token, and +data+ is a data + # accumulator. + # + # The return value of this method is passed to the next event handler (as + # of Enumerable#inject). def on_default(event, token, data) data end |