Class: YARD::Parser::Ruby::Legacy::StatementList

Inherits:
Array
  • Object
show all
Includes:
RubyToken
Defined in:
lib/yard/parser/ruby/legacy/statement_list.rb

Constant Summary collapse

OPEN_BLOCK_TOKENS =

The following list of tokens will require a block to be opened if used at the beginning of a statement.

[TkCLASS, TkDEF, TkMODULE, TkUNTIL,
TkIF, TkELSIF, TkUNLESS, TkWHILE, TkFOR, TkCASE]

Constants included from RubyToken

RubyToken::EXPR_ARG, RubyToken::EXPR_BEG, RubyToken::EXPR_CLASS, RubyToken::EXPR_DOT, RubyToken::EXPR_END, RubyToken::EXPR_FNAME, RubyToken::EXPR_MID, RubyToken::NEWLINE_TOKEN, RubyToken::TkReading2Token, RubyToken::TkSymbol2Token

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(content) ⇒ StatementList

Creates a new statement list

Parameters:



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/yard/parser/ruby/legacy/statement_list.rb', line 16

def initialize(content)
  @shebang_line = nil
  @encoding_line = nil
  if content.is_a? TokenList
    @tokens = content.dup
  elsif content.is_a? String
    @tokens = TokenList.new(content.gsub("\r", ""))
  else
    raise ArgumentError, "Invalid content for StatementList: #{content.inspect}:#{content.class}"
  end

  parse_statements
end

Instance Attribute Details

#encoding_lineObject

Returns the value of attribute encoding_line.



6
7
8
# File 'lib/yard/parser/ruby/legacy/statement_list.rb', line 6

def encoding_line
  @encoding_line
end

#shebang_lineObject

Returns the value of attribute shebang_line.



6
7
8
# File 'lib/yard/parser/ruby/legacy/statement_list.rb', line 6

def shebang_line
  @shebang_line
end