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 Method Summary collapse

Methods inherited from Array

#place

Constructor Details

#initialize(content) ⇒ StatementList

Creates a new statement list

Parameters:



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

def initialize(content)
  @group = 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