Class: YARD::Parser::Ruby::RipperParser
- Inherits:
-
Ripper
- Object
- Ripper
- YARD::Parser::Ruby::RipperParser
- Defined in:
- lib/yard/parser/ruby/ruby_parser.rb
Overview
Internal parser class
Instance Attribute Summary collapse
- #ast ⇒ Object (also: #root) readonly
- #charno ⇒ Object readonly
- #comments ⇒ Object readonly
- #encoding_line ⇒ Object readonly
- #file ⇒ Object readonly
- #frozen_string_line ⇒ Object readonly
- #shebang_line ⇒ Object readonly
- #tokens ⇒ Object readonly
Instance Method Summary collapse
- #enumerator ⇒ Object
- #file_encoding ⇒ Object
-
#initialize(source, filename, *args) ⇒ RipperParser
constructor
A new instance of RipperParser.
- #parse ⇒ Object
Constructor Details
#initialize(source, filename, *args) ⇒ RipperParser
Returns a new instance of RipperParser.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/yard/parser/ruby/ruby_parser.rb', line 32 def initialize(source, filename, *args) super @last_ns_token = nil @file = filename @source = source @tokens = [] @comments = {} @comments_range = {} @comments_flags = {} @heredoc_tokens = nil @heredoc_state = nil @map = {} @ns_charno = 0 @list = [] @charno = 0 @shebang_line = nil @encoding_line = nil @frozen_string_line = nil @file_encoding = nil @newline = true @percent_ary = nil end |
Instance Attribute Details
#ast ⇒ Object (readonly) Also known as: root
28 29 30 |
# File 'lib/yard/parser/ruby/ruby_parser.rb', line 28 def ast @ast end |
#charno ⇒ Object (readonly)
28 29 30 |
# File 'lib/yard/parser/ruby/ruby_parser.rb', line 28 def charno @charno end |
#comments ⇒ Object (readonly)
28 29 30 |
# File 'lib/yard/parser/ruby/ruby_parser.rb', line 28 def comments @comments end |
#encoding_line ⇒ Object (readonly)
29 30 31 |
# File 'lib/yard/parser/ruby/ruby_parser.rb', line 29 def encoding_line @encoding_line end |
#file ⇒ Object (readonly)
28 29 30 |
# File 'lib/yard/parser/ruby/ruby_parser.rb', line 28 def file @file end |
#frozen_string_line ⇒ Object (readonly)
29 30 31 |
# File 'lib/yard/parser/ruby/ruby_parser.rb', line 29 def frozen_string_line @frozen_string_line end |
#shebang_line ⇒ Object (readonly)
29 30 31 |
# File 'lib/yard/parser/ruby/ruby_parser.rb', line 29 def shebang_line @shebang_line end |
#tokens ⇒ Object (readonly)
28 29 30 |
# File 'lib/yard/parser/ruby/ruby_parser.rb', line 28 def tokens @tokens end |
Instance Method Details
#enumerator ⇒ Object
64 65 66 |
# File 'lib/yard/parser/ruby/ruby_parser.rb', line 64 def enumerator ast.children end |
#file_encoding ⇒ Object
68 69 70 71 72 73 74 |
# File 'lib/yard/parser/ruby/ruby_parser.rb', line 68 def file_encoding return nil unless defined?(::Encoding) return @file_encoding if @file_encoding return Encoding.default_internal unless @encoding_line match = @encoding_line.match(SourceParser::ENCODING_LINE) @file_encoding = match.captures.last if match end |
#parse ⇒ Object
55 56 57 58 59 60 61 62 |
# File 'lib/yard/parser/ruby/ruby_parser.rb', line 55 def parse @ast = super @ast.full_source = @source @ast.file = @file freeze_tree insert_comments self end |