Class: YARD::Parser::Ruby::RipperParser

Inherits:
Ripper
  • Object
show all
Defined in:
lib/yard/parser/ruby/ruby_parser.rb

Overview

Internal parser class

Since:

  • 0.5.6

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source, filename, *args) ⇒ RipperParser

Returns a new instance of RipperParser.

Since:

  • 0.5.6



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# 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 = []
  @map = {}
  @ns_charno = 0
  @list = []
  @charno = 0
  @groups = []
  @shebang_line = nil
  @encoding_line = nil
end

Instance Attribute Details

#astObject (readonly) Also known as: root

Since:

  • 0.5.6



25
26
27
# File 'lib/yard/parser/ruby/ruby_parser.rb', line 25

def ast
  @ast
end

#charnoObject (readonly)

Since:

  • 0.5.6



25
26
27
# File 'lib/yard/parser/ruby/ruby_parser.rb', line 25

def charno
  @charno
end

#commentsObject (readonly)

Since:

  • 0.5.6



25
26
27
# File 'lib/yard/parser/ruby/ruby_parser.rb', line 25

def comments
  @comments
end

#encoding_lineObject (readonly)

Since:

  • 0.5.6



26
27
28
# File 'lib/yard/parser/ruby/ruby_parser.rb', line 26

def encoding_line
  @encoding_line
end

#fileObject (readonly)

Since:

  • 0.5.6



25
26
27
# File 'lib/yard/parser/ruby/ruby_parser.rb', line 25

def file
  @file
end

#shebang_lineObject (readonly)

Since:

  • 0.5.6



26
27
28
# File 'lib/yard/parser/ruby/ruby_parser.rb', line 26

def shebang_line
  @shebang_line
end

#tokensObject (readonly)

Since:

  • 0.5.6



25
26
27
# File 'lib/yard/parser/ruby/ruby_parser.rb', line 25

def tokens
  @tokens
end

Instance Method Details

#enumeratorObject

Since:

  • 0.5.6



56
57
58
# File 'lib/yard/parser/ruby/ruby_parser.rb', line 56

def enumerator
  ast.children
end

#parseObject

Since:

  • 0.5.6



47
48
49
50
51
52
53
54
# File 'lib/yard/parser/ruby/ruby_parser.rb', line 47

def parse
  @ast = super
  @ast.full_source = @source
  @ast.file = @file
  freeze_tree
  insert_comments
  self
end