Class: YARD::Parser::Ruby::RipperParser
- Inherits:
-
Ripper
- Object
- Ripper
- YARD::Parser::Ruby::RipperParser
- Defined in:
- lib/yard/parser/ruby/ruby_parser.rb
Constant Summary
- MAPPINGS =
{ :BEGIN => "BEGIN", :END => "END", :alias => "alias", :array => :lbracket, :arg_paren => :lparen, :begin => "begin", :blockarg => "&", :brace_block => :lbrace, :break => "break", :case => "case", :class => "class", :def => "def", :defined => "defined?", :defs => "def", :do_block => "do", :else => "else", :elsif => "elsif", :ensure => "ensure", :for => "for", :hash => :lbrace, :if => "if", :lambda => [:tlambda, "lambda"], :module => "module", :next => "next", :paren => :lparen, :qwords_literal => :qwords_beg, :redo => "redo", :regexp_literal => :regexp_beg, :rescue => "rescue", :rest_param => "*", :retry => "retry", :return => "return", :return0 => "return", :sclass => "class", :string_embexpr => :embexpr_beg, :string_literal => [:tstring_beg, :heredoc_beg], :super => "super", :symbol => :symbeg, :top_const_ref => "::", :undef => "undef", :unless => "unless", :until => "until", :when => "when", :while => "while", :xstring_literal => :backtick, :yield => "yield", :yield0 => "yield", :zsuper => "super" }
- REV_MAPPINGS =
{}
- AST_TOKENS =
[:CHAR, :backref, :const, :cvar, :gvar, :heredoc_end, :ident, :int, :float, :ivar, :label, :period, :regexp_end, :tstring_content, :backtick]
Instance Attribute Summary (collapse)
-
- (Object) ast
(also: #root)
readonly
Returns the value of attribute ast.
-
- (Object) charno
readonly
Returns the value of attribute charno.
-
- (Object) comments
readonly
Returns the value of attribute comments.
-
- (Object) encoding_line
readonly
Returns the value of attribute encoding_line.
-
- (Object) file
readonly
Returns the value of attribute file.
-
- (Object) shebang_line
readonly
Returns the value of attribute shebang_line.
-
- (Object) tokens
readonly
Returns the value of attribute tokens.
Instance Method Summary (collapse)
- - (Object) enumerator
-
- (RipperParser) initialize(source, filename, *args)
constructor
A new instance of RipperParser.
- - (Object) parse
Constructor Details
- (RipperParser) initialize(source, filename, *args)
A new instance of RipperParser
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/yard/parser/ruby/ruby_parser.rb', line 29 def initialize(source, filename, *args) super @last_ns_token = nil @file = filename @source = source @tokens = [] @comments = {} @comments_flags = {} @heredoc_tokens = nil @heredoc_state = nil @map = {} @ns_charno = 0 @list = [] @charno = 0 @groups = [] @shebang_line = nil @encoding_line = nil end |
Instance Attribute Details
- (Object) ast (readonly) Also known as: root
Returns the value of attribute ast
25 26 27 |
# File 'lib/yard/parser/ruby/ruby_parser.rb', line 25 def ast @ast end |
- (Object) charno (readonly)
Returns the value of attribute charno
25 26 27 |
# File 'lib/yard/parser/ruby/ruby_parser.rb', line 25 def charno @charno end |
- (Object) comments (readonly)
Returns the value of attribute comments
25 26 27 |
# File 'lib/yard/parser/ruby/ruby_parser.rb', line 25 def comments @comments end |
- (Object) encoding_line (readonly)
Returns the value of attribute encoding_line
26 27 28 |
# File 'lib/yard/parser/ruby/ruby_parser.rb', line 26 def encoding_line @encoding_line end |
- (Object) file (readonly)
Returns the value of attribute file
25 26 27 |
# File 'lib/yard/parser/ruby/ruby_parser.rb', line 25 def file @file end |
- (Object) shebang_line (readonly)
Returns the value of attribute shebang_line
26 27 28 |
# File 'lib/yard/parser/ruby/ruby_parser.rb', line 26 def shebang_line @shebang_line end |
- (Object) tokens (readonly)
Returns the value of attribute tokens
25 26 27 |
# File 'lib/yard/parser/ruby/ruby_parser.rb', line 25 def tokens @tokens end |
Instance Method Details
- (Object) enumerator
57 58 59 |
# File 'lib/yard/parser/ruby/ruby_parser.rb', line 57 def enumerator ast.children end |
- (Object) parse
48 49 50 51 52 53 54 55 |
# File 'lib/yard/parser/ruby/ruby_parser.rb', line 48 def parse @ast = super @ast.full_source = @source @ast.file = @file freeze_tree insert_comments self end |