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

Inherits:
  Array
  - Object
  - Array
  - YARD::Parser::Ruby::Legacy::StatementList
  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

- #encoding_line ⇒ Object

  Returns the value of attribute encoding_line.

- #shebang_line ⇒ Object

  Returns the value of attribute shebang_line.

## Instance Method Summary collapse

- #initialize(content) ⇒ StatementList constructor

  Creates a new statement list.

## Constructor Details

### #initialize(content) ⇒ `StatementList`

Creates a new statement list

Parameters:

- content (`TokenList`, `String`) —

  the tokens to create the list from

    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30

    # File 'lib/yard/parser/ruby/legacy/statement_list.rb', line 17

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

      parse_statements
    end

## Instance Attribute Details

### #encoding_line ⇒ `Object`

Returns the value of attribute encoding_line.

    7
    8
    9

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

    def encoding_line
      @encoding_line
    end

### #shebang_line ⇒ `Object`

Returns the value of attribute shebang_line.

    7
    8
    9

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

    def shebang_line
      @shebang_line
    end