class YARD::Parser::Ruby::Legacy::StatementList

def process_token(tk)

Parameters:
  • tk (RubyToken::Token) -- the token to process
def process_token(tk)
  # p tk.class, tk.text, @state, @level, @current_block, "<br/>"
  case @state
  when :first_statement
    return if process_initial_comment(tk)
    return if @statement.empty? && [TkSPACE, TkNL, TkCOMMENT].include?(tk.class)
    @comments_last_line = nil
    if @statement.empty? && tk.class == TkALIAS
      @state = :alias_statement
      @alias_values = []
      push_token(tk)
      return
    end
    return if process_simple_block_opener(tk)
    push_token(tk)
    return if process_complex_block_opener(tk)
    if balances?(tk)
      process_statement_end(tk)
    else
      @state = :balance
    end
  when :alias_statement
    push_token(tk)
    @alias_values << tk unless [TkSPACE, TkNL, TkCOMMENT].include?(tk.class)
    if @alias_values.size == 2
      @state = :first_statement
      if [NilClass, TkNL, TkEND_OF_SCRIPT, TkSEMICOLON].include?(peek_no_space.class)
        @done = true
      end
    end
  when :balance
    @statement << tk
    return unless balances?(tk)
    @state = :first_statement
    process_statement_end(tk)
  when :block_statement
    push_token(tk)
    return unless balances?(tk)
    process_statement_end(tk)
  when :pre_block
    @current_block = nil
    process_block_token(tk) unless tk.class == TkSEMICOLON
    @state = :block
  when :block
    process_block_token(tk)
  when :post_block
    if tk.class == TkSPACE
      @statement << tk
      return
    end
    process_statement_end(tk)
    @state = :block
  end
  if @first_line == tk.line_no && !@statement.empty? && TkCOMMENT === tk
    process_initial_comment(tk)
  end
end